On Wed, Mar 02, 2016 at 10:17:19AM -0800, David Ahern wrote: > 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.
Not if you want to actually apply the config to all the interfaces. If you notice this borrows heavily from the sysctl to control ipv4 forwarding as it behaves in a manner that I would consider to be proper.