netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jay Vosburgh <fubar@us.ibm.com>
To: "Waskiewicz Jr, Peter P" <peter.p.waskiewicz.jr@intel.com>
Cc: monis@voltaire.com, "netdev" <netdev@vger.kernel.org>,
	"Olga Stern" <olgas@voltaire.com>,
	"Or Gerlitz" <ogerlitz@voltaire.com>
Subject: Re: [PATCH] net/bonding: Send more than one gratuitous ARP when slave takes over
Date: Thu, 10 Apr 2008 13:57:49 -0700	[thread overview]
Message-ID: <25865.1207861069@death> (raw)
In-Reply-To: <D5C1322C3E673F459512FB59E0DDC32904DEAE99@orsmsx414.amr.corp.intel.com>

Waskiewicz Jr, Peter P <peter.p.waskiewicz.jr@intel.com> wrote:

>> @@ -104,6 +105,8 @@ struct bond_params bonding_defaults;
>>  
>> module_param(max_bonds, int, 0);
>> MODULE_PARM_DESC(max_bonds, "Max number of bonded devices");
>> +module_param(num_grat_arp, int, 0644);
>> +MODULE_PARM_DESC(num_grat_arp, "Number of gratuitous ARP packet to
>sned on failover");
>
>Check your spelling here.  s/sned/send/
>
>Also, num_grat_arp is declared int, where send_grat_arp is s8.  What
>happens if you overflow send_grat_arp?  Either your module parameter
>needs to change to match what's in the bonding struct, or you needs some
>bounds checking to validate your inputs.

	I'd vote for bounds checking, myself.  I think a legal range of
0 - 255 is appropriate.

>> @@ -1109,14 +1112,16 @@ void bond_change_active_slave(struct bon
>> 		if (new_active && bond->params.fail_over_mac)
>> 			memcpy(bond->dev->dev_addr,
>new_active->dev->dev_addr,
>> 				new_active->dev->addr_len);
>> +		bond->send_grat_arp = num_grat_arp;
>> 		if (bond->curr_active_slave &&
>>  			test_bit(__LINK_STATE_LINKWATCH_PENDING,
>> -
>&bond->curr_active_slave->dev->state)) {
>> +
>&bond->curr_active_slave->dev->state))
>> 			dprintk("delaying gratuitous arp on %s\n",
>> 				bond->curr_active_slave->dev->name);
>> -			bond->send_grat_arp = 1;
>> -		} else
>> +		else {
>> 			bond_send_gratuitous_arp(bond);
>> +			bond->send_grat_arp--;
>> +		}
>
>Don't modify the if () else () formatting here.  Kernel coding
>guidelines read if any part of your if/else statement requires braces,
>all sections need braces.  So it still should be, with your changes:

	Agreed.

[...]
>> @@ -2144,7 +2149,7 @@ static int __bond_mii_monitor(struct bon
>>  			dprintk("sending delayed gratuitous arp on on
>%s\n",
>>  				bond->curr_active_slave->dev->name);
>>  			bond_send_gratuitous_arp(bond);
>> -			bond->send_grat_arp = 0;
>> +			bond->send_grat_arp--;
>
>Can this ever cause send_grat_arp to become less than zero?  What will
>happen if it does drop below zero?  I think some bounds checking might
>be needed here.

	I don't believe that send_grat_arp can go negative, because this
block is entered on an "if (bond->send_grat_arp)" that's just above the
context in the patch.

	The patch as a whole also needs a sysfs entry to permit
modification and inspection of the num_grat_arp parameter, as is done
for other parameters.

	-J

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

  reply	other threads:[~2008-04-10 20:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-10 15:07 [PATCH] net/bonding: Send more than one gratuitous ARP when slave takes over Moni Shoua
2008-04-10 19:51 ` Waskiewicz Jr, Peter P
2008-04-10 20:57   ` Jay Vosburgh [this message]
2008-04-13 14:13     ` Moni Shoua
2008-04-14 15:25 ` Moni Shoua
2008-04-14 17:50   ` Waskiewicz Jr, Peter P
2008-04-14 21:40     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25865.1207861069@death \
    --to=fubar@us.ibm.com \
    --cc=monis@voltaire.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@voltaire.com \
    --cc=olgas@voltaire.com \
    --cc=peter.p.waskiewicz.jr@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).