diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-12-16 16:32:16 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:58:11 -0500 |
commit | 9355bbd685bf705a7f7bd6470b92ca0562c7a661 (patch) | |
tree | 58bb5c2d890011781100405628dc8a5ad7b2910d /net | |
parent | 752d14dc6aa9d0fc8f3b25e5052596fb549e5157 (diff) |
[IPV4]: Switch users of ipv4_devconf_dflt to use the pernet one
They are all collected in the net/ipv4/devinet.c file and
mostly use the IPV4_DEVCONF_DFLT macro.
So I add the net parameter to it and patch users accordingly.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/devinet.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index a2d48173828a..4c01c55c381d 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -83,7 +83,8 @@ static struct ipv4_devconf ipv4_devconf_dflt = { | |||
83 | }, | 83 | }, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | #define IPV4_DEVCONF_DFLT(attr) IPV4_DEVCONF(ipv4_devconf_dflt, attr) | 86 | #define IPV4_DEVCONF_DFLT(net, attr) \ |
87 | IPV4_DEVCONF((*net->ipv4.devconf_dflt), attr) | ||
87 | 88 | ||
88 | static const struct nla_policy ifa_ipv4_policy[IFA_MAX+1] = { | 89 | static const struct nla_policy ifa_ipv4_policy[IFA_MAX+1] = { |
89 | [IFA_LOCAL] = { .type = NLA_U32 }, | 90 | [IFA_LOCAL] = { .type = NLA_U32 }, |
@@ -164,7 +165,8 @@ static struct in_device *inetdev_init(struct net_device *dev) | |||
164 | if (!in_dev) | 165 | if (!in_dev) |
165 | goto out; | 166 | goto out; |
166 | INIT_RCU_HEAD(&in_dev->rcu_head); | 167 | INIT_RCU_HEAD(&in_dev->rcu_head); |
167 | memcpy(&in_dev->cnf, &ipv4_devconf_dflt, sizeof(in_dev->cnf)); | 168 | memcpy(&in_dev->cnf, dev->nd_net->ipv4.devconf_dflt, |
169 | sizeof(in_dev->cnf)); | ||
168 | in_dev->cnf.sysctl = NULL; | 170 | in_dev->cnf.sysctl = NULL; |
169 | in_dev->dev = dev; | 171 | in_dev->dev = dev; |
170 | if ((in_dev->arp_parms = neigh_parms_alloc(dev, &arp_tbl)) == NULL) | 172 | if ((in_dev->arp_parms = neigh_parms_alloc(dev, &arp_tbl)) == NULL) |
@@ -1247,7 +1249,7 @@ static void devinet_copy_dflt_conf(struct net *net, int i) | |||
1247 | rcu_read_lock(); | 1249 | rcu_read_lock(); |
1248 | in_dev = __in_dev_get_rcu(dev); | 1250 | in_dev = __in_dev_get_rcu(dev); |
1249 | if (in_dev && !test_bit(i, in_dev->cnf.state)) | 1251 | if (in_dev && !test_bit(i, in_dev->cnf.state)) |
1250 | in_dev->cnf.data[i] = ipv4_devconf_dflt.data[i]; | 1252 | in_dev->cnf.data[i] = net->ipv4.devconf_dflt->data[i]; |
1251 | rcu_read_unlock(); | 1253 | rcu_read_unlock(); |
1252 | } | 1254 | } |
1253 | read_unlock(&dev_base_lock); | 1255 | read_unlock(&dev_base_lock); |
@@ -1259,7 +1261,7 @@ static void inet_forward_change(struct net *net) | |||
1259 | int on = IPV4_DEVCONF_ALL(FORWARDING); | 1261 | int on = IPV4_DEVCONF_ALL(FORWARDING); |
1260 | 1262 | ||
1261 | IPV4_DEVCONF_ALL(ACCEPT_REDIRECTS) = !on; | 1263 | IPV4_DEVCONF_ALL(ACCEPT_REDIRECTS) = !on; |
1262 | IPV4_DEVCONF_DFLT(FORWARDING) = on; | 1264 | IPV4_DEVCONF_DFLT(net, FORWARDING) = on; |
1263 | 1265 | ||
1264 | read_lock(&dev_base_lock); | 1266 | read_lock(&dev_base_lock); |
1265 | for_each_netdev(net, dev) { | 1267 | for_each_netdev(net, dev) { |
@@ -1288,7 +1290,7 @@ static int devinet_conf_proc(ctl_table *ctl, int write, | |||
1288 | 1290 | ||
1289 | set_bit(i, cnf->state); | 1291 | set_bit(i, cnf->state); |
1290 | 1292 | ||
1291 | if (cnf == &ipv4_devconf_dflt) | 1293 | if (cnf == net->ipv4.devconf_dflt) |
1292 | devinet_copy_dflt_conf(net, i); | 1294 | devinet_copy_dflt_conf(net, i); |
1293 | } | 1295 | } |
1294 | 1296 | ||
@@ -1341,7 +1343,7 @@ static int devinet_conf_sysctl(ctl_table *table, int __user *name, int nlen, | |||
1341 | 1343 | ||
1342 | set_bit(i, cnf->state); | 1344 | set_bit(i, cnf->state); |
1343 | 1345 | ||
1344 | if (cnf == &ipv4_devconf_dflt) | 1346 | if (cnf == net->ipv4.devconf_dflt) |
1345 | devinet_copy_dflt_conf(net, i); | 1347 | devinet_copy_dflt_conf(net, i); |
1346 | 1348 | ||
1347 | return 1; | 1349 | return 1; |
@@ -1360,7 +1362,7 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write, | |||
1360 | 1362 | ||
1361 | if (valp == &IPV4_DEVCONF_ALL(FORWARDING)) | 1363 | if (valp == &IPV4_DEVCONF_ALL(FORWARDING)) |
1362 | inet_forward_change(net); | 1364 | inet_forward_change(net); |
1363 | else if (valp != &IPV4_DEVCONF_DFLT(FORWARDING)) | 1365 | else if (valp != &IPV4_DEVCONF_DFLT(net, FORWARDING)) |
1364 | rt_cache_flush(0); | 1366 | rt_cache_flush(0); |
1365 | } | 1367 | } |
1366 | 1368 | ||