netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [IPV6]: Ensure to learn link-layer address from RA.
@ 2005-01-18 13:37 YOSHIFUJI Hideaki / 吉藤英明
  2005-01-18 21:23 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2005-01-18 13:37 UTC (permalink / raw)
  To: davem; +Cc: netdev

Hello.

Here's a patch to ensure to learn link-layer address from RA.

Signed-off-by: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>

===== net/ipv6/ndisc.c 1.107 vs edited =====
--- 1.107/net/ipv6/ndisc.c	2004-12-28 15:19:28 +09:00
+++ edited/net/ipv6/ndisc.c	2005-01-18 22:24:04 +09:00
@@ -985,7 +985,7 @@
 static void ndisc_router_discovery(struct sk_buff *skb)
 {
         struct ra_msg *ra_msg = (struct ra_msg *) skb->h.raw;
-	struct neighbour *neigh;
+	struct neighbour *neigh = NULL;
 	struct inet6_dev *in6_dev;
 	struct rt6_info *rt;
 	int lifetime;
@@ -1053,7 +1053,11 @@
 
 	rt = rt6_get_dflt_router(&skb->nh.ipv6h->saddr, skb->dev);
 
+	if (rt)
+		neigh = rt->rt6i_nexthop;
+
 	if (rt && lifetime == 0) {
+		neigh_clone(neigh);
 		ip6_del_rt(rt, NULL, NULL);
 		rt = NULL;
 	}
@@ -1126,7 +1130,10 @@
 	 *	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;
 		int lladdrlen;
 		if (ndopts.nd_opts_src_lladdr) {
@@ -1181,6 +1188,8 @@
 out:
 	if (rt)
 		dst_release(&rt->u.dst);
+	else if (neigh)
+		neigh_release(neigh);
 	in6_dev_put(in6_dev);
 }
 

-- 
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] [IPV6]: Ensure to learn link-layer address from RA.
  2005-01-18 13:37 [PATCH] [IPV6]: Ensure to learn link-layer address from RA YOSHIFUJI Hideaki / 吉藤英明
@ 2005-01-18 21:23 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2005-01-18 21:23 UTC (permalink / raw)
  To: yoshfuji; +Cc: netdev

On Tue, 18 Jan 2005 22:37:18 +0900 (JST)
YOSHIFUJI Hideaki / ^[$B5HF#1QL@^[(B <yoshfuji@linux-ipv6.org> wrote:

> Here's a patch to ensure to learn link-layer address from RA.
> 
> Signed-off-by: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>

Looks good, applied.

Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-01-18 21:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-18 13:37 [PATCH] [IPV6]: Ensure to learn link-layer address from RA YOSHIFUJI Hideaki / 吉藤英明
2005-01-18 21:23 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).