mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 14:13:01 -04:00
net: hns3: fix a copying IPv6 address error in hclge_fd_get_flow_tuples()
[ Upstream commit 47327c9315b2f3ae4ab659457977a26669631f20 ]
The IPv6 address defined in struct in6_addr is specified as
big endian, but there is no specified endian in struct
hclge_fd_rule_tuples, so it will cause a problem if directly
use memcpy() to copy ipv6 address between these two structures
since this field in struct hclge_fd_rule_tuples is little endian.
This patch fixes this problem by using be32_to_cpu() to convert
endian of IPv6 address of struct in6_addr before copying.
Fixes: d93ed94fbe ("net: hns3: add aRFS support for PF")
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
87a5534a1a
commit
3b4cf3b988
1 changed files with 9 additions and 6 deletions
|
|
@ -6003,6 +6003,9 @@ static int hclge_get_all_rules(struct hnae3_handle *handle,
|
|||
static void hclge_fd_get_flow_tuples(const struct flow_keys *fkeys,
|
||||
struct hclge_fd_rule_tuples *tuples)
|
||||
{
|
||||
#define flow_ip6_src fkeys->addrs.v6addrs.src.in6_u.u6_addr32
|
||||
#define flow_ip6_dst fkeys->addrs.v6addrs.dst.in6_u.u6_addr32
|
||||
|
||||
tuples->ether_proto = be16_to_cpu(fkeys->basic.n_proto);
|
||||
tuples->ip_proto = fkeys->basic.ip_proto;
|
||||
tuples->dst_port = be16_to_cpu(fkeys->ports.dst);
|
||||
|
|
@ -6011,12 +6014,12 @@ static void hclge_fd_get_flow_tuples(const struct flow_keys *fkeys,
|
|||
tuples->src_ip[3] = be32_to_cpu(fkeys->addrs.v4addrs.src);
|
||||
tuples->dst_ip[3] = be32_to_cpu(fkeys->addrs.v4addrs.dst);
|
||||
} else {
|
||||
memcpy(tuples->src_ip,
|
||||
fkeys->addrs.v6addrs.src.in6_u.u6_addr32,
|
||||
sizeof(tuples->src_ip));
|
||||
memcpy(tuples->dst_ip,
|
||||
fkeys->addrs.v6addrs.dst.in6_u.u6_addr32,
|
||||
sizeof(tuples->dst_ip));
|
||||
int i;
|
||||
|
||||
for (i = 0; i < IPV6_SIZE; i++) {
|
||||
tuples->src_ip[i] = be32_to_cpu(flow_ip6_src[i]);
|
||||
tuples->dst_ip[i] = be32_to_cpu(flow_ip6_dst[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue