aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/common.h
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-11-25 03:15:24 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-11-25 03:15:24 +0000
commit72e76044cfda377486a5199a0d35d71edf669a42 (patch)
tree69e3f0f81955aae4e82d4073b8067b9bc3f9bd44 /networking/udhcp/common.h
parenta8875efa8506e52ffb24db833e32ab8cfb9bceef (diff)
downloadbusybox-w32-72e76044cfda377486a5199a0d35d71edf669a42.tar.gz
busybox-w32-72e76044cfda377486a5199a0d35d71edf669a42.tar.bz2
busybox-w32-72e76044cfda377486a5199a0d35d71edf669a42.zip
dhcpc: cope with buggy DHCP servers which send oversized packets
(Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>)
Diffstat (limited to 'networking/udhcp/common.h')
-rw-r--r--networking/udhcp/common.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index 4f2d31c98..eecb72ca2 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -21,6 +21,8 @@ extern const uint8_t MAC_BCAST_ADDR[6]; /* six all-ones */
21#include <netinet/udp.h> 21#include <netinet/udp.h>
22#include <netinet/ip.h> 22#include <netinet/ip.h>
23 23
24#define DHCP_OPTIONS_BUFSIZE 308
25
24struct dhcpMessage { 26struct dhcpMessage {
25 uint8_t op; 27 uint8_t op;
26 uint8_t htype; 28 uint8_t htype;
@@ -37,7 +39,7 @@ struct dhcpMessage {
37 uint8_t sname[64]; 39 uint8_t sname[64];
38 uint8_t file[128]; 40 uint8_t file[128];
39 uint32_t cookie; 41 uint32_t cookie;
40 uint8_t options[308]; /* 312 - cookie */ 42 uint8_t options[DHCP_OPTIONS_BUFSIZE + CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS];
41} ATTRIBUTE_PACKED; 43} ATTRIBUTE_PACKED;
42 44
43struct udp_dhcp_packet { 45struct udp_dhcp_packet {
@@ -49,7 +51,7 @@ struct udp_dhcp_packet {
49/* Let's see whether compiler understood us right */ 51/* Let's see whether compiler understood us right */
50struct BUG_bad_sizeof_struct_udp_dhcp_packet { 52struct BUG_bad_sizeof_struct_udp_dhcp_packet {
51 char BUG_bad_sizeof_struct_udp_dhcp_packet 53 char BUG_bad_sizeof_struct_udp_dhcp_packet
52 [sizeof(struct udp_dhcp_packet) != 576 ? -1 : 1]; 54 [(sizeof(struct udp_dhcp_packet) != 576 + CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS) ? -1 : 1];
53}; 55};
54 56
55void udhcp_init_header(struct dhcpMessage *packet, char type); 57void udhcp_init_header(struct dhcpMessage *packet, char type);