Skip to contentSkip to conversation

netfilter: bridge: neigh_head and physoutdev can't be used at same time

PATCH Applied Florian Westphal 2 participants 2 messages May 3, 2015 – May 14, 2015

Subsystems (3)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 netfilter: bridge: neigh_head and physoutdev can't be used at same time

The neigh_header is only needed when we detect DNAT after prerouting and neigh cache didn't have a mac address for us.

The output port has not been chosen yet so we can re-use the storage area, bringing struct size down to 32 bytes on x86_64.

---
 include/linux/skbuff.h    | 8 +++++---
 net/bridge/br_netfilter.c | 2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)
include/linux/skbuff.h +5 -3
index 66e374d..2cea360 100644
@@ -170,12 +170,14 @@ struct nf_bridge_info {
 		BRNF_PROTO_UNCHANGED,
 		BRNF_PROTO_8021Q,
 		BRNF_PROTO_PPPOE
-	} orig_proto;
+	} orig_proto:8;
 	bool			pkt_otherhost;
 	unsigned int		mask;
 	struct net_device	*physindev;
-	struct net_device	*physoutdev;
-	char			neigh_header[8];
+	union {
+		struct net_device *physoutdev;
+		char neigh_header[8];
+	};
 };
 #endif
 
net/bridge/br_netfilter.c +2 -0
index ab55e24..13973da 100644
@@ -973,6 +973,8 @@ static void br_nf_pre_routing_finish_bridge_slow(struct sk_buff *skb)
 				       nf_bridge->neigh_header,
 				       ETH_HLEN - ETH_ALEN);
 	skb->dev = nf_bridge->physindev;
+
+	nf_bridge->physoutdev = NULL;
 	br_handle_frame_finish(NULL, skb);
 }
 
Signature · 1 line
2.0.5
maintainer Applied
#1 lore raw
Quoted 5 lines · Florian Westphal

The neigh_header is only needed when we detect DNAT after prerouting and neigh cache didn't have a mac address for us.

The output port has not been chosen yet so we can re-use the storage area, bringing struct size down to 32 bytes on x86_64.

Applied, thanks for your patience.