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: <5430CE37-65C0-4F51-B6D3-C24CC860024B@cumulusnetworks.com>
Date:	Fri, 10 Jan 2014 12:04:54 -0800
From:	Scott Feldman <sfeldma@...ulusnetworks.com>
To:	Nikolay Aleksandrov <nikolay@...hat.com>
Cc:	Netdev <netdev@...r.kernel.org>
Subject: Re: [RFC net-next 2/3] bonding: convert mode setting to use the new option API


On Jan 10, 2014, at 5:11 AM, Nikolay Aleksandrov <nikolay@...hat.com> wrote:

> This patch makes the bond's mode setting use the new option API and
> adds support for dependency printing which relies on having an entry for
> the mode option in the bond_opts[] array.
> 
> Signed-off-by: Nikolay Aleksandrov <nikolay@...hat.com>

> -int bond_option_mode_set(struct bonding *bond, int mode)
> +int bond_option_mode_set(struct bonding *bond, void *newval)
> {
> -	if (bond_parm_tbl_lookup(mode, bond_mode_tbl) < 0) {
> -		pr_err("%s: Ignoring invalid mode value %d.\n",
> -		       bond->dev->name, mode);
> -		return -EINVAL;
> -	}
> -
> -	if (bond->dev->flags & IFF_UP) {
> -		pr_err("%s: unable to update mode because interface is up.\n",
> -		       bond->dev->name);
> -		return -EPERM;
> -	}
> -
> -	if (bond_has_slaves(bond)) {
> -		pr_err("%s: unable to update mode because bond has slaves.\n",
> -			bond->dev->name);
> -		return -EPERM;
> -	}
> +	int mode = *(int *)newval;
> +	struct bond_option *opt;
> 
> 	if (BOND_NO_USES_ARP(mode) && bond->params.arp_interval) {
> +		opt = bond_opt_get(BOND_OPT_MODE);
> 		pr_info("%s: %s mode is incompatible with arp monitoring, start mii monitoring\n",
> -			bond->dev->name, bond_mode_tbl[mode].modename);
> +			bond->dev->name, opt->values[mode].name);

Can this be a name accessor func?          ^^^^^^^^^^^^^^^^^^^^^^

> static ssize_t bonding_store_mode(struct device *d,
> 				  struct device_attribute *attr,
> 				  const char *buf, size_t count)
> {
> -	int new_value, ret;
> 	struct bonding *bond = to_bond(d);
> +	int ret;
> 
> -	new_value = bond_parse_parm(buf, bond_mode_tbl);
> -	if (new_value < 0)  {
> -		pr_err("%s: Ignoring invalid mode value %.*s.\n",
> -		       bond->dev->name, (int)strlen(buf) - 1, buf);
> -		return -EINVAL;
> -	}
> -	if (!rtnl_trylock())
> +	ret = bond_opt_tryset_rtnl(bond, BOND_OPT_MODE, (char *)buf);
> +	if (ret == -EAGAIN)
> 		return restart_syscall();

I wonder if the restart_syscall() should be kept close to rtnl_trylock() in bond_opt_tryset_rtnl?

--
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