Commit 1a55439a authored by Hideaki Yoshifuji's avatar Hideaki Yoshifuji Committed by David S. Miller

[IPV6]: Ensure to learn link-layer address from RA.

Signed-off-by: default avatarHideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5d45d09c
...@@ -989,7 +989,7 @@ static void ndisc_recv_rs(struct sk_buff *skb) ...@@ -989,7 +989,7 @@ static void ndisc_recv_rs(struct sk_buff *skb)
static void ndisc_router_discovery(struct sk_buff *skb) static void ndisc_router_discovery(struct sk_buff *skb)
{ {
struct ra_msg *ra_msg = (struct ra_msg *) skb->h.raw; struct ra_msg *ra_msg = (struct ra_msg *) skb->h.raw;
struct neighbour *neigh; struct neighbour *neigh = NULL;
struct inet6_dev *in6_dev; struct inet6_dev *in6_dev;
struct rt6_info *rt; struct rt6_info *rt;
int lifetime; int lifetime;
...@@ -1057,7 +1057,11 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1057,7 +1057,11 @@ static void ndisc_router_discovery(struct sk_buff *skb)
rt = rt6_get_dflt_router(&skb->nh.ipv6h->saddr, skb->dev); rt = rt6_get_dflt_router(&skb->nh.ipv6h->saddr, skb->dev);
if (rt)
neigh = rt->rt6i_nexthop;
if (rt && lifetime == 0) { if (rt && lifetime == 0) {
neigh_clone(neigh);
ip6_del_rt(rt, NULL, NULL); ip6_del_rt(rt, NULL, NULL);
rt = NULL; rt = NULL;
} }
...@@ -1130,7 +1134,10 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1130,7 +1134,10 @@ static void ndisc_router_discovery(struct sk_buff *skb)
* Process options. * Process options.
*/ */
if (rt && (neigh = rt->rt6i_nexthop) != NULL) { if (!neigh)
neigh = __neigh_lookup(&nd_tbl, &skb->nh.ipv6h->saddr,
skb->dev, 1);
if (neigh) {
u8 *lladdr = NULL; u8 *lladdr = NULL;
int lladdrlen; int lladdrlen;
if (ndopts.nd_opts_src_lladdr) { if (ndopts.nd_opts_src_lladdr) {
...@@ -1185,6 +1192,8 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1185,6 +1192,8 @@ static void ndisc_router_discovery(struct sk_buff *skb)
out: out:
if (rt) if (rt)
dst_release(&rt->u.dst); dst_release(&rt->u.dst);
else if (neigh)
neigh_release(neigh);
in6_dev_put(in6_dev); in6_dev_put(in6_dev);
} }
......
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