Hi,

route applet fails to add/delete a route on 64-bit BE machines with
following message:

bogus netmask 255.255.255.0

The netmask sanity check routine in INET_setroute() stores the value in
an unsigned long variable, whose size is not always 32 bit. Then it is
inverted to yield a value with first 32 bits set to 1. So the testing
condition-- if (mask & (mask + 1)) --is never satisfied, except for
"0.0.0.0".

There're some more routines that use unsigned long to store IPv4
addresses, but they seem to make no problem, so skipped :-)

Thanks.
--- busybox-1.11.2/networking/route.c.orig	2008-09-21 22:57:12.000000000 +0900
+++ busybox-1.11.2/networking/route.c	2008-09-21 22:58:13.000000000 +0900
@@ -302,7 +302,7 @@ static void INET_setroute(int action, ch
 
 	/* sanity checks.. */
 	if (mask_in_addr(rt)) {
-		unsigned long mask = mask_in_addr(rt);
+		uint32_t mask = mask_in_addr(rt);
 
 		mask = ~ntohl(mask);
 		if ((rt.rt_flags & RTF_HOST) && mask != 0xffffffff) {
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to