Re: IPV6 stateless address autoconfiguration

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: YOSHIFUJI Hideaki /
Date: Monday, May 12, 2008 - 8:46 am

In article <20080512.235837.12477853.yoshfuji@linux-ipv6.org> (at Mon, 12 May 2008 23:58:37 +0900 (JST)), YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org> says:


Okay, this is my tentative patch.
Could you test this, please?

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

--- 
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e591e09..266a6bb 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1787,18 +1787,29 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
 		rt = rt6_lookup(dev_net(dev), &pinfo->prefix, NULL,
 				dev->ifindex, 1);
 
-		if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) {
-			if (rt->rt6i_flags&RTF_EXPIRES) {
-				if (valid_lft == 0) {
-					ip6_del_rt(rt);
-					rt = NULL;
-				} else {
-					rt->rt6i_expires = jiffies + rt_expires;
-				}
+		if (rt && (rt->rt6i_flags & (RTF_ADDRCONF | RTF_PREFIX_RT)) == (RTF_ADDRCONF | RTF_PREFIX_RT)) {
+			/* Autoconf prefix route */
+			if (valid_lft == 0) {
+				ip6_del_rt(rt);
+				rt = NULL;
+			} else if (~rt_expires) {
+				/* not infinity */
+				rt->rt6i_expires = jiffies + rt_expires;
+				rt->rt6i_flags |= RTF_EXPIRES;
+			} else {
+				rt->rt6i_flags &= ~RTF_EXPIRES;
+				rt->rt6i_expires = 0;
 			}
 		} else if (valid_lft) {
+			int flags = RTF_ADDRCONF | RTF_PREFIX_RT;
+			clock_t expires = 0;
+			if (~rt_expires) {
+				/* not infinity */
+				flags |= RTF_EXPIRES;
+				expires = jiffies_to_clock_t(rt_expires);
+			}
 			addrconf_prefix_route(&pinfo->prefix, pinfo->prefix_len,
-					      dev, jiffies_to_clock_t(rt_expires), RTF_ADDRCONF|RTF_EXPIRES|RTF_PREFIX_RT);
+					      dev, expires, flags);
 		}
 		if (rt)
 			dst_release(&rt->u.dst);


--yoshfuji
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
IPV6 stateless address autoconfiguration, Bonitch, Joseph, (Mon May 12, 4:46 am)
Re: IPV6 stateless address autoconfiguration, David Miller, (Mon May 12, 5:14 am)
Re: IPV6 stateless address autoconfiguration, YOSHIFUJI Hideaki / , (Mon May 12, 7:58 am)
Re: IPV6 stateless address autoconfiguration, YOSHIFUJI Hideaki / , (Mon May 12, 8:46 am)
Re: IPV6 stateless address autoconfiguration, David Stevens, (Mon May 12, 10:00 am)
Re: IPV6 stateless address autoconfiguration, YOSHIFUJI Hideaki / , (Mon May 12, 10:17 am)
RE: IPV6 stateless address autoconfiguration, Bonitch, Joseph, (Mon May 12, 12:36 pm)
Re: IPV6 stateless address autoconfiguration, YOSHIFUJI Hideaki / , (Mon May 12, 6:42 pm)
RE: IPV6 stateless address autoconfiguration, Bonitch, Joseph, (Wed May 14, 4:15 am)
RE: IPV6 stateless address autoconfiguration, Bonitch, Joseph, (Wed May 14, 1:05 pm)
Re: IPV6 stateless address autoconfiguration, YOSHIFUJI Hideaki / , (Thu May 15, 1:10 am)