lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 13 May 2008 02:17:36 +0900 (JST)
From:	YOSHIFUJI Hideaki / 吉藤英明 
	<yoshfuji@...ux-ipv6.org>
To:	dlstevens@...ibm.com, Joseph.Bonitch@...ox.com
Cc:	davem@...emloft.net, netdev@...r.kernel.org,
	yoshfuji@...ux-ipv6.org
Subject: Re: IPV6 stateless address autoconfiguration

In article <OFEAF0762D.B7C9C8DD-ON88257447.005CE64E-88257447.005D6A63@...ibm.com> (at Mon, 12 May 2008 10:00:21 -0700), David Stevens <dlstevens@...ibm.com> says:

> > +         } else if (~rt_expires) {
> > +            /* not infinity */
> > +            rt->rt6i_expires = jiffies + rt_expires;
> > +            rt->rt6i_flags |= RTF_EXPIRES;
> 
>         rt_expires is "unsigned long" -- won't the high-order
> bits be set on 64-bit machines?
>         Also, don't you need to check before the divide by
> USER_HZ?

Oops, I'm afraid I sent a wrong file, sorry.

This is the correct version.
(...and I plan to come up with more fixes
for real application on top of the net tree.)

Sighed-off-by: YOSHIFUJI Hideaki <yoshfuji@...ux-ipv6.org>

-- 
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e591e09..0e2de23 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1769,7 +1769,9 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
 	   but it would require division in fib gc, that it
 	   not good.
 	 */
-	if (valid_lft >= 0x7FFFFFFF/HZ)
+	if (valid_lft == 0xFFFFFFFF)
+		rt_expires = ~0UL;
+	else if (valid_lft >= 0x7FFFFFFF/HZ)
 		rt_expires = 0x7FFFFFFF - (0x7FFFFFFF % HZ);
 	else
 		rt_expires = valid_lft * HZ;
@@ -1779,7 +1781,8 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
 	 * Avoid arithmetic overflow there as well.
 	 * Overflow can happen only if HZ < USER_HZ.
 	 */
-	if (HZ < USER_HZ && rt_expires > 0x7FFFFFFF / USER_HZ)
+	if (HZ < USER_HZ &&
+	    ~rt_expires && rt_expires > 0x7FFFFFFF / USER_HZ)
 		rt_expires = 0x7FFFFFFF / USER_HZ;
 
 	if (pinfo->onlink) {
@@ -1787,18 +1790,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);


-- 
YOSHIFUJI Hideaki @ USAGI Project  <yoshfuji@...ux-ipv6.org>
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ