From: wenxu@ucloud.cn
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH nf-next] netfilter: flowtable: fix set software outdev on top of the net_device_path_stack
Date: Wed, 31 Mar 2021 16:53:43 +0800 [thread overview]
Message-ID: <1617180823-21881-1-git-send-email-wenxu@ucloud.cn> (raw)
From: wenxu <wenxu@ucloud.cn>
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@ucloud.cn>
---
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
reply other threads:[~2021-03-31 8:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1617180823-21881-1-git-send-email-wenxu@ucloud.cn \
--to=wenxu@ucloud.cn \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).