[PATCH RFC v1 net-next 02/12] netfilter: bridge: Add conntrack double vlan and pppoe
Vladimir Oltean
olteanv at gmail.com
Fri Oct 18 06:17:54 PDT 2024
On Sun, Oct 13, 2024 at 08:54:58PM +0200, Eric Woudstra wrote:
> This adds the capability to conntrack 802.1ad, QinQ, PPPoE and PPPoE-in-Q
> packets that are passing a bridge.
>
> Signed-off-by: Eric Woudstra <ericwouds at gmail.com>
> ---
Whatever you choose to do forward with these patches, please squash this
build fix here (you can drop my authorship info and commit message):
>From e73315196c3143de2af2fe39e3b0e95391849d6c Mon Sep 17 00:00:00 2001
From: Vladimir Oltean <vladimir.oltean at nxp.com>
Date: Fri, 18 Oct 2024 13:59:27 +0300
Subject: [PATCH] netfilter: bridge: fix build failures in nf_ct_bridge_pre()
clang-16 fails to build, stating:
net/bridge/netfilter/nf_conntrack_bridge.c:257:3: error: expected expression
struct ppp_hdr {
^
net/bridge/netfilter/nf_conntrack_bridge.c:262:20: error: use of undeclared identifier 'ph'
data_len = ntohs(ph->hdr.length) - 2;
^
net/bridge/netfilter/nf_conntrack_bridge.c:262:20: error: use of undeclared identifier 'ph'
net/bridge/netfilter/nf_conntrack_bridge.c:262:20: error: use of undeclared identifier 'ph'
net/bridge/netfilter/nf_conntrack_bridge.c:262:20: error: use of undeclared identifier 'ph'
net/bridge/netfilter/nf_conntrack_bridge.c:265:11: error: use of undeclared identifier 'ph'
switch (ph->proto) {
^
net/bridge/netfilter/nf_conntrack_bridge.c:278:3: error: expected expression
struct vlan_hdr *vhdr = (struct vlan_hdr *)(skb->data);
^
net/bridge/netfilter/nf_conntrack_bridge.c:283:17: error: use of undeclared identifier 'vhdr'
inner_proto = vhdr->h_vlan_encapsulated_proto;
^
One cannot have variable declarations placed this way in a switch/case
statement, a new scope must be opened.
Signed-off-by: Vladimir Oltean <vladimir.oltean at nxp.com>
---
net/bridge/netfilter/nf_conntrack_bridge.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/bridge/netfilter/nf_conntrack_bridge.c b/net/bridge/netfilter/nf_conntrack_bridge.c
index fb2f79396aa0..31e2bcd71735 100644
--- a/net/bridge/netfilter/nf_conntrack_bridge.c
+++ b/net/bridge/netfilter/nf_conntrack_bridge.c
@@ -253,7 +253,7 @@ static unsigned int nf_ct_bridge_pre(void *priv, struct sk_buff *skb,
return NF_ACCEPT;
switch (skb->protocol) {
- case htons(ETH_P_PPP_SES):
+ case htons(ETH_P_PPP_SES): {
struct ppp_hdr {
struct pppoe_hdr hdr;
__be16 proto;
@@ -273,7 +273,8 @@ static unsigned int nf_ct_bridge_pre(void *priv, struct sk_buff *skb,
return NF_ACCEPT;
}
break;
- case htons(ETH_P_8021Q):
+ }
+ case htons(ETH_P_8021Q): {
struct vlan_hdr *vhdr = (struct vlan_hdr *)(skb->data);
data_len = 0xffffffff;
@@ -281,6 +282,7 @@ static unsigned int nf_ct_bridge_pre(void *priv, struct sk_buff *skb,
outer_proto = skb->protocol;
inner_proto = vhdr->h_vlan_encapsulated_proto;
break;
+ }
default:
data_len = 0xffffffff;
break;
--
2.43.0
More information about the Linux-mediatek
mailing list