diff options
author | Denys Vlasenko | 2010-03-21 06:15:28 +0100 |
---|---|---|
committer | Denys Vlasenko | 2010-03-21 06:15:28 +0100 |
commit | c7dc79e71ddbc1498736a2bbf65a3da179557f83 (patch) | |
tree | ab470e39f11f432b2099d3ebbe779d224bc1efba /networking/udhcp/options.h | |
parent | 2e7aa928360eb9b1c90fa2356734cee794b66516 (diff) | |
download | busybox-c7dc79e71ddbc1498736a2bbf65a3da179557f83.zip busybox-c7dc79e71ddbc1498736a2bbf65a3da179557f83.tar.gz |
udhcpd: untangle incredibly messy handling of DHCPREQUEST
Also fixes attacks possible via DHCPDECLINE / DHCPRELEASE
function old new delta
udhcpd_main 1846 1949 +103
send_renew 105 142 +37
send_NAK 61 - -61
send_ACK 180 - -180
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 2/0 up/down: 140/-241) Total: -101 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/udhcp/options.h')
-rw-r--r-- | networking/udhcp/options.h | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/networking/udhcp/options.h b/networking/udhcp/options.h index 05090f1..3ca4dc4 100644 --- a/networking/udhcp/options.h +++ b/networking/udhcp/options.h @@ -5,7 +5,6 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN -#define TYPE_MASK 0x0F enum { OPTION_IP = 1, @@ -21,19 +20,13 @@ enum { OPTION_U32, OPTION_S32, OPTION_STATIC_ROUTES, -}; - -/* Client requests this option by default */ -#define OPTION_REQ 0x10 -/* There can be a list of 1 or more of these */ -#define OPTION_LIST 0x20 -/*****************************************************************/ -/* Do not modify below here unless you know what you are doing!! */ -/*****************************************************************/ - -/* DHCP protocol. See RFC 2131 */ -#define DHCP_MAGIC 0x63825363 + OPTION_TYPE_MASK = 0x0f, + /* Client requests this option by default */ + OPTION_REQ = 0x10, + /* There can be a list of 1 or more of these */ + OPTION_LIST = 0x20, +}; /* DHCP option codes (partial list). See RFC 2132 and * http://www.iana.org/assignments/bootp-dhcp-parameters/ @@ -81,7 +74,6 @@ enum { //#define DHCP_WPAD 0xfc /* MSIE's Web Proxy Autodiscovery Protocol */ #define DHCP_END 0xff - /* Offsets in option byte sequence */ #define OPT_CODE 0 #define OPT_LEN 1 @@ -91,12 +83,7 @@ enum { #define FILE_FIELD 1 #define SNAME_FIELD 2 -#define BOOTREQUEST 1 -#define BOOTREPLY 2 - -#define ETH_10MB 1 -#define ETH_10MB_LEN 6 - +/* DHCP_MESSAGE_TYPE values */ #define DHCPDISCOVER 1 /* client -> server */ #define DHCPOFFER 2 /* client <- server */ #define DHCPREQUEST 3 /* client -> server */ @@ -105,6 +92,9 @@ enum { #define DHCPNAK 6 /* client <- server */ #define DHCPRELEASE 7 /* client -> server */ #define DHCPINFORM 8 /* client -> server */ +#define DHCP_MINTYPE DHCPDISCOVER +#define DHCP_MAXTYPE DHCPINFORM + struct dhcp_option { uint8_t flags; |