OSDN Git Service

netfilter: Dissect flow after packet mangling
authorIdo Schimmel <idosch@nvidia.com>
Wed, 14 Apr 2021 08:20:32 +0000 (11:20 +0300)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 18 Apr 2021 20:04:16 +0000 (22:04 +0200)
commit812fa71f0d967dea7616810f27e98135d410b27e
tree5c7385ce12cf10921f289c7e65ca809904208f99
parent783003f3bb8a565326e89d18bbd948ad8ffc816a
netfilter: Dissect flow after packet mangling

Netfilter tries to reroute mangled packets as a different route might
need to be used following the mangling. When this happens, netfilter
does not populate the IP protocol, the source port and the destination
port in the flow key. Therefore, FIB rules that match on these fields
are ignored and packets can be misrouted.

Solve this by dissecting the outer flow and populating the flow key
before rerouting the packet. Note that flow dissection only happens when
FIB rules that match on these fields are installed, so in the common
case there should not be a penalty.

Reported-by: Michal Soltys <msoltyspl@yandex.pl>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/ipv4/netfilter.c
net/ipv6/netfilter.c