aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>2013-01-17 07:54:00 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-17 18:38:19 -0500
commit6fd6ce2056de27090f4723138e0ce0a816f4ba0d (patch)
treeaaa108891bb6eefbb24b1af220cda2fab463c381 /net/ipv6
parent707be1ff3d9309f810e33790e6ae3f15e7ac967e (diff)
ipv6: Do not depend on rt->n in ip6_finish_output2().
If neigh is not found, create new one. Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/ip6_output.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 7c00edb343a0..b0895f5d5fc6 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -88,7 +88,8 @@ static int ip6_finish_output2(struct sk_buff *skb)
88 struct dst_entry *dst = skb_dst(skb); 88 struct dst_entry *dst = skb_dst(skb);
89 struct net_device *dev = dst->dev; 89 struct net_device *dev = dst->dev;
90 struct neighbour *neigh; 90 struct neighbour *neigh;
91 struct rt6_info *rt; 91 struct in6_addr *nexthop;
92 int ret;
92 93
93 skb->protocol = htons(ETH_P_IPV6); 94 skb->protocol = htons(ETH_P_IPV6);
94 skb->dev = dev; 95 skb->dev = dev;
@@ -123,10 +124,17 @@ static int ip6_finish_output2(struct sk_buff *skb)
123 skb->len); 124 skb->len);
124 } 125 }
125 126
126 rt = (struct rt6_info *) dst; 127 rcu_read_lock_bh();
127 neigh = rt->n; 128 nexthop = rt6_nexthop((struct rt6_info *)dst, &ipv6_hdr(skb)->daddr);
128 if (neigh) 129 neigh = __ipv6_neigh_lookup_noref(dst->dev, nexthop);
129 return dst_neigh_output(dst, neigh, skb); 130 if (unlikely(!neigh))
131 neigh = __neigh_create(&nd_tbl, nexthop, dst->dev, false);
132 if (!IS_ERR(neigh)) {
133 ret = dst_neigh_output(dst, neigh, skb);
134 rcu_read_unlock_bh();
135 return ret;
136 }
137 rcu_read_unlock_bh();
130 138
131 IP6_INC_STATS_BH(dev_net(dst->dev), 139 IP6_INC_STATS_BH(dev_net(dst->dev),
132 ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); 140 ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES);