netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PATCH: fix bridged 802.3ad bonding
@ 2008-06-03 13:21 Jiri Bohac
  2008-06-03 14:13 ` Patrick McHardy
  2008-06-03 16:46 ` Stephen Hemminger
  0 siblings, 2 replies; 14+ messages in thread
From: Jiri Bohac @ 2008-06-03 13:21 UTC (permalink / raw)
  To: netdev, David Miller, Stephen Hemminger, Jay Vosburgh

Hi,

Bonding in 802.3ad mode breaks when the bond interface is added
to a bridge (which makes 802.3ad unusable in XEN, for example).

The problem is that br_pass_frame_up() will change the skb's dev
pointer to point to the bridge interface. As a result, the LACP
packets will not reach the bond_3ad_lacpdu_recv() protocol
handler registered on the bonding device. Even if they did, the
handler won't work with the changed skb->dev.

The following patch fixes the problem.

Signed-off-by: Jiri Bohac <jbohac@suse.cz>


diff --git a/net/core/dev.c b/net/core/dev.c
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1832,6 +1832,32 @@ static inline struct net_device *skb_bond(struct sk_buff *skb)
 }
 
 
+/*
+ * If a bonding master interface in 802.3ad mode is part of a bridge,
+ * the bridging hook will mangle the skb->dev to the bridge device.
+ * The bonding 802.3ad protocol handler needs to access the original device,
+ * so fix this up for the 802.3ad packets.
+ */
+static inline void skb_fixup_bridged_bond(struct sk_buff *skb, struct net_device **orig_dev)
+{
+	if (unlikely(skb->protocol == __constant_htons(ETH_P_SLOW)) &&
+	    (skb->dev->priv_flags & IFF_EBRIDGE)) {
+		struct net_device *dev;
+
+		read_lock(&dev_base_lock);
+		dev = __dev_get_by_index(&init_net, skb->iif);
+		read_unlock(&dev_base_lock);
+
+		if (!dev)
+			return;
+
+		if (dev->master)
+			skb->dev = dev->master;
+
+		*orig_dev = dev;
+	}
+}
+
 static void net_tx_action(struct softirq_action *h)
 {
 	struct softnet_data *sd = &__get_cpu_var(softnet_data);
@@ -2080,6 +2106,8 @@ ncls:
 	if (!skb)
 		goto out;
 
+	skb_fixup_bridged_bond(skb, &orig_dev);
+
 	type = skb->protocol;
 	list_for_each_entry_rcu(ptype,
 			&ptype_base[ntohs(type) & PTYPE_HASH_MASK], list) {

-- 
Jiri Bohac <jbohac@suse.cz>
SUSE Labs, SUSE CZ


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-06-17 15:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-03 13:21 PATCH: fix bridged 802.3ad bonding Jiri Bohac
2008-06-03 14:13 ` Patrick McHardy
2008-06-03 16:46 ` Stephen Hemminger
2008-06-03 19:32   ` Jiri Bohac
2008-06-03 20:13     ` Stephen Hemminger
2008-06-03 21:20       ` Jiri Bohac
2008-06-03 21:22       ` Jay Vosburgh
2008-06-03 21:43         ` Stephen Hemminger
2008-06-04  4:55         ` Stephen Hemminger
2008-06-04  8:24           ` Jiri Bohac
2008-06-04 16:06             ` Stephen Hemminger
2008-06-05 10:13               ` Jiri Bohac
2008-06-10 22:42                 ` David Miller
2008-06-17 15:33                   ` Jiri Bohac

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).