mirror of
https://git.busybox.net/udhcp
synced 2025-05-08 22:09:45 +08:00
head off possible packing problems
This commit is contained in:
parent
ba260da42a
commit
78ade985d9
@ -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 */
|
||||
|
@ -11,7 +11,12 @@
|
||||
#include <netinet/in.h>
|
||||
|
||||
struct arpMsg {
|
||||
struct ethhdr ethhdr; /* Ethernet header */
|
||||
/* Ethernet header */
|
||||
u_char h_dest[6]; /* destination ether addr */
|
||||
u_char h_source[6]; /* source ether addr */
|
||||
u_short h_proto; /* packet type ID field */
|
||||
|
||||
/* ARP packet */
|
||||
uint16_t htype; /* hardware type (must be ARPHRD_ETHER) */
|
||||
uint16_t ptype; /* protocol type (must be ETH_P_IP) */
|
||||
uint8_t hlen; /* hardware address length (must be 6) */
|
||||
@ -22,7 +27,7 @@ struct arpMsg {
|
||||
uint8_t tHaddr[6]; /* target's hardware address */
|
||||
uint8_t tInaddr[4]; /* target's IP address */
|
||||
uint8_t pad[18]; /* pad for min. Ethernet payload (60 bytes) */
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* function prototypes */
|
||||
int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *arp, char *interface);
|
||||
|
Loading…
x
Reference in New Issue
Block a user