aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorBrian Haley <brian.haley@hp.com>2009-04-13 03:11:30 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-13 03:12:41 -0400
commit5a31bec014449dc9ca994e4c1dbf2802b7ca458a (patch)
tree53bacdda4c451bc8ed59bbd0f43e8f466ff93759 /drivers/net
parent9ca046d57412361ac4d220b96fed7fb932616d85 (diff)
Bonding: fix zero address hole bug in arp_ip_target list
Fix a zero address hole bug in the bonding arp_ip_target list that was causing the bond to ignore ARP replies (bugz 13006). Instead of just setting the array entry to zero, we now copy any additional entries down one slot, putting the zero entry at the end. With this change we can now have all the loops that walk the array stop when they hit a zero since there will be no addresses after it. Changes are based in part on code fragment provided in kernel: bugzilla 13006: http://bugzilla.kernel.org/show_bug.cgi?id=13006 by Steve Howard <steve@astutenetworks.com> Signed-off-by: Brian Haley <brian.haley@hp.com> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_main.c5
-rw-r--r--drivers/net/bonding/bond_sysfs.c14
2 files changed, 10 insertions, 9 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 99610f358c40..63369b6b14d4 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2570,7 +2570,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
2570 2570
2571 for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) { 2571 for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) {
2572 if (!targets[i]) 2572 if (!targets[i])
2573 continue; 2573 break;
2574 pr_debug("basa: target %x\n", targets[i]); 2574 pr_debug("basa: target %x\n", targets[i]);
2575 if (list_empty(&bond->vlan_list)) { 2575 if (list_empty(&bond->vlan_list)) {
2576 pr_debug("basa: empty vlan: arp_send\n"); 2576 pr_debug("basa: empty vlan: arp_send\n");
@@ -2677,7 +2677,6 @@ static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32
2677 int i; 2677 int i;
2678 __be32 *targets = bond->params.arp_targets; 2678 __be32 *targets = bond->params.arp_targets;
2679 2679
2680 targets = bond->params.arp_targets;
2681 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) { 2680 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) {
2682 pr_debug("bva: sip %pI4 tip %pI4 t[%d] %pI4 bhti(tip) %d\n", 2681 pr_debug("bva: sip %pI4 tip %pI4 t[%d] %pI4 bhti(tip) %d\n",
2683 &sip, &tip, i, &targets[i], bond_has_this_ip(bond, tip)); 2682 &sip, &tip, i, &targets[i], bond_has_this_ip(bond, tip));
@@ -3303,7 +3302,7 @@ static void bond_info_show_master(struct seq_file *seq)
3303 3302
3304 for(i = 0; (i < BOND_MAX_ARP_TARGETS) ;i++) { 3303 for(i = 0; (i < BOND_MAX_ARP_TARGETS) ;i++) {
3305 if (!bond->params.arp_targets[i]) 3304 if (!bond->params.arp_targets[i])
3306 continue; 3305 break;
3307 if (printed) 3306 if (printed)
3308 seq_printf(seq, ","); 3307 seq_printf(seq, ",");
3309 seq_printf(seq, " %pI4", &bond->params.arp_targets[i]); 3308 seq_printf(seq, " %pI4", &bond->params.arp_targets[i]);
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 18cf4787874c..d28731535226 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -684,17 +684,15 @@ static ssize_t bonding_store_arp_targets(struct device *d,
684 goto out; 684 goto out;
685 } 685 }
686 /* look for an empty slot to put the target in, and check for dupes */ 686 /* look for an empty slot to put the target in, and check for dupes */
687 for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) { 687 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) {
688 if (targets[i] == newtarget) { /* duplicate */ 688 if (targets[i] == newtarget) { /* duplicate */
689 printk(KERN_ERR DRV_NAME 689 printk(KERN_ERR DRV_NAME
690 ": %s: ARP target %pI4 is already present\n", 690 ": %s: ARP target %pI4 is already present\n",
691 bond->dev->name, &newtarget); 691 bond->dev->name, &newtarget);
692 if (done)
693 targets[i] = 0;
694 ret = -EINVAL; 692 ret = -EINVAL;
695 goto out; 693 goto out;
696 } 694 }
697 if (targets[i] == 0 && !done) { 695 if (targets[i] == 0) {
698 printk(KERN_INFO DRV_NAME 696 printk(KERN_INFO DRV_NAME
699 ": %s: adding ARP target %pI4.\n", 697 ": %s: adding ARP target %pI4.\n",
700 bond->dev->name, &newtarget); 698 bond->dev->name, &newtarget);
@@ -720,12 +718,16 @@ static ssize_t bonding_store_arp_targets(struct device *d,
720 goto out; 718 goto out;
721 } 719 }
722 720
723 for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) { 721 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) {
724 if (targets[i] == newtarget) { 722 if (targets[i] == newtarget) {
723 int j;
725 printk(KERN_INFO DRV_NAME 724 printk(KERN_INFO DRV_NAME
726 ": %s: removing ARP target %pI4.\n", 725 ": %s: removing ARP target %pI4.\n",
727 bond->dev->name, &newtarget); 726 bond->dev->name, &newtarget);
728 targets[i] = 0; 727 for (j = i; (j < (BOND_MAX_ARP_TARGETS-1)) && targets[j+1]; j++)
728 targets[j] = targets[j+1];
729
730 targets[j] = 0;
729 done = 1; 731 done = 1;
730 } 732 }
731 } 733 }