]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - net/ipv4/ip_output.c
net: Do delayed neigh confirmation.
[mirror_ubuntu-zesty-kernel.git] / net / ipv4 / ip_output.c
index 2630900e480aec1a09922c60e807cd0de46385d3..cc52679790b2a6608c08ddbac0e93b34f149592e 100644 (file)
@@ -170,6 +170,7 @@ static inline int ip_finish_output2(struct sk_buff *skb)
        struct net_device *dev = dst->dev;
        unsigned int hh_len = LL_RESERVED_SPACE(dev);
        struct neighbour *neigh;
+       u32 nexthop;
 
        if (rt->rt_type == RTN_MULTICAST) {
                IP_UPD_PO_STATS(dev_net(dev), IPSTATS_MIB_OUTMCAST, skb->len);
@@ -191,15 +192,18 @@ static inline int ip_finish_output2(struct sk_buff *skb)
                skb = skb2;
        }
 
-       rcu_read_lock();
-       neigh = dst_get_neighbour_noref(dst);
+       rcu_read_lock_bh();
+       nexthop = rt->rt_gateway ? rt->rt_gateway : ip_hdr(skb)->daddr;
+       neigh = __ipv4_neigh_lookup_noref(dev, nexthop);
+       if (unlikely(!neigh))
+               neigh = __neigh_create(&arp_tbl, &nexthop, dev, false);
        if (neigh) {
-               int res = neigh_output(neigh, skb);
+               int res = dst_neigh_output(dst, neigh, skb);
 
-               rcu_read_unlock();
+               rcu_read_unlock_bh();
                return res;
        }
-       rcu_read_unlock();
+       rcu_read_unlock_bh();
 
        net_dbg_ratelimited("%s: No header cache and no neighbour!\n",
                            __func__);