#ifdef CONFIG_SYSCTL
-static void devinet_copy_dflt_conf(int i)
+static void devinet_copy_dflt_conf(struct net *net, int i)
{
struct net_device *dev;
read_lock(&dev_base_lock);
- for_each_netdev(&init_net, dev) {
+ for_each_netdev(net, dev) {
struct in_device *in_dev;
rcu_read_lock();
in_dev = __in_dev_get_rcu(dev);
read_unlock(&dev_base_lock);
}
-static void inet_forward_change(void)
+static void inet_forward_change(struct net *net)
{
struct net_device *dev;
int on = IPV4_DEVCONF_ALL(FORWARDING);
IPV4_DEVCONF_DFLT(FORWARDING) = on;
read_lock(&dev_base_lock);
- for_each_netdev(&init_net, dev) {
+ for_each_netdev(net, dev) {
struct in_device *in_dev;
rcu_read_lock();
in_dev = __in_dev_get_rcu(dev);
if (write) {
struct ipv4_devconf *cnf = ctl->extra1;
+ struct net *net = ctl->extra2;
int i = (int *)ctl->data - cnf->data;
set_bit(i, cnf->state);
if (cnf == &ipv4_devconf_dflt)
- devinet_copy_dflt_conf(i);
+ devinet_copy_dflt_conf(net, i);
}
return ret;
void __user *newval, size_t newlen)
{
struct ipv4_devconf *cnf;
+ struct net *net;
int *valp = table->data;
int new;
int i;
*valp = new;
cnf = table->extra1;
+ net = table->extra2;
i = (int *)table->data - cnf->data;
set_bit(i, cnf->state);
if (cnf == &ipv4_devconf_dflt)
- devinet_copy_dflt_conf(i);
+ devinet_copy_dflt_conf(net, i);
return 1;
}
int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
if (write && *valp != val) {
+ struct net *net = ctl->extra2;
+
if (valp == &IPV4_DEVCONF_ALL(FORWARDING))
- inet_forward_change();
+ inet_forward_change(net);
else if (valp != &IPV4_DEVCONF_DFLT(FORWARDING))
rt_cache_flush(0);
}
for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) {
t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf;
t->devinet_vars[i].extra1 = p;
+ t->devinet_vars[i].extra2 = net;
}
/*
{
neigh_sysctl_register(idev->dev, idev->arp_parms, NET_IPV4,
NET_IPV4_NEIGH, "ipv4", NULL, NULL);
- __devinet_sysctl_register(idev->dev->name, idev->dev->ifindex,
- &idev->cnf);
+ __devinet_sysctl_register(idev->dev->nd_net, idev->dev->name,
+ idev->dev->ifindex, &idev->cnf);
}
static void devinet_sysctl_unregister(struct in_device *idev)
.proc_handler = devinet_sysctl_forward,
.strategy = devinet_conf_sysctl,
.extra1 = &ipv4_devconf,
+ .extra2 = &init_net,
},
{ },
};
rtnl_register(PF_INET, RTM_DELADDR, inet_rtm_deladdr, NULL);
rtnl_register(PF_INET, RTM_GETADDR, NULL, inet_dump_ifaddr);
#ifdef CONFIG_SYSCTL
- __devinet_sysctl_register("all", NET_PROTO_CONF_ALL,
+ __devinet_sysctl_register(&init_net, "all", NET_PROTO_CONF_ALL,
&ipv4_devconf);
- __devinet_sysctl_register("default", NET_PROTO_CONF_DEFAULT,
+ __devinet_sysctl_register(&init_net, "default", NET_PROTO_CONF_DEFAULT,
&ipv4_devconf_dflt);
register_sysctl_paths(net_ipv4_path, ctl_forward_entry);
#endif