[PATCH nf-next] netfilter: flowtable: fix set software outdev on top of the net_device_path_stack

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: wenxu <wenxu@xxxxxxxxx>

The outdev of nft_forward_info should be set on the top of stack device.
Such the following case:
br0 is a bridge with pvid 100 and veth is in the vlan 100 without untagged

ip l add dev br0 type bridge vlan_filtering 1
brctl addif br0 veth
bridge vlan add dev veth vid 100
bridge vlan add dev br0 vid 100 pvid untagged self

The net device path should be br0-->veth
The software offload doesn't encap the vlan tag and the outdev should
be the top device in the stack(route device).
So thehe outdev for softeware offload should set on br0 but not veth.
Or the vlan didn't tagged outgoing through veth

Fixes: 4cd91f7c290f ("netfilter: flowtable: add vlan support")
Signed-off-by: wenxu <wenxu@xxxxxxxxx>
---
 net/netfilter/nft_flow_offload.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c
index 4843dd2..53f641b 100644
--- a/net/netfilter/nft_flow_offload.c
+++ b/net/netfilter/nft_flow_offload.c
@@ -119,7 +119,8 @@ static void nft_dev_path_info(const struct net_device_path_stack *stack,
 				info->indev = NULL;
 				break;
 			}
-			info->outdev = path->dev;
+			if (!info->outdev)
+				info->outdev = path->dev;
 			info->encap[info->num_encaps].id = path->encap.id;
 			info->encap[info->num_encaps].proto = path->encap.proto;
 			info->num_encaps++;
@@ -129,6 +130,8 @@ static void nft_dev_path_info(const struct net_device_path_stack *stack,
 		case DEV_PATH_BRIDGE:
 			if (is_zero_ether_addr(info->h_source))
 				memcpy(info->h_source, path->dev->dev_addr, ETH_ALEN);
+			if (!info->outdev)
+				info->outdev = path->dev;
 
 			switch (path->bridge.vlan_mode) {
 			case DEV_PATH_BR_VLAN_UNTAG_HW:
-- 
1.8.3.1




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux