]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nft_xfrm: use state family, not hook one
authorFlorian Westphal <fw@strlen.de>
Wed, 10 Oct 2018 15:25:47 +0000 (17:25 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 16 Oct 2018 08:01:49 +0000 (10:01 +0200)
commit47b3cfa4825aafc52afc3f6672f043683d10d22a
tree9c462f53007ae4363d404d07d28b85cde8da7bb0
parent1c33c0279ca0689baba5d5f41cfe248a5ddf5923
netfilter: nft_xfrm: use state family, not hook one

Eyal says:
  doesn't the use of nft_pf(pkt) in this context limit the matching of
  encapsulated packets to the same family?

  IIUC when an e.g. IPv6-in-IPv4 packet is matched, the nft_pf(pkt) will
  be the decapsulated packet family - IPv6 - whereas the state may be
  IPv4. So this check would not allow matching the 'underlay' address in
  such cases.

  I know this was a limitation in xt_policy. but is this intentional in
  this matcher? or is it possible to use state->props.family when
  validating the match instead of nft_pf(pkt)?

Userspace already tells us which address family it expects to match, so
we can just use the real state family rather than the hook family.
so change it as suggested above.

Reported-by: Eyal Birger <eyal.birger@gmail.com>
Suggested-by: Eyal Birger <eyal.birger@gmail.com>
Fixes: 2cb3c7fbb5e4a ("netfilter: nf_tables: add xfrm expression")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nft_xfrm.c