diff options
author | Glenn L McGrath | 2004-03-05 14:25:49 +0000 |
---|---|---|
committer | Glenn L McGrath | 2004-03-05 14:25:49 +0000 |
commit | 3f79300e37d02b1d5df4de97089e89927d1063a2 (patch) | |
tree | 2d868bbb6059ee64dbf5cd6af9879a33c31562f8 /networking/udhcp/arpping.c | |
parent | 0226596dcb218349238380638c46ae1009eb82d3 (diff) | |
download | busybox-3f79300e37d02b1d5df4de97089e89927d1063a2.zip busybox-3f79300e37d02b1d5df4de97089e89927d1063a2.tar.gz |
Patch by Andrew Victor,
In arpping.h, fix structure alignment of "struct arpMsg".
GCC can insert padding in the structure which causes udhcpd to send an
invalid ARP packet on the network. It will then not receive a valid
reply, which can cause it to assign an IP address that's already in use
on the network.
(With kernels before 2.4.20, the "struct ethhdr" in linux/if_ether.h
wasn't marked as packed. This is also an issue if your toolchain was
built with a pre-2.4.20 kernel).
Diffstat (limited to 'networking/udhcp/arpping.c')
-rw-r--r-- | networking/udhcp/arpping.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c index f2e3768..23c7d46 100644 --- a/networking/udhcp/arpping.c +++ b/networking/udhcp/arpping.c @@ -60,9 +60,9 @@ int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface) /* send arp request */ memset(&arp, 0, sizeof(arp)); - memcpy(arp.ethhdr.h_dest, MAC_BCAST_ADDR, 6); /* MAC DA */ - memcpy(arp.ethhdr.h_source, mac, 6); /* MAC SA */ - arp.ethhdr.h_proto = htons(ETH_P_ARP); /* protocol type (Ethernet) */ + memcpy(arp.h_dest, MAC_BCAST_ADDR, 6); /* MAC DA */ + memcpy(arp.h_source, mac, 6); /* MAC SA */ + arp.h_proto = htons(ETH_P_ARP); /* protocol type (Ethernet) */ arp.htype = htons(ARPHRD_ETHER); /* hardware type */ arp.ptype = htons(ETH_P_IP); /* protocol type (ARP message) */ arp.hlen = 6; /* hardware address length */ |