route(8): Fix a possible infinite loop in "route flush"
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 15 Mar 2013 09:44:11 +0000 (17:44 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 15 Mar 2013 09:44:11 +0000 (17:44 +0800)
Obtained-from: FreeBSD 230989
DragonFly-bug: http://bugs.dragonflybsd.org/issues/2523

sbin/route/route.c

index ee4cc88..4b78626 100644 (file)
@@ -462,7 +462,7 @@ netname(struct sockaddr *sa)
                         * width subnet fields.
                         */
                        while (in.s_addr &~ mask)
-                               mask = (long)mask >> subnetshift;
+                               mask |= mask >> subnetshift;
                        net = in.s_addr & mask;
                        while ((mask & 1) == 0)
                                mask >>= 1, net >>= 1;