public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation•org>
To: Jay Vosburgh <fubar@us•ibm.com>
Cc: netdev@vger•kernel.org, jgarzik@pobox•com, monis@voltaire•com
Subject: Re: [PATCH 6/8] bonding: Send more than one gratuitous ARP when slave takes over
Date: Tue, 20 May 2008 14:54:18 -0700	[thread overview]
Message-ID: <20080520145418.35865dd6.akpm@linux-foundation.org> (raw)
In-Reply-To: <1211083818228-git-send-email-fubar@us.ibm.com>

On Sat, 17 May 2008 21:10:12 -0700
Jay Vosburgh <fubar@us•ibm.com> wrote:

> From: Moni Shoua <monis@voltaire•com>
> 
> With IPoIB, reception of gratuitous ARP by neighboring hosts
> is essential for a successful change of slaves in case of failure.
> Otherwise, they won't learn about the HW address change and need
> to wait a long time until the neighboring system gives up and sends
> an ARP request to learn the new HW address.  This patch decreases
> the chance for a lost of a gratuitous ARP packet by sending it more
> than once. The number retries is configurable and can be set with a
> module param.
> 
> ...
>
> +static ssize_t bonding_store_n_grat_arp(struct device *d,
> +				    struct device_attribute *attr,
> +				    const char *buf, size_t count)
> +{
> +	int new_value, ret = count;
> +	struct bonding *bond = to_bond(d);
> +
> +	if (sscanf(buf, "%d", &new_value) != 1) {

This will treat input such as "42foo" as valid, which is somewhat messy
of us.  A better approach is to use strict_strto*(), which will reject
such invalid input.


> +		printk(KERN_ERR DRV_NAME
> +		       ": %s: no num_grat_arp value specified.\n",
> +		       bond->dev->name);
> +		ret = -EINVAL;
> +		goto out;
> +	}
> +	if (new_value < 0 || new_value > 255) {
> +		printk(KERN_ERR DRV_NAME
> +		       ": %s: Invalid num_grat_arp value %d not in range 0-255; rejected.\n",
> +		       bond->dev->name, new_value);
> +		ret = -EINVAL;
> +		goto out;
> +	} else {
> +		bond->params.num_grat_arp = new_value;
> +	}
> +out:
> +	return ret;
> +}
> +static DEVICE_ATTR(num_grat_arp, S_IRUGO | S_IWUSR, bonding_show_n_grat_arp, bonding_store_n_grat_arp);

Strange that the code jumps through 80-column hoops in some places, but
not in others.


  parent reply	other threads:[~2008-05-20 21:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-18  4:10 [PATCH net-next-2.6 0/8] bonding: Fixes and updates Jay Vosburgh
     [not found] ` <12110838151824-git-send-email-fubar@us.ibm.com>
2008-05-18  4:10   ` [PATCH 2/8] bonding: remove test for IP in ARP monitor Jay Vosburgh
2008-05-18  4:10     ` [PATCH 3/8] bonding: Remove redundant argument from bond_create Jay Vosburgh
2008-05-18  4:10       ` [PATCH 4/8] bonding: Relax unneeded _safe lists iterations Jay Vosburgh
2008-05-18  4:10         ` [PATCH 5/8] bonding: Remove unneeded list_empty checks Jay Vosburgh
2008-05-18  4:10           ` [PATCH 6/8] bonding: Send more than one gratuitous ARP when slave takes over Jay Vosburgh
2008-05-18  4:10             ` [PATCH 7/8] bonding: refactor ARP active-backup monitor Jay Vosburgh
2008-05-18  4:10               ` [PATCH 8/8] bonding: Add "follow" option to fail_over_mac Jay Vosburgh
2008-05-22 11:09                 ` Jeff Garzik
2008-05-20 21:54             ` Andrew Morton [this message]
2008-05-20 21:46       ` [PATCH 3/8] bonding: Remove redundant argument from bond_create Andrew Morton

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=20080520145418.35865dd6.akpm@linux-foundation.org \
    --to=akpm@linux-foundation$(echo .)org \
    --cc=fubar@us$(echo .)ibm.com \
    --cc=jgarzik@pobox$(echo .)com \
    --cc=monis@voltaire$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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