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]
Date:	Tue, 24 Nov 2009 11:53:34 +0100
From:	Patrick McHardy <kaber@...sh.net>
To:	Arnd Bergmann <arnd@...db.de>
CC:	Eric Dumazet <eric.dumazet@...il.com>,
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
	David Miller <davem@...emloft.net>,
	Stephen Hemminger <shemminger@...tta.com>,
	Herbert Xu <herbert@...dor.apana.org.au>,
	Patrick Mullaney <pmullaney@...ell.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Edge Virtual Bridging <evb@...oogroups.com>,
	Anna Fischer <anna.fischer@...com>,
	bridge@...ts.linux-foundation.org,
	virtualization@...ts.linux-foundation.org,
	Jens Osterkamp <jens@...ux.vnet.ibm.com>,
	Gerhard Stenzel <gerhard.stenzel@...ibm.com>,
	Mark Smith <lk-netdev@...netdev.nosense.org>
Subject: Re: [PATCH 4/4] macvlan: export macvlan mode through netlink

Arnd Bergmann wrote:
> @@ -600,6 +594,18 @@ static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[])
>  		if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS])))
>  			return -EADDRNOTAVAIL;
>  	}
> +
> +	if (data && data[IFLA_MACVLAN_MODE]) {
> +		u32 mode = nla_get_u32(data[IFLA_MACVLAN_MODE]);
> +		switch (mode) {
> +		case MACVLAN_MODE_PRIVATE:
> +		case MACVLAN_MODE_VEPA:
> +		case MACVLAN_MODE_BRIDGE:
> +			break;
> +		default:
> +			return -EINVAL;

EINVAL is quite unspecific. In this case I think EOPNOTSUPP would
be fine and provide more information.

> +		}
> +	}
>  	return 0;
>  }
> @@ -664,6 +670,13 @@ static int macvlan_newlink(struct net *src_net, struct net_device *dev,
>  	vlan->dev      = dev;
>  	vlan->port     = port;
>  
> +	vlan->mode     = MACVLAN_MODE_VEPA;
> +	if (data && data[IFLA_MACVLAN_MODE]) {
> +		u32 mode = nla_get_u32(data[IFLA_MACVLAN_MODE]);
> +
> +		vlan->mode     = mode;

This looks a bit strange, like cut-and-paste without reformatting :)
I'd suggest to simply use "vlan->mode = nla_get_u32(...)".

> +	}
> +
>  	err = register_netdevice(dev);
>  	if (err < 0)
>  		return err;
> @@ -685,6 +698,39 @@ static void macvlan_dellink(struct net_device *dev, struct list_head *head)
>  		macvlan_port_destroy(port->dev);
>  }
>  
> +static int macvlan_changelink(struct net_device *dev,
> +		struct nlattr *tb[], struct nlattr *data[])
> +{
> +	struct macvlan_dev *vlan = netdev_priv(dev);
> +	if (data && data[IFLA_MACVLAN_MODE]) {
> +		u32 mode = nla_get_u32(data[IFLA_MACVLAN_MODE]);
> +		vlan->mode     = mode;

Same here.

> +	}
> +
> +	return 0;
> +}
--
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