mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-15 07:04:44 +00:00
[ARP]: Move inet_addr_type call after simple error checks in arp_contructor.
The neighbour entry will be destroyed in the case of error, so it is pointless to perform constly routing table lookup in this case. Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a308da1627
commit
a79878f00d
1 changed files with 2 additions and 2 deletions
|
@ -235,8 +235,6 @@ static int arp_constructor(struct neighbour *neigh)
|
||||||
struct in_device *in_dev;
|
struct in_device *in_dev;
|
||||||
struct neigh_parms *parms;
|
struct neigh_parms *parms;
|
||||||
|
|
||||||
neigh->type = inet_addr_type(&init_net, addr);
|
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
in_dev = __in_dev_get_rcu(dev);
|
in_dev = __in_dev_get_rcu(dev);
|
||||||
if (in_dev == NULL) {
|
if (in_dev == NULL) {
|
||||||
|
@ -244,6 +242,8 @@ static int arp_constructor(struct neighbour *neigh)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
neigh->type = inet_addr_type(&init_net, addr);
|
||||||
|
|
||||||
parms = in_dev->arp_parms;
|
parms = in_dev->arp_parms;
|
||||||
__neigh_parms_put(neigh->parms);
|
__neigh_parms_put(neigh->parms);
|
||||||
neigh->parms = neigh_parms_clone(parms);
|
neigh->parms = neigh_parms_clone(parms);
|
||||||
|
|
Loading…
Reference in a new issue