diff options
Diffstat (limited to 'networking/udhcp/packet.c')
-rw-r--r-- | networking/udhcp/packet.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c index 90410cbc0..84d83098c 100644 --- a/networking/udhcp/packet.c +++ b/networking/udhcp/packet.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type) | 22 | void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type) |
23 | { | 23 | { |
24 | memset(packet, 0, sizeof(struct dhcp_packet)); | 24 | memset(packet, 0, sizeof(*packet)); |
25 | packet->op = BOOTREQUEST; /* if client to a server */ | 25 | packet->op = BOOTREQUEST; /* if client to a server */ |
26 | switch (type) { | 26 | switch (type) { |
27 | case DHCPOFFER: | 27 | case DHCPOFFER: |
@@ -29,10 +29,11 @@ void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type) | |||
29 | case DHCPNAK: | 29 | case DHCPNAK: |
30 | packet->op = BOOTREPLY; /* if server to client */ | 30 | packet->op = BOOTREPLY; /* if server to client */ |
31 | } | 31 | } |
32 | packet->htype = ETH_10MB; | 32 | packet->htype = 1; /* ethernet */ |
33 | packet->hlen = ETH_10MB_LEN; | 33 | packet->hlen = 6; |
34 | packet->cookie = htonl(DHCP_MAGIC); | 34 | packet->cookie = htonl(DHCP_MAGIC); |
35 | packet->options[0] = DHCP_END; | 35 | if (DHCP_END != 0) |
36 | packet->options[0] = DHCP_END; | ||
36 | add_simple_option(packet->options, DHCP_MESSAGE_TYPE, type); | 37 | add_simple_option(packet->options, DHCP_MESSAGE_TYPE, type); |
37 | } | 38 | } |
38 | 39 | ||
@@ -228,6 +229,7 @@ int FAST_FUNC udhcp_send_raw_packet(struct dhcp_packet *dhcp_pkt, | |||
228 | msg = "sendto"; | 229 | msg = "sendto"; |
229 | ret_close: | 230 | ret_close: |
230 | close(fd); | 231 | close(fd); |
232 | /* FIXME: and if result >= 0 but != IP_UPD_DHCP_SIZE? */ | ||
231 | if (result < 0) { | 233 | if (result < 0) { |
232 | ret_msg: | 234 | ret_msg: |
233 | bb_perror_msg(msg, "PACKET"); | 235 | bb_perror_msg(msg, "PACKET"); |
@@ -280,6 +282,7 @@ int FAST_FUNC udhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt, | |||
280 | msg = "write"; | 282 | msg = "write"; |
281 | ret_close: | 283 | ret_close: |
282 | close(fd); | 284 | close(fd); |
285 | /* FIXME: and if result >= 0 but != DHCP_SIZE? */ | ||
283 | if (result < 0) { | 286 | if (result < 0) { |
284 | ret_msg: | 287 | ret_msg: |
285 | bb_perror_msg(msg, "UDP"); | 288 | bb_perror_msg(msg, "UDP"); |