aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authornikolay@redhat.com <nikolay@redhat.com>2013-05-17 21:18:30 -0400
committerDavid S. Miller <davem@davemloft.net>2013-05-20 02:25:49 -0400
commit5a5c5fd48e3bcd57572e9a7a4964ed8f38a20b87 (patch)
tree627125a3d7ad9066549058aa0f4124b00091722c /drivers/net/bonding
parentacca2674a71816c5c9d0caa81fecd33b491fd68f (diff)
bonding: arp_ip_count and arp_targets can be wrong
When getting arp_ip_targets if we encounter a bad IP, arp_ip_count still gets increased and all the targets after the wrong one will not be probed if arp_interval is enabled after that (unless a new IP target is added through sysfs) because of the zero entry, in this case reading arp_ip_target through sysfs will show valid targets even if there's a zero entry. Example: 1.2.3.4,4.5.6.7,blah,5.6.7.8 When retrieving the list from arp_ip_target the output would be: 1.2.3.4,4.5.6.7,5.6.7.8 but there will be a 0 entry between 4.5.6.7 and 5.6.7.8. If arp_interval is enabled after that 5.6.7.8 will never be checked because of that. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_main.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index d4635987bda9..29b846cbfb48 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4471,7 +4471,7 @@ int bond_parse_parm(const char *buf, const struct bond_parm_tbl *tbl)
4471 4471
4472static int bond_check_params(struct bond_params *params) 4472static int bond_check_params(struct bond_params *params)
4473{ 4473{
4474 int arp_validate_value, fail_over_mac_value, primary_reselect_value; 4474 int arp_validate_value, fail_over_mac_value, primary_reselect_value, i;
4475 4475
4476 /* 4476 /*
4477 * Convert string parameters. 4477 * Convert string parameters.
@@ -4651,19 +4651,18 @@ static int bond_check_params(struct bond_params *params)
4651 arp_interval = BOND_LINK_ARP_INTERV; 4651 arp_interval = BOND_LINK_ARP_INTERV;
4652 } 4652 }
4653 4653
4654 for (arp_ip_count = 0; 4654 for (arp_ip_count = 0, i = 0;
4655 (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[arp_ip_count]; 4655 (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[i]; i++) {
4656 arp_ip_count++) {
4657 /* not complete check, but should be good enough to 4656 /* not complete check, but should be good enough to
4658 catch mistakes */ 4657 catch mistakes */
4659 __be32 ip = in_aton(arp_ip_target[arp_ip_count]); 4658 __be32 ip = in_aton(arp_ip_target[i]);
4660 if (!isdigit(arp_ip_target[arp_ip_count][0]) || 4659 if (!isdigit(arp_ip_target[i][0]) || ip == 0 ||
4661 ip == 0 || ip == htonl(INADDR_BROADCAST)) { 4660 ip == htonl(INADDR_BROADCAST)) {
4662 pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n", 4661 pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n",
4663 arp_ip_target[arp_ip_count]); 4662 arp_ip_target[i]);
4664 arp_interval = 0; 4663 arp_interval = 0;
4665 } else { 4664 } else {
4666 arp_target[arp_ip_count] = ip; 4665 arp_target[arp_ip_count++] = ip;
4667 } 4666 }
4668 } 4667 }
4669 4668
@@ -4697,8 +4696,6 @@ static int bond_check_params(struct bond_params *params)
4697 if (miimon) { 4696 if (miimon) {
4698 pr_info("MII link monitoring set to %d ms\n", miimon); 4697 pr_info("MII link monitoring set to %d ms\n", miimon);
4699 } else if (arp_interval) { 4698 } else if (arp_interval) {
4700 int i;
4701
4702 pr_info("ARP monitoring set to %d ms, validate %s, with %d target(s):", 4699 pr_info("ARP monitoring set to %d ms, validate %s, with %d target(s):",
4703 arp_interval, 4700 arp_interval,
4704 arp_validate_tbl[arp_validate_value].modename, 4701 arp_validate_tbl[arp_validate_value].modename,