Commit 4991969a authored by David S. Miller's avatar David S. Miller

ipv6: Remove neigh argument from ndisc_send_redirect()

Instead, compute it as-needed inside of that function using
dst_neigh_lookup().
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5339ab8b
...@@ -133,7 +133,6 @@ extern void ndisc_send_rs(struct net_device *dev, ...@@ -133,7 +133,6 @@ extern void ndisc_send_rs(struct net_device *dev,
const struct in6_addr *daddr); const struct in6_addr *daddr);
extern void ndisc_send_redirect(struct sk_buff *skb, extern void ndisc_send_redirect(struct sk_buff *skb,
struct neighbour *neigh,
const struct in6_addr *target); const struct in6_addr *target);
extern int ndisc_mc_map(const struct in6_addr *addr, char *buf, extern int ndisc_mc_map(const struct in6_addr *addr, char *buf,
......
...@@ -486,7 +486,7 @@ int ip6_forward(struct sk_buff *skb) ...@@ -486,7 +486,7 @@ int ip6_forward(struct sk_buff *skb)
and by source (inside ndisc_send_redirect) and by source (inside ndisc_send_redirect)
*/ */
if (inet_peer_xrlim_allow(rt->rt6i_peer, 1*HZ)) if (inet_peer_xrlim_allow(rt->rt6i_peer, 1*HZ))
ndisc_send_redirect(skb, n, target); ndisc_send_redirect(skb, target);
} else { } else {
int addrtype = ipv6_addr_type(&hdr->saddr); int addrtype = ipv6_addr_type(&hdr->saddr);
......
...@@ -1512,8 +1512,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb) ...@@ -1512,8 +1512,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
} }
} }
void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
const struct in6_addr *target)
{ {
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
struct net *net = dev_net(dev); struct net *net = dev_net(dev);
...@@ -1571,6 +1570,13 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, ...@@ -1571,6 +1570,13 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
goto release; goto release;
if (dev->addr_len) { if (dev->addr_len) {
struct neighbour *neigh = dst_neigh_lookup(skb_dst(skb), target);
if (!neigh) {
ND_PRINTK2(KERN_WARNING
"ICMPv6 Redirect: no neigh for target address\n");
goto release;
}
read_lock_bh(&neigh->lock); read_lock_bh(&neigh->lock);
if (neigh->nud_state & NUD_VALID) { if (neigh->nud_state & NUD_VALID) {
memcpy(ha_buf, neigh->ha, dev->addr_len); memcpy(ha_buf, neigh->ha, dev->addr_len);
...@@ -1579,6 +1585,8 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, ...@@ -1579,6 +1585,8 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
len += ndisc_opt_addr_space(dev); len += ndisc_opt_addr_space(dev);
} else } else
read_unlock_bh(&neigh->lock); read_unlock_bh(&neigh->lock);
neigh_release(neigh);
} }
rd_len = min_t(unsigned int, rd_len = min_t(unsigned int,
......
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