[ARP]: Move inet_addr_type call after simple error checks in arp_contructor.
authorDenis V. Lunev <den@openvz.org>
Tue, 15 Jan 2008 06:56:01 +0000 (22:56 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:02:08 +0000 (15:02 -0800)
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>
net/ipv4/arp.c

index 3f0730ec0a2155db0344ed4ebbad0e8a387bc965..d12f31b0c107079760ef1e87056c1ad9844082ba 100644 (file)
@@ -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);