Subject: Re: [PATCH net-next] ipv4: properly apply change to ignore_routes_on_linkdown to all interfaces

From: David Ahern <[email-masked]>
Date: Wed, 2 Mar 2016 10:17:19 -0800

On 3/2/16 8:43 AM, Andy Gospodarek wrote:
>
> +/* called with RTNL locked */
> +static void inet_ignore_routes_change(struct net *net)
> +{
> +	struct net_device *dev;
> +	int on = IPV4_DEVCONF_ALL(net, IGNORE_ROUTES_WITH_LINKDOWN);
> +
> +	IPV4_DEVCONF_DFLT(net, IGNORE_ROUTES_WITH_LINKDOWN) = on;
> +	inet_netconf_notify_devconf(net, NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN,
> +				    NETCONFA_IFINDEX_ALL,
> +				    net->ipv4.devconf_all);
> +	inet_netconf_notify_devconf(net, NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN,
> +				    NETCONFA_IFINDEX_DEFAULT,
> +				    net->ipv4.devconf_dflt);
> +
> +	for_each_netdev(net, dev) {
> +		struct in_device *in_dev;
> +
> +		rcu_read_lock();
> +		in_dev = __in_dev_get_rcu(dev);
> +		if (in_dev) {
> +			IN_DEV_CONF_SET(in_dev,
> +					IGNORE_ROUTES_WITH_LINKDOWN, on);
> +			inet_netconf_notify_devconf(net,
> +						    NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN,
> +						    dev->ifindex, &in_dev->cnf);
> +		}
> +		rcu_read_unlock();
> +	}
> +}
> +

This seems wrong -- changing the 'all' and 'default' settings for a 
sysctl should not require walking the interface list.