lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080520145418.35865dd6.akpm@linux-foundation.org>
Date:	Tue, 20 May 2008 14:54:18 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Jay Vosburgh <fubar@...ibm.com>
Cc:	netdev@...r.kernel.org, jgarzik@...ox.com, monis@...taire.com
Subject: Re: [PATCH 6/8] bonding: Send more than one gratuitous ARP when
 slave takes over

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

> From: Moni Shoua <monis@...taire.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.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ