Skip to contentSkip to conversation

netfilter: bridge: fix routing of bridge frames with call-iptables=1

PATCH Applied Florian Westphal 3 participants 3 messages Sep 14, 2015 – Sep 16, 2015

Subsystems (2)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH v2 1/1 netfilter: bridge: fix routing of bridge frames with call-iptables=1

We can't re-use the physoutdev storage area.

1. When using NFQUEUE in PREROUTING, we attempt to bump a bogus refcnt since nf_bridge->physoutdev is garbage (ipv4/ipv6 address)

2. for same reason, we crash in physdev match in FORWARD or later if skb is routed instead of bridged.

This increases nf_bridge_info to 40 bytes, but we have no other choice.

Fixes 72b1e5e4cac7 ("netfilter: bridge: reduce nf_bridge_info to 32 bytes again")

---
Either
- hard-reset nf.git to obliterate the v1 of the patch, then apply this one instead, OR,
- revert v1 and apply this on top.

include/linux/skbuff.h +3 -3
index 2738d35..9987af0 100644
@@ -179,6 +179,9 @@ struct nf_bridge_info {
 	u8			bridged_dnat:1;
 	__u16			frag_max_size;
 	struct net_device	*physindev;
+
+	/* always valid & non-NULL from FORWARD on, for physdev match */
+	struct net_device	*physoutdev;
 	union {
 		/* prerouting: detect dnat in orig/reply direction */
 		__be32          ipv4_daddr;
@@ -189,9 +192,6 @@ struct nf_bridge_info {
 		 * skb is out in neigh layer.
 		 */
 		char neigh_header[8];
-
-		/* always valid & non-NULL from FORWARD on, for physdev match */
-		struct net_device *physoutdev;
 	};
 };
 #endif
Signature · 1 line
2.0.5
#1 lore raw
Quoted 11 lines · Florian Westphal

We can't re-use the physoutdev storage area.

1. When using NFQUEUE in PREROUTING, we attempt to bump a bogus refcnt since nf_bridge->physoutdev is garbage (ipv4/ipv6 address)

2. for same reason, we crash in physdev match in FORWARD or later if skb is routed instead of bridged.

This increases nf_bridge_info to 40 bytes, but we have no other choice.

Fixes 72b1e5e4cac7 ("netfilter: bridge: reduce nf_bridge_info to 32
Quoted 8 lines

bytes again")

---
Either
- hard-reset nf.git to obliterate the v1 of the patch, then apply this one instead, OR,
- revert v1 and apply this on top.

re-tested, and for my case this patch also works, thx again ! --
Sander

Quoted 25 lines
include/linux/skbuff.h +3 -3
index 2738d35..9987af0 100644
@@ -179,6 +179,9 @@ struct nf_bridge_info {
 	u8			bridged_dnat:1;
 	__u16			frag_max_size;
 	struct net_device	*physindev;
+
+	/* always valid & non-NULL from FORWARD on, for physdev match */
+	struct net_device	*physoutdev;
 	union {
 		/* prerouting: detect dnat in orig/reply direction */
 		__be32          ipv4_daddr;
@@ -189,9 +192,6 @@ struct nf_bridge_info {
 		 * skb is out in neigh layer.
 		 */
 		char neigh_header[8];
-
-		/* always valid & non-NULL from FORWARD on, for physdev match */
-		struct net_device *physoutdev;
 	};
 };
 #endif
maintainer Applied
#2 lore raw
In reply to Florian Westphal
Quoted 9 lines · Florian Westphal

We can't re-use the physoutdev storage area.

1. When using NFQUEUE in PREROUTING, we attempt to bump a bogus refcnt since nf_bridge->physoutdev is garbage (ipv4/ipv6 address)

2. for same reason, we crash in physdev match in FORWARD or later if skb is routed instead of bridged.

This increases nf_bridge_info to 40 bytes, but we have no other choice.

Applied, thanks.