Replace sizeof(struct dhcpMessage) with DHCP_SIZE.

This commit is contained in:
Nicholas J. Kain 2010-11-14 02:01:17 -05:00
parent 9421da3157
commit 4ce4323d00
2 changed files with 3 additions and 3 deletions

View File

@ -72,7 +72,7 @@ uint32_t random_xid(void)
/* Initializes dhcp packet header for a -client- packet. */ /* Initializes dhcp packet header for a -client- packet. */
static void init_header(struct dhcpMessage *packet, char type) static void init_header(struct dhcpMessage *packet, char type)
{ {
memset(packet, 0, sizeof(struct dhcpMessage)); memset(packet, 0, DHCP_SIZE);
packet->op = BOOTREQUEST; /* client */ packet->op = BOOTREQUEST; /* client */
packet->htype = ETH_10MB; packet->htype = ETH_10MB;
packet->hlen = ETH_10MB_LEN; packet->hlen = ETH_10MB_LEN;

View File

@ -19,8 +19,8 @@ int get_packet(struct dhcpMessage *packet, int fd)
{ {
int bytes; int bytes;
memset(packet, 0, sizeof(struct dhcpMessage)); memset(packet, 0, DHCP_SIZE);
bytes = safe_read(fd, (char *)packet, sizeof(struct dhcpMessage)); bytes = safe_read(fd, (char *)packet, DHCP_SIZE);
if (bytes == -1) { if (bytes == -1) {
log_line("Read on listen socket failed: %s", strerror(errno)); log_line("Read on listen socket failed: %s", strerror(errno));
return -1; return -1;