diff options
author | Denis Vlasenko | 2007-11-25 03:15:24 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-11-25 03:15:24 +0000 |
commit | 72e76044cfda377486a5199a0d35d71edf669a42 (patch) | |
tree | 69e3f0f81955aae4e82d4073b8067b9bc3f9bd44 /networking/udhcp/common.h | |
parent | a8875efa8506e52ffb24db833e32ab8cfb9bceef (diff) | |
download | busybox-72e76044cfda377486a5199a0d35d71edf669a42.zip busybox-72e76044cfda377486a5199a0d35d71edf669a42.tar.gz |
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.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h index 4f2d31c..eecb72c 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 */ #include <netinet/udp.h> #include <netinet/ip.h> +#define DHCP_OPTIONS_BUFSIZE 308 + struct dhcpMessage { uint8_t op; uint8_t htype; @@ -37,7 +39,7 @@ struct dhcpMessage { uint8_t sname[64]; uint8_t file[128]; uint32_t cookie; - uint8_t options[308]; /* 312 - cookie */ + uint8_t options[DHCP_OPTIONS_BUFSIZE + CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS]; } ATTRIBUTE_PACKED; struct udp_dhcp_packet { @@ -49,7 +51,7 @@ struct udp_dhcp_packet { /* Let's see whether compiler understood us right */ struct BUG_bad_sizeof_struct_udp_dhcp_packet { char BUG_bad_sizeof_struct_udp_dhcp_packet - [sizeof(struct udp_dhcp_packet) != 576 ? -1 : 1]; + [(sizeof(struct udp_dhcp_packet) != 576 + CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS) ? -1 : 1]; }; void udhcp_init_header(struct dhcpMessage *packet, char type); |