netfilter: xt_TEE: fix wrong interface selection
authorTaehee Yoo <ap420073@gmail.com>
Sat, 6 Oct 2018 15:09:18 +0000 (00:09 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Mar 2019 21:02:40 +0000 (14:02 -0700)
commit02d86085cac6365ecf68a124ac05fbe1acb60377
tree9d29db269f3e7f29d933b3cc947d02fcd53a25d2
parentf9a0a08d9c9981e21f86af2f62dba64cf605cd49
netfilter: xt_TEE: fix wrong interface selection

[ Upstream commit f24d2d4f9586985509320f90308723d3d0c4e47f ]

TEE netdevice notifier handler checks only interface name. however
each netns can have same interface name. hence other netns's interface
could be selected.

test commands:
   %ip netns add vm1
   %iptables -I INPUT -p icmp -j TEE --gateway 192.168.1.1 --oif enp2s0
   %ip link set enp2s0 netns vm1

Above rule is in the root netns. but that rule could get enp2s0
ifindex of vm1 by notifier handler.

After this patch, TEE rule is added to the per-netns list.

Fixes: 9e2f6c5d78db ("netfilter: Rework xt_TEE netdevice notifier")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/xt_TEE.c