Commit 6fd6ce20 authored by YOSHIFUJI Hideaki / 吉藤英明's avatar YOSHIFUJI Hideaki / 吉藤英明 Committed by David S. Miller
Browse files

ipv6: Do not depend on rt->n in ip6_finish_output2().

If neigh is not found, create new one.
Signed-off-by: default avatarYOSHIFUJI Hideaki <>
Signed-off-by: default avatarDavid S. Miller <>
parent 707be1ff
......@@ -88,7 +88,8 @@ static int ip6_finish_output2(struct sk_buff *skb)
struct dst_entry *dst = skb_dst(skb);
struct net_device *dev = dst->dev;
struct neighbour *neigh;
struct rt6_info *rt;
struct in6_addr *nexthop;
int ret;
skb->protocol = htons(ETH_P_IPV6);
skb->dev = dev;
......@@ -123,10 +124,17 @@ static int ip6_finish_output2(struct sk_buff *skb)
rt = (struct rt6_info *) dst;
neigh = rt->n;
if (neigh)
return dst_neigh_output(dst, neigh, skb);
nexthop = rt6_nexthop((struct rt6_info *)dst, &ipv6_hdr(skb)->daddr);
neigh = __ipv6_neigh_lookup_noref(dst->dev, nexthop);
if (unlikely(!neigh))
neigh = __neigh_create(&nd_tbl, nexthop, dst->dev, false);
if (!IS_ERR(neigh)) {
ret = dst_neigh_output(dst, neigh, skb);
return ret;
ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment