diff options
-rw-r--r-- | include/net/neighbour.h | 12 | ||||
-rw-r--r-- | net/core/neighbour.c | 12 |
2 files changed, 5 insertions, 19 deletions
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 365b5e260239..d8d790e56d3d 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
@@ -220,11 +220,7 @@ extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *p | |||
220 | static inline | 220 | static inline |
221 | struct net *neigh_parms_net(const struct neigh_parms *parms) | 221 | struct net *neigh_parms_net(const struct neigh_parms *parms) |
222 | { | 222 | { |
223 | #ifdef CONFIG_NET_NS | 223 | return read_pnet(&parms->net); |
224 | return parms->net; | ||
225 | #else | ||
226 | return &init_net; | ||
227 | #endif | ||
228 | } | 224 | } |
229 | 225 | ||
230 | extern unsigned long neigh_rand_reach_time(unsigned long base); | 226 | extern unsigned long neigh_rand_reach_time(unsigned long base); |
@@ -241,11 +237,7 @@ extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void | |||
241 | static inline | 237 | static inline |
242 | struct net *pneigh_net(const struct pneigh_entry *pneigh) | 238 | struct net *pneigh_net(const struct pneigh_entry *pneigh) |
243 | { | 239 | { |
244 | #ifdef CONFIG_NET_NS | 240 | return read_pnet(&pneigh->net); |
245 | return pneigh->net; | ||
246 | #else | ||
247 | return &init_net; | ||
248 | #endif | ||
249 | } | 241 | } |
250 | 242 | ||
251 | extern void neigh_app_ns(struct neighbour *n); | 243 | extern void neigh_app_ns(struct neighbour *n); |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 500c2430007c..cca6a55909eb 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -531,9 +531,7 @@ struct pneigh_entry * pneigh_lookup(struct neigh_table *tbl, | |||
531 | if (!n) | 531 | if (!n) |
532 | goto out; | 532 | goto out; |
533 | 533 | ||
534 | #ifdef CONFIG_NET_NS | 534 | write_pnet(&n->net, hold_net(net)); |
535 | n->net = hold_net(net); | ||
536 | #endif | ||
537 | memcpy(n->key, pkey, key_len); | 535 | memcpy(n->key, pkey, key_len); |
538 | n->dev = dev; | 536 | n->dev = dev; |
539 | if (dev) | 537 | if (dev) |
@@ -1350,9 +1348,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev, | |||
1350 | 1348 | ||
1351 | dev_hold(dev); | 1349 | dev_hold(dev); |
1352 | p->dev = dev; | 1350 | p->dev = dev; |
1353 | #ifdef CONFIG_NET_NS | 1351 | write_pnet(&p->net, hold_net(net)); |
1354 | p->net = hold_net(net); | ||
1355 | #endif | ||
1356 | p->sysctl_table = NULL; | 1352 | p->sysctl_table = NULL; |
1357 | write_lock_bh(&tbl->lock); | 1353 | write_lock_bh(&tbl->lock); |
1358 | p->next = tbl->parms.next; | 1354 | p->next = tbl->parms.next; |
@@ -1407,9 +1403,7 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl) | |||
1407 | unsigned long now = jiffies; | 1403 | unsigned long now = jiffies; |
1408 | unsigned long phsize; | 1404 | unsigned long phsize; |
1409 | 1405 | ||
1410 | #ifdef CONFIG_NET_NS | 1406 | write_pnet(&tbl->parms.net, &init_net); |
1411 | tbl->parms.net = &init_net; | ||
1412 | #endif | ||
1413 | atomic_set(&tbl->parms.refcnt, 1); | 1407 | atomic_set(&tbl->parms.refcnt, 1); |
1414 | tbl->parms.reachable_time = | 1408 | tbl->parms.reachable_time = |
1415 | neigh_rand_reach_time(tbl->parms.base_reachable_time); | 1409 | neigh_rand_reach_time(tbl->parms.base_reachable_time); |