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] [day] [month] [year] [list]
Date:	Sat, 26 Sep 2015 15:24:22 +0200
From:	Nikolay Aleksandrov <nikolay@...ulusnetworks.com>
To:	David Ahern <dsa@...ulusnetworks.com>, netdev@...r.kernel.org
Subject: Re: [PATCH net-next 01/11] net: Introduce L3 Master device
 abstraction

<<<snip>>>
> + *	l3mdev_master_ifindex - get index of L3 master device
> + *	@dev: targeted interface
> + */
> +
> +int l3mdev_master_ifindex_rcu(struct net_device *dev)
> +{
> +	int ifindex = 0;
> +
> +	if (!dev)
> +		return 0;
> +
> +	if (netif_is_l3_master(dev)) {
> +		ifindex = dev->ifindex;
> +
^^
Extra empty line.

> +	} else if (dev->flags & IFF_SLAVE) {
> +		struct net_device *master;
> +
> +		master = netdev_master_upper_dev_get_rcu(dev);
> +		if (netif_is_l3_master(master))
^^
maybe check if master is non-null, otherwise this imposes a new
restriction on the ordering of iff_slave / master_upper setting,
also a very old driver that uses iff_slave/master doesn't set the
master_upper, but only the flag (eql).
Actually, is this bisectable ? I see netif_is_l3_master() being
introduced in the next patch, so I don't think you can compile
this one.

> +			ifindex = master->ifindex;
> +	}
> +
> +	return ifindex;
> +}
> +
> +/**
> + *	l3mdev_fib_table - get FIB table id associated with an L3
> + *                             master interface
> + *	@dev: targeted interface
> + */
> +
> +u32 l3mdev_fib_table_rcu(const struct net_device *dev)
> +{
> +	u32 tb_id = 0;
> +
> +	if (!dev)
> +		return 0;
> +
> +	if (netif_is_l3_master(dev)) {
> +		if (dev->l3mdev_ops->l3mdev_fib_table)
> +			tb_id = dev->l3mdev_ops->l3mdev_fib_table(dev);
> +
^^
Extra empty line.

> +	} else if (dev->flags & IFF_SLAVE) {
> +		/* TO-DO: remove the need for typecast.
> +		 * Users of netdev_master_upper_dev_get_rcu need non-const,
> +		 * but current inet_*type functions take a const
> +		 */
> +		struct net_device *_dev = (struct net_device *) dev;
> +		const struct net_device *master;
> +
> +		master = netdev_master_upper_dev_get_rcu(_dev);
> +		if (!master)
> +			return 0;
> +
> +		if (netif_is_l3_master(master) &&
> +		    master->l3mdev_ops->l3mdev_fib_table)
> +			tb_id = master->l3mdev_ops->l3mdev_fib_table(master);
> +	}
> +
> +	return tb_id;
> +}
> +
> +u32 l3mdev_fib_table_by_index(struct net *net, int ifindex)
> +{
> +	struct net_device *dev;
> +	u32 tb_id = 0;
> +
> +	if (!ifindex)
> +		return 0;
> +
> +	rcu_read_lock();
> +
> +	dev = dev_get_by_index_rcu(net, ifindex);
> +	if (dev)
> +		tb_id = l3mdev_fib_table_rcu(dev);
> +
> +	rcu_read_unlock();
> +
> +	return tb_id;
> +}
> 

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