[BusyBox-cvs] busybox/networking/udhcp ChangeLog,1.3,1.4 arpping.c,1.1,1.2 script.c,1.3,1.4

Russ Dill russ at busybox.net
Wed Feb 12 22:20:23 UTC 2003


Update of /var/cvs/busybox/networking/udhcp
In directory winder:/tmp/cvs-serv24574

Modified Files:
	ChangeLog arpping.c script.c 
Log Message:
sync with udhcp bug fixes

Index: ChangeLog
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/ChangeLog,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ChangeLog	11 Dec 2002 21:40:45 -0000	1.3
+++ ChangeLog	12 Feb 2003 22:20:19 -0000	1.4
@@ -1,4 +1,6 @@
 0.9.9 (pending)
++ Fixed a little endian problem in mton (Bastian Blank <waldi at debian.org>)
++ Fixed a arpping alignment problem (Rui He <rhe at 3eti.com>)
 + Added sanity check for max_leases (udhcp bug #1285) (me)
 + Finally got rid of the trailing space in enviromental vars (me)
 + added an new enviromental variable: $mask. It contains the number

Index: arpping.c
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/arpping.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- arpping.c	14 Oct 2002 21:41:26 -0000	1.1
+++ arpping.c	12 Feb 2003 22:20:19 -0000	1.2
@@ -67,9 +67,9 @@
 	arp.hlen = 6;					/* hardware address length */
 	arp.plen = 4;					/* protocol address length */
 	arp.operation = htons(ARPOP_REQUEST);		/* ARP op code */
-	*((u_int *) arp.sInaddr) = ip;			/* source IP address */
+	memcpy(arp.sInaddr, &ip, sizeof(ip));		/* source IP address */
 	memcpy(arp.sHaddr, mac, 6);			/* source hardware address */
-	*((u_int *) arp.tInaddr) = yiaddr;		/* target IP address */
+	memcpy(arp.tInaddr, &yiaddr, sizeof(yiaddr));	/* target IP address */
 	
 	memset(&addr, 0, sizeof(addr));
 	strcpy(addr.sa_data, interface);

Index: script.c
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/script.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- script.c	11 Dec 2002 21:12:45 -0000	1.3
+++ script.c	12 Feb 2003 22:20:19 -0000	1.4
@@ -68,10 +68,11 @@
 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;
 }
 
 




More information about the busybox-cvs mailing list