aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/script.c
diff options
context:
space:
mode:
authorGravatar Russ Dill <Russ.Dill@asu.edu>2003-02-12 22:20:19 +0000
committerGravatar Russ Dill <Russ.Dill@asu.edu>2003-02-12 22:20:19 +0000
commit858fad722fa949f057dbc5a5e7dd63eef8954187 (patch)
tree8c90a053f1c976985368292b7f3d01bfc71e67e0 /networking/udhcp/script.c
parent496411b4891f8e7e3286ba36cd3aff5438b5f71d (diff)
downloadbusybox-858fad722fa949f057dbc5a5e7dd63eef8954187.tar.gz
busybox-858fad722fa949f057dbc5a5e7dd63eef8954187.tar.bz2
sync with udhcp bug fixes
Diffstat (limited to 'networking/udhcp/script.c')
-rw-r--r--networking/udhcp/script.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/networking/udhcp/script.c b/networking/udhcp/script.c
index 2eb4459dd..48ff8e07e 100644
--- a/networking/udhcp/script.c
+++ b/networking/udhcp/script.c
@@ -68,10 +68,11 @@ static int sprintip(char *dest, char *pre, unsigned char *ip)
static int mton(struct in_addr *mask)
{
int i;
- /* note: mask will always be in network byte order, so
- * there are no endian issues */
- for (i = 31; i >= 0 && !((mask->s_addr >> i) & 1); i--);
- return i + 1;
+ unsigned long bits = ntohl(mask->s_addr);
+ /* too bad one can't check the carry bit, etc in c bit
+ * shifting */
+ for (i = 0; i < 32 && !((bits >> i) & 1); i++);
+ return 32 - i;
}