summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorRuss Dill2003-02-12 22:20:19 +0000
committerRuss Dill2003-02-12 22:20:19 +0000
commit858fad722fa949f057dbc5a5e7dd63eef8954187 (patch)
tree8c90a053f1c976985368292b7f3d01bfc71e67e0 /networking
parent496411b4891f8e7e3286ba36cd3aff5438b5f71d (diff)
downloadbusybox-858fad722fa949f057dbc5a5e7dd63eef8954187.zip
busybox-858fad722fa949f057dbc5a5e7dd63eef8954187.tar.gz
sync with udhcp bug fixes
Diffstat (limited to 'networking')
-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 1381895..7409fd0 100644
--- a/networking/udhcp/ChangeLog
+++ b/networking/udhcp/ChangeLog
@@ -1,4 +1,6 @@
0.9.9 (pending)
++ Fixed a little endian problem in mton (Bastian Blank <waldi@debian.org>)
++ Fixed a arpping alignment problem (Rui He <rhe@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
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c
index d71cd10..4c0b3d8 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)
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);
diff --git a/networking/udhcp/script.c b/networking/udhcp/script.c
index 2eb4459..48ff8e0 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;
}