diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-01-10 20:42:13 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:01:39 -0500 |
commit | bff16c2f991386883dc81ec969ba15eb270a0c7f (patch) | |
tree | b2df2ffac7ee1bfb995a2d0e48c3c661b74d61c8 /net/ipv6/addrconf.c | |
parent | 9589731220edfebeb6a05c52d0838a99dee20893 (diff) |
[NETNS]: Make the ctl-tables per-namespace
This includes passing the net to __addrconf_sysctl_register
and saving this on the ctl_table->extra2 to be used in
handlers (those, needing it).
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r-- | net/ipv6/addrconf.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 18d43349013e..bde50c686722 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -456,13 +456,13 @@ static void dev_forward_change(struct inet6_dev *idev) | |||
456 | } | 456 | } |
457 | 457 | ||
458 | 458 | ||
459 | static void addrconf_forward_change(void) | 459 | static void addrconf_forward_change(struct net *net) |
460 | { | 460 | { |
461 | struct net_device *dev; | 461 | struct net_device *dev; |
462 | struct inet6_dev *idev; | 462 | struct inet6_dev *idev; |
463 | 463 | ||
464 | read_lock(&dev_base_lock); | 464 | read_lock(&dev_base_lock); |
465 | for_each_netdev(&init_net, dev) { | 465 | for_each_netdev(net, dev) { |
466 | rcu_read_lock(); | 466 | rcu_read_lock(); |
467 | idev = __in6_dev_get(dev); | 467 | idev = __in6_dev_get(dev); |
468 | if (idev) { | 468 | if (idev) { |
@@ -478,12 +478,15 @@ static void addrconf_forward_change(void) | |||
478 | 478 | ||
479 | static void addrconf_fixup_forwarding(struct ctl_table *table, int *p, int old) | 479 | static void addrconf_fixup_forwarding(struct ctl_table *table, int *p, int old) |
480 | { | 480 | { |
481 | struct net *net; | ||
482 | |||
483 | net = (struct net *)table->extra2; | ||
481 | if (p == &ipv6_devconf_dflt.forwarding) | 484 | if (p == &ipv6_devconf_dflt.forwarding) |
482 | return; | 485 | return; |
483 | 486 | ||
484 | if (p == &ipv6_devconf.forwarding) { | 487 | if (p == &ipv6_devconf.forwarding) { |
485 | ipv6_devconf_dflt.forwarding = ipv6_devconf.forwarding; | 488 | ipv6_devconf_dflt.forwarding = ipv6_devconf.forwarding; |
486 | addrconf_forward_change(); | 489 | addrconf_forward_change(net); |
487 | } else if ((!*p) ^ (!old)) | 490 | } else if ((!*p) ^ (!old)) |
488 | dev_forward_change((struct inet6_dev *)table->extra1); | 491 | dev_forward_change((struct inet6_dev *)table->extra1); |
489 | 492 | ||
@@ -4044,8 +4047,8 @@ static struct addrconf_sysctl_table | |||
4044 | }, | 4047 | }, |
4045 | }; | 4048 | }; |
4046 | 4049 | ||
4047 | static int __addrconf_sysctl_register(char *dev_name, int ctl_name, | 4050 | static int __addrconf_sysctl_register(struct net *net, char *dev_name, |
4048 | struct inet6_dev *idev, struct ipv6_devconf *p) | 4051 | int ctl_name, struct inet6_dev *idev, struct ipv6_devconf *p) |
4049 | { | 4052 | { |
4050 | int i; | 4053 | int i; |
4051 | struct addrconf_sysctl_table *t; | 4054 | struct addrconf_sysctl_table *t; |
@@ -4068,6 +4071,7 @@ static int __addrconf_sysctl_register(char *dev_name, int ctl_name, | |||
4068 | for (i=0; t->addrconf_vars[i].data; i++) { | 4071 | for (i=0; t->addrconf_vars[i].data; i++) { |
4069 | t->addrconf_vars[i].data += (char*)p - (char*)&ipv6_devconf; | 4072 | t->addrconf_vars[i].data += (char*)p - (char*)&ipv6_devconf; |
4070 | t->addrconf_vars[i].extra1 = idev; /* embedded; no ref */ | 4073 | t->addrconf_vars[i].extra1 = idev; /* embedded; no ref */ |
4074 | t->addrconf_vars[i].extra2 = net; | ||
4071 | } | 4075 | } |
4072 | 4076 | ||
4073 | /* | 4077 | /* |
@@ -4082,7 +4086,7 @@ static int __addrconf_sysctl_register(char *dev_name, int ctl_name, | |||
4082 | addrconf_ctl_path[ADDRCONF_CTL_PATH_DEV].procname = t->dev_name; | 4086 | addrconf_ctl_path[ADDRCONF_CTL_PATH_DEV].procname = t->dev_name; |
4083 | addrconf_ctl_path[ADDRCONF_CTL_PATH_DEV].ctl_name = ctl_name; | 4087 | addrconf_ctl_path[ADDRCONF_CTL_PATH_DEV].ctl_name = ctl_name; |
4084 | 4088 | ||
4085 | t->sysctl_header = register_sysctl_paths(addrconf_ctl_path, | 4089 | t->sysctl_header = register_net_sysctl_table(net, addrconf_ctl_path, |
4086 | t->addrconf_vars); | 4090 | t->addrconf_vars); |
4087 | if (t->sysctl_header == NULL) | 4091 | if (t->sysctl_header == NULL) |
4088 | goto free_procname; | 4092 | goto free_procname; |
@@ -4118,8 +4122,8 @@ static void addrconf_sysctl_register(struct inet6_dev *idev) | |||
4118 | NET_IPV6_NEIGH, "ipv6", | 4122 | NET_IPV6_NEIGH, "ipv6", |
4119 | &ndisc_ifinfo_sysctl_change, | 4123 | &ndisc_ifinfo_sysctl_change, |
4120 | NULL); | 4124 | NULL); |
4121 | __addrconf_sysctl_register(idev->dev->name, idev->dev->ifindex, | 4125 | __addrconf_sysctl_register(idev->dev->nd_net, idev->dev->name, |
4122 | idev, &idev->cnf); | 4126 | idev->dev->ifindex, idev, &idev->cnf); |
4123 | } | 4127 | } |
4124 | 4128 | ||
4125 | static void addrconf_sysctl_unregister(struct inet6_dev *idev) | 4129 | static void addrconf_sysctl_unregister(struct inet6_dev *idev) |
@@ -4215,9 +4219,9 @@ int __init addrconf_init(void) | |||
4215 | ipv6_addr_label_rtnl_register(); | 4219 | ipv6_addr_label_rtnl_register(); |
4216 | 4220 | ||
4217 | #ifdef CONFIG_SYSCTL | 4221 | #ifdef CONFIG_SYSCTL |
4218 | __addrconf_sysctl_register("all", NET_PROTO_CONF_ALL, | 4222 | __addrconf_sysctl_register(&init_net, "all", NET_PROTO_CONF_ALL, |
4219 | NULL, &ipv6_devconf); | 4223 | NULL, &ipv6_devconf); |
4220 | __addrconf_sysctl_register("default", NET_PROTO_CONF_DEFAULT, | 4224 | __addrconf_sysctl_register(&init_net, "default", NET_PROTO_CONF_DEFAULT, |
4221 | NULL, &ipv6_devconf_dflt); | 4225 | NULL, &ipv6_devconf_dflt); |
4222 | #endif | 4226 | #endif |
4223 | 4227 | ||