← Commit list

858fad722

Russ Dill
Russ Dill
2003-02-12
SOURCE BUG Duration: 2s

Subject

sync with udhcp bug fixes

SOURCE BUG

This commit was genuinely broken at the time (not related to our build system): sysdeps/linux/Config.in "fileutils/Config.in" dosyasini kaynak gosteriyor ama bu dosya repoda hic var olmadi (2002-12-05 - 2003-02-15 arasi orijinal yazar hatasi, 3238ea167 ile duzeltildi)

→ Bu hatanin tam hikayesini ve duzeltme diffini gor

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Debian 14.2.0-19) 14.2.0

—

Build Log

(log yok)

Commit Diff GitHub →

networking/udhcp/ChangeLog+2 -0
@@ -1,4 +1,6 @@
0.9.9 (pending)
++ Fixed a little endian problem in mton (Bastian Blank <[email protected]>)
++ Fixed a arpping alignment problem (Rui He <[email protected]>)
+ 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
networking/udhcp/arpping.c+2 -2
@@ -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);
networking/udhcp/script.c+5 -4
@@ -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;
}