aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruss <russ@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-02-12 22:20:19 +0000
committerruss <russ@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-02-12 22:20:19 +0000
commit8171b515eff444e08d8da16d1e4728538ceaeb81 (patch)
tree8c90a053f1c976985368292b7f3d01bfc71e67e0
parentbce815faade9b4526b62dd237a9827228a2632a6 (diff)
downloadbusybox-w32-8171b515eff444e08d8da16d1e4728538ceaeb81.tar.gz
busybox-w32-8171b515eff444e08d8da16d1e4728538ceaeb81.tar.bz2
busybox-w32-8171b515eff444e08d8da16d1e4728538ceaeb81.zip
sync with udhcp bug fixes
git-svn-id: svn://busybox.net/trunk/busybox@6597 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--networking/udhcp/ChangeLog2
-rw-r--r--networking/udhcp/arpping.c4
-rw-r--r--networking/udhcp/script.c9
3 files changed, 9 insertions, 6 deletions
diff --git a/networking/udhcp/ChangeLog b/networking/udhcp/ChangeLog
index 13818953b..7409fd0ad 100644
--- a/networking/udhcp/ChangeLog
+++ b/networking/udhcp/ChangeLog
@@ -1,4 +1,6 @@
10.9.9 (pending) 10.9.9 (pending)
2+ Fixed a little endian problem in mton (Bastian Blank <waldi@debian.org>)
3+ Fixed a arpping alignment problem (Rui He <rhe@3eti.com>)
2+ Added sanity check for max_leases (udhcp bug #1285) (me) 4+ Added sanity check for max_leases (udhcp bug #1285) (me)
3+ Finally got rid of the trailing space in enviromental vars (me) 5+ Finally got rid of the trailing space in enviromental vars (me)
4+ added an new enviromental variable: $mask. It contains the number 6+ added an new enviromental variable: $mask. It contains the number
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c
index d71cd10f4..4c0b3d83b 100644
--- a/networking/udhcp/arpping.c
+++ b/networking/udhcp/arpping.c
@@ -67,9 +67,9 @@ int arpping(u_int32_t yiaddr, u_int32_t ip, unsigned char *mac, char *interface)
67 arp.hlen = 6; /* hardware address length */ 67 arp.hlen = 6; /* hardware address length */
68 arp.plen = 4; /* protocol address length */ 68 arp.plen = 4; /* protocol address length */
69 arp.operation = htons(ARPOP_REQUEST); /* ARP op code */ 69 arp.operation = htons(ARPOP_REQUEST); /* ARP op code */
70 *((u_int *) arp.sInaddr) = ip; /* source IP address */ 70 memcpy(arp.sInaddr, &ip, sizeof(ip)); /* source IP address */
71 memcpy(arp.sHaddr, mac, 6); /* source hardware address */ 71 memcpy(arp.sHaddr, mac, 6); /* source hardware address */
72 *((u_int *) arp.tInaddr) = yiaddr; /* target IP address */ 72 memcpy(arp.tInaddr, &yiaddr, sizeof(yiaddr)); /* target IP address */
73 73
74 memset(&addr, 0, sizeof(addr)); 74 memset(&addr, 0, sizeof(addr));
75 strcpy(addr.sa_data, interface); 75 strcpy(addr.sa_data, interface);
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)
68static int mton(struct in_addr *mask) 68static int mton(struct in_addr *mask)
69{ 69{
70 int i; 70 int i;
71 /* note: mask will always be in network byte order, so 71 unsigned long bits = ntohl(mask->s_addr);
72 * there are no endian issues */ 72 /* too bad one can't check the carry bit, etc in c bit
73 for (i = 31; i >= 0 && !((mask->s_addr >> i) & 1); i--); 73 * shifting */
74 return i + 1; 74 for (i = 0; i < 32 && !((bits >> i) & 1); i++);
75 return 32 - i;
75} 76}
76 77
77 78