netfilter: flowtable: fix IPv6 tunnel addr match

[ Upstream commit 39f6eed4cb ]

Previously the IPv6 addresses in the key were clobbered and the mask was
left unset.

I haven't tested this; I noticed it while skimming the code to
understand an unrelated issue.

Fixes: cfab6dbd0e ("netfilter: flowtable: add tunnel match offload support")
Cc: wenxu <wenxu@ucloud.cn>
Signed-off-by: Will Mortensen <willmo@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Will Mortensen 2021-11-06 18:28:21 -07:00 коммит произвёл Greg Kroah-Hartman
Родитель e76228cbec
Коммит ed741b849a
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -65,11 +65,11 @@ static void nf_flow_rule_lwt_match(struct nf_flow_match *match,
sizeof(struct in6_addr)); sizeof(struct in6_addr));
if (memcmp(&key->enc_ipv6.src, &in6addr_any, if (memcmp(&key->enc_ipv6.src, &in6addr_any,
sizeof(struct in6_addr))) sizeof(struct in6_addr)))
memset(&key->enc_ipv6.src, 0xff, memset(&mask->enc_ipv6.src, 0xff,
sizeof(struct in6_addr)); sizeof(struct in6_addr));
if (memcmp(&key->enc_ipv6.dst, &in6addr_any, if (memcmp(&key->enc_ipv6.dst, &in6addr_any,
sizeof(struct in6_addr))) sizeof(struct in6_addr)))
memset(&key->enc_ipv6.dst, 0xff, memset(&mask->enc_ipv6.dst, 0xff,
sizeof(struct in6_addr)); sizeof(struct in6_addr));
enc_keys |= BIT(FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS); enc_keys |= BIT(FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS);
key->enc_control.addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; key->enc_control.addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS;