aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/packet.c')
-rw-r--r--networking/udhcp/packet.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index 529978189..f9dc11d01 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -18,6 +18,8 @@ void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type)
18 memset(packet, 0, sizeof(*packet)); 18 memset(packet, 0, sizeof(*packet));
19 packet->op = BOOTREQUEST; /* if client to a server */ 19 packet->op = BOOTREQUEST; /* if client to a server */
20 switch (type) { 20 switch (type) {
21 IF_FEATURE_UDHCPD_BOOTP(case MSGTYPE_BOOTP:)
22 /* reply to a BOOTP (not DHCP) client */
21 case DHCPOFFER: 23 case DHCPOFFER:
22 case DHCPACK: 24 case DHCPACK:
23 case DHCPNAK: 25 case DHCPNAK:
@@ -25,10 +27,11 @@ void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type)
25 } 27 }
26 packet->htype = 1; /* ethernet */ 28 packet->htype = 1; /* ethernet */
27 packet->hlen = 6; 29 packet->hlen = 6;
28 packet->cookie = htonl(DHCP_MAGIC); 30 packet->cookie = htonl(RFC1048_MAGIC);
29 if (DHCP_END != 0) 31 if (DHCP_END != 0)
30 packet->options[0] = DHCP_END; 32 packet->options[0] = DHCP_END;
31 udhcp_add_simple_option(packet, DHCP_MESSAGE_TYPE, type); 33 IF_FEATURE_UDHCPD_BOOTP(if (type != MSGTYPE_BOOTP))
34 udhcp_add_simple_option(packet, DHCP_MESSAGE_TYPE, type);
32} 35}
33#endif 36#endif
34 37
@@ -90,7 +93,7 @@ int FAST_FUNC udhcp_recv_kernel_packet(struct dhcp_packet *packet, int fd)
90 } 93 }
91 94
92 if (bytes < offsetof(struct dhcp_packet, options) 95 if (bytes < offsetof(struct dhcp_packet, options)
93 || packet->cookie != htonl(DHCP_MAGIC) 96 || packet->cookie != htonl(RFC1048_MAGIC)
94 ) { 97 ) {
95 bb_simple_info_msg("packet with bad magic, ignoring"); 98 bb_simple_info_msg("packet with bad magic, ignoring");
96 return -2; 99 return -2;