linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bonding: fix bond-6-mode change MAC of arp reply from vif to  cause Domu's network unreachable intermittently
@ 2012-10-29  9:11 zheng.li
  2012-10-29 17:33 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: zheng.li @ 2012-10-29  9:11 UTC (permalink / raw)
  To: netdev, Jay Vosburgh, Andy Gospodarek
  Cc: linux-kernel, David S. Miller, Joe Jin, zheng.x.li

This is a fix for a bug in bond_alb.c
Rate of reproduced:100%
Scenario: set Dom0 to bond 6 mode, Domu communicate with Dom0 through
vif which is in bridge mode. The Dom0's bridge of xenbr0 contains vif
and bond0, bond0 contains eth0 and eth1. You can just need to ping a
host which is in same LAN on
Domu, some of packets will be lost intermittently.
Analyse: When Dom0 set bond mode to 6(alb), the bond_alb will change MAC
of every arp reply in rlb_arp_xmit function to affect receive packets,
it is ok for normal NIC, but it's wrong to Domu, when Domu send arp
reply through vif of Dom0, bond of alb replace Domu's MAC in arp reply
with NIC's MAC address, that will cause remote host send packets to Domu
using real NIC's MAC instead of Domu's MAC. Domu
can't receive the packets whose dst MAC is not Domu's MAC.

Signed-off-by: Zheng Li <zheng.x.li@oracle.com>
Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Cc: "David S. Miller" <davem@davemloft.net>
---
 drivers/net/bonding/bond_alb.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index e15cc11..d6b134a 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -700,7 +700,18 @@ static struct slave *rlb_arp_xmit(struct sk_buff
*skb, struct bonding *bond)
 		*/
 		tx_slave = rlb_choose_channel(skb, bond);
 		if (tx_slave) {
-			memcpy(arp->mac_src,tx_slave->dev->dev_addr, ETH_ALEN);
+			struct slave *tmp_slave = NULL;
+			int i = 0, found_mac = 0;
+			bond_for_each_slave(bond, tmp_slave, i) {
+				if (ether_addr_equal_64bits(arp->mac_src,
+						tmp_slave->dev->dev_addr)) {
+					found_mac = 1;
+					break;
+				}
+			}
+			if (found_mac)
+				memcpy(arp->mac_src, tx_slave->dev->dev_addr,
+					ETH_ALEN);
 		}
 		pr_debug("Server sent ARP Reply packet\n");
 	} else if (arp->op_code == htons(ARPOP_REQUEST)) {
-- 
1.7.6.5


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

* Re: [PATCH] bonding: fix bond-6-mode change MAC of arp reply from vif to cause Domu's network unreachable intermittently
  2012-10-29  9:11 [PATCH] bonding: fix bond-6-mode change MAC of arp reply from vif to cause Domu's network unreachable intermittently zheng.li
@ 2012-10-29 17:33 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-10-29 17:33 UTC (permalink / raw)
  To: zheng.x.li; +Cc: netdev, fubar, andy, linux-kernel, joe.jin

From: "zheng.li" <zheng.x.li@oracle.com>
Date: Mon, 29 Oct 2012 17:11:28 +0800

> @@ -700,7 +700,18 @@ static struct slave *rlb_arp_xmit(struct sk_buff
> *skb, struct bonding *bond)

You commit message is poorly formatted and your email client corrupted
the patch, making it completely unusable.

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

end of thread, other threads:[~2012-10-29 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-29  9:11 [PATCH] bonding: fix bond-6-mode change MAC of arp reply from vif to cause Domu's network unreachable intermittently zheng.li
2012-10-29 17:33 ` David Miller

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