Commit b43faac6 authored by David S. Miller's avatar David S. Miller

ipv6: If neigh lookup fails during icmp6 dst allocation, propagate error.

Don't just succeed with a route that has a NULL neighbour attached.
This follows the behavior of addrconf_dst_alloc().

Allowing this kind of route to end up with a NULL neigh attached will
result in packet drops on output until the route is somehow
invalidated, since nothing will meanwhile try to lookup the neigh
again.

A statistic is bumped for the case where we see a neigh-less route on
output, but the resulting packet drop is otherwise silent in nature,
and frankly it's a hard error for this to happen and ipv6 should do
what ipv4 does which is say something in the kernel logs.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5c3ddec7
...@@ -1089,8 +1089,10 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev, ...@@ -1089,8 +1089,10 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
neigh_hold(neigh); neigh_hold(neigh);
else { else {
neigh = __neigh_lookup_errno(&nd_tbl, &fl6->daddr, dev); neigh = __neigh_lookup_errno(&nd_tbl, &fl6->daddr, dev);
if (IS_ERR(neigh)) if (IS_ERR(neigh)) {
neigh = NULL; dst_free(&rt->dst);
return ERR_CAST(neigh);
}
} }
rt->dst.flags |= DST_HOST; rt->dst.flags |= DST_HOST;
......
Markdown is supported
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