summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-01-14 22:56:01 -0800
committerDavid S. Miller <davem@davemloft.net>2008-01-28 15:02:08 -0800
commita79878f00dad97d03a3e62a48b06227d55ae5fe4 (patch)
tree6d723e833f6e284da09580d8981d26a1ec32f587
parenta308da1627d711fd0c7542bfe892abc78d65d215 (diff)
downloadlinux-3.10-a79878f00dad97d03a3e62a48b06227d55ae5fe4.tar.gz
linux-3.10-a79878f00dad97d03a3e62a48b06227d55ae5fe4.tar.bz2
linux-3.10-a79878f00dad97d03a3e62a48b06227d55ae5fe4.zip
[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>
-rw-r--r--net/ipv4/arp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 3f0730ec0a2..d12f31b0c10 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -235,8 +235,6 @@ static int arp_constructor(struct neighbour *neigh)
struct in_device *in_dev;
struct neigh_parms *parms;
- neigh->type = inet_addr_type(&init_net, addr);
-
rcu_read_lock();
in_dev = __in_dev_get_rcu(dev);
if (in_dev == NULL) {
@@ -244,6 +242,8 @@ static int arp_constructor(struct neighbour *neigh)
return -EINVAL;
}
+ neigh->type = inet_addr_type(&init_net, addr);
+
parms = in_dev->arp_parms;
__neigh_parms_put(neigh->parms);
neigh->parms = neigh_parms_clone(parms);