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/files.c | |
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/files.c')
-rw-r--r-- | networking/udhcp/files.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c index 40cfe9f..62f4a38 100644 --- a/networking/udhcp/files.c +++ b/networking/udhcp/files.c @@ -99,7 +99,7 @@ static void attach_option(struct option_set **opt_list, log2("Attaching option %02x to list", option->code); #if ENABLE_FEATURE_UDHCP_RFC3397 - if ((option->flags & TYPE_MASK) == OPTION_STR1035) + if ((option->flags & OPTION_TYPE_MASK) == OPTION_STR1035) /* reuse buffer and length for RFC1035-formatted string */ buffer = (char *)dname_enc(NULL, 0, buffer, &length); #endif @@ -118,7 +118,7 @@ static void attach_option(struct option_set **opt_list, new->next = *curr; *curr = new; #if ENABLE_FEATURE_UDHCP_RFC3397 - if ((option->flags & TYPE_MASK) == OPTION_STR1035 && buffer != NULL) + if ((option->flags & OPTION_TYPE_MASK) == OPTION_STR1035 && buffer != NULL) free(buffer); #endif return; @@ -128,7 +128,7 @@ static void attach_option(struct option_set **opt_list, log1("Attaching option %02x to existing member of list", option->code); if (option->flags & OPTION_LIST) { #if ENABLE_FEATURE_UDHCP_RFC3397 - if ((option->flags & TYPE_MASK) == OPTION_STR1035) + if ((option->flags & OPTION_TYPE_MASK) == OPTION_STR1035) /* reuse buffer and length for RFC1035-formatted string */ buffer = (char *)dname_enc(existing->data + 2, existing->data[OPT_LEN], buffer, &length); @@ -136,7 +136,7 @@ static void attach_option(struct option_set **opt_list, if (existing->data[OPT_LEN] + length <= 255) { existing->data = xrealloc(existing->data, existing->data[OPT_LEN] + length + 3); - if ((option->flags & TYPE_MASK) == OPTION_STRING) { + if ((option->flags & OPTION_TYPE_MASK) == OPTION_STRING) { /* ' ' can bring us to 256 - bad */ if (existing->data[OPT_LEN] + length >= 255) return; @@ -148,7 +148,7 @@ static void attach_option(struct option_set **opt_list, existing->data[OPT_LEN] += length; } /* else, ignore the data, we could put this in a second option in the future */ #if ENABLE_FEATURE_UDHCP_RFC3397 - if ((option->flags & TYPE_MASK) == OPTION_STR1035 && buffer != NULL) + if ((option->flags & OPTION_TYPE_MASK) == OPTION_STR1035 && buffer != NULL) free(buffer); #endif } /* else, ignore the new data */ @@ -182,10 +182,10 @@ static int FAST_FUNC read_opt(const char *const_line, void *arg) do { val = strtok(NULL, ", \t"); if (!val) break; - length = dhcp_option_lengths[option->flags & TYPE_MASK]; + length = dhcp_option_lengths[option->flags & OPTION_TYPE_MASK]; retval = 0; opt = buffer; /* new meaning for variable opt */ - switch (option->flags & TYPE_MASK) { + switch (option->flags & OPTION_TYPE_MASK) { case OPTION_IP: retval = read_nip(val, buffer); break; |