diff options
author | Denis V. Lunev <den@openvz.org> | 2008-01-15 01:59:59 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:02:10 -0500 |
commit | 486b51d3706c5493b6c50992eaaafc44e628a7ed (patch) | |
tree | a673ae4ee9f03bfad9649d02d9ef27151c241f2c /net/core | |
parent | 72132c1b6c7a7605cdfde86a9f58b6ca2b2195a6 (diff) |
[ARP]: Remove overkill checks from neigh_param_alloc.
Valid network device is always passed into neigh_param_alloc, so
remove extra checking for dev == NULL. Additionally, cleanup bogus
netns assignment.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/neighbour.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 19c0dd12fd58..62d47841c67d 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -1291,10 +1291,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev, | |||
1291 | struct neigh_parms *p, *ref; | 1291 | struct neigh_parms *p, *ref; |
1292 | struct net *net; | 1292 | struct net *net; |
1293 | 1293 | ||
1294 | net = &init_net; | 1294 | net = dev->nd_net; |
1295 | if (dev) | ||
1296 | net = dev->nd_net; | ||
1297 | |||
1298 | ref = lookup_neigh_params(tbl, net, 0); | 1295 | ref = lookup_neigh_params(tbl, net, 0); |
1299 | if (!ref) | 1296 | if (!ref) |
1300 | return NULL; | 1297 | return NULL; |
@@ -1306,15 +1303,14 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev, | |||
1306 | INIT_RCU_HEAD(&p->rcu_head); | 1303 | INIT_RCU_HEAD(&p->rcu_head); |
1307 | p->reachable_time = | 1304 | p->reachable_time = |
1308 | neigh_rand_reach_time(p->base_reachable_time); | 1305 | neigh_rand_reach_time(p->base_reachable_time); |
1309 | if (dev) { | ||
1310 | if (dev->neigh_setup && dev->neigh_setup(dev, p)) { | ||
1311 | kfree(p); | ||
1312 | return NULL; | ||
1313 | } | ||
1314 | 1306 | ||
1315 | dev_hold(dev); | 1307 | if (dev->neigh_setup && dev->neigh_setup(dev, p)) { |
1316 | p->dev = dev; | 1308 | kfree(p); |
1309 | return NULL; | ||
1317 | } | 1310 | } |
1311 | |||
1312 | dev_hold(dev); | ||
1313 | p->dev = dev; | ||
1318 | p->net = hold_net(net); | 1314 | p->net = hold_net(net); |
1319 | p->sysctl_table = NULL; | 1315 | p->sysctl_table = NULL; |
1320 | write_lock_bh(&tbl->lock); | 1316 | write_lock_bh(&tbl->lock); |