Re: [PATCH] 2.4.22-pre9-bk : bonding bug fixes

2 messages, 2 authors, 2003-07-31 · open the first message on its own page

Re: [PATCH] 2.4.22-pre9-bk : bonding bug fixes

From: Jay Vosburgh <hidden>
Date: 2003-07-31 00:24:54

On Wed, 30 Jul 2003 16:06:58 +0200
Willy Tarreau [off-list ref] wrote:
quoted
there are still a few bugs in the current bonding driver. I've reported them
several times now, but perhaps not at the right places...
So now we have these few bug fixes, and the backport of the
2.6.x version of the bonding code, both submitted on the same
day in fact :-)

Jeff I'd recommend we put Willy's fixes in if you think they're
OK, then we can think about the 2.6.x backport work for 2.4.23-preX
	I've been looking at Willy's fixes, and the typo (first patch)
and locking fix (third patch) both look good to me.  The second patch
(the dead code warning) points out a real problem, in that the code in
question really has no function, but the patch probably doesn't go far
enough for a final solution (the variable that code would set,
arp_target_hw_addr, is referenced in other places, but ends up always
being NULL because the dead code is the only place it was ever set).

	A more proper solution would be to simply delete the dead code
and the arp_target_hw_addr variable, and replace the variable
references with NULL.  This means that all of the ARP probes sent will
be sent out as broadcasts, which is what's already happening, this
just makes the code clearer.  Patch follows (which replaces Willy's
second patch).

	Does this sound reasonable to everybody?

	-J

---
	-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com

--- linux-2.4.22-pre9-bk-wt/drivers/net/bonding/bond_main.c	2003-07-30 17:06:50.000000000 -0700
+++ linux-2.4.22-pre9-bk/drivers/net/bonding/bond_main.c	2003-07-30 17:08:53.000000000 -0700
@@ -463,7 +463,6 @@
 static unsigned long arp_target[MAX_ARP_IP_TARGETS] = { 0, } ;
 static int arp_ip_count = 0;
 static u32 my_ip = 0;
-char *arp_target_hw_addr = NULL;
 
 static char *primary= NULL;
 
@@ -596,8 +595,7 @@
 
 	for (i = 0; (i<MAX_ARP_IP_TARGETS) && arp_target[i]; i++) { 
 		arp_send(ARPOP_REQUEST, ETH_P_ARP, arp_target[i], slave->dev, 
-			 my_ip, arp_target_hw_addr, slave->dev->dev_addr,
-			 arp_target_hw_addr); 
+			 my_ip, NULL, slave->dev->dev_addr, NULL); 
 	} 
 }
  
@@ -1031,10 +1029,6 @@
 	}
 	if (arp_interval> 0) {  /* arp interval, in milliseconds. */
 		del_timer(&bond->arp_timer);
-                if (arp_target_hw_addr != NULL) {
-			kfree(arp_target_hw_addr); 
-			arp_target_hw_addr = NULL;
-		}
 	}
 
 	if (bond_mode == BOND_MODE_8023AD) {
@@ -3281,28 +3275,6 @@
 		memcpy(&my_ip, the_ip, 4);
 	}
 
-	/* if we are sending arp packets and don't know 
-	 * the target hw address, save it so we don't need 
-	 * to use a broadcast address.
-	 * don't do this if in active backup mode because the slaves must 
-	 * receive packets to stay up, and the only ones they receive are 
-	 * broadcasts. 
-	 */
-	if ( (bond_mode != BOND_MODE_ACTIVEBACKUP) && 
-             (arp_ip_count == 1) &&
-	     (arp_interval > 0) && (arp_target_hw_addr == NULL) &&
-	     (skb->protocol == __constant_htons(ETH_P_IP) ) ) {
-		struct ethhdr *eth_hdr = 
-			(struct ethhdr *) (((char *)skb->data));
-		struct iphdr *ip_hdr = (struct iphdr *)(eth_hdr + 1);
-
-		if (arp_target[0] == ip_hdr->daddr) {
-			arp_target_hw_addr = kmalloc(ETH_ALEN, GFP_KERNEL);
-			if (arp_target_hw_addr != NULL)
-				memcpy(arp_target_hw_addr, eth_hdr->h_dest, ETH_ALEN);
-		}
-	}
-
 	read_lock(&bond->lock);
 
 	read_lock(&bond->ptrlock);

Re: [PATCH] 2.4.22-pre9-bk : bonding bug fixes

From: Willy Tarreau <hidden>
Date: 2003-07-31 05:03:39

Hi Jay !

On Wed, Jul 30, 2003 at 05:22:15PM -0700, Jay Vosburgh wrote:
 
	I've been looking at Willy's fixes, and the typo (first patch)
and locking fix (third patch) both look good to me.  The second patch
(the dead code warning) points out a real problem, in that the code in
question really has no function, but the patch probably doesn't go far
enough for a final solution (the variable that code would set,
arp_target_hw_addr, is referenced in other places, but ends up always
being NULL because the dead code is the only place it was ever set).

	A more proper solution would be to simply delete the dead code
and the arp_target_hw_addr variable, and replace the variable
references with NULL.  This means that all of the ARP probes sent will
be sent out as broadcasts, which is what's already happening, this
just makes the code clearer.  Patch follows (which replaces Willy's
second patch).

	Does this sound reasonable to everybody?
Perfectly reasonable to me. My patch was not intended to fix it but to allow
anybody to comment on this code, which would not have been possible if I removed
it myself ;-)

IMHO, ARP probes should always be sent with broadcast addresses. We could
think about switching to unicast when we get a reply, but we must switch back
to broadcast as soon as we lose a target. This would complexify the magic which
is not absolutely necessary here.

I might send other fix propositions later (2.4.23-pre) for the ARP behaviour
(better IP source address selection, etc...) because I don't like it very much
when drivers try to find their information themselves and stick to it for all
their life (eg: my_ip). I'd like to dynamically lookup the valid source IP at
each probe (which is not *that* frequent in fact).

Cheers,
Willy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help