diff options
Diffstat (limited to 'networking/udhcp/dhcpc.c')
-rw-r--r-- | networking/udhcp/dhcpc.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 1caf89559..24ff82d2f 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c | |||
@@ -81,7 +81,7 @@ static int mton(uint32_t mask) | |||
81 | } | 81 | } |
82 | 82 | ||
83 | /* Create "opt_name=opt_value" string */ | 83 | /* Create "opt_name=opt_value" string */ |
84 | static NOINLINE char *xmalloc_optname_optval(uint8_t *option, const struct dhcp_option *type_p, const char *opt_name) | 84 | static NOINLINE char *xmalloc_optname_optval(uint8_t *option, const struct dhcp_optflag *optflag, const char *opt_name) |
85 | { | 85 | { |
86 | unsigned upper_length; | 86 | unsigned upper_length; |
87 | int len, type, optlen; | 87 | int len, type, optlen; |
@@ -89,7 +89,7 @@ static NOINLINE char *xmalloc_optname_optval(uint8_t *option, const struct dhcp_ | |||
89 | 89 | ||
90 | /* option points to OPT_DATA, need to go back and get OPT_LEN */ | 90 | /* option points to OPT_DATA, need to go back and get OPT_LEN */ |
91 | len = option[OPT_LEN - OPT_DATA]; | 91 | len = option[OPT_LEN - OPT_DATA]; |
92 | type = type_p->flags & OPTION_TYPE_MASK; | 92 | type = optflag->flags & OPTION_TYPE_MASK; |
93 | optlen = dhcp_option_lengths[type]; | 93 | optlen = dhcp_option_lengths[type]; |
94 | upper_length = len_of_option_as_string[type] * ((unsigned)len / (unsigned)optlen); | 94 | upper_length = len_of_option_as_string[type] * ((unsigned)len / (unsigned)optlen); |
95 | 95 | ||
@@ -105,7 +105,7 @@ static NOINLINE char *xmalloc_optname_optval(uint8_t *option, const struct dhcp_ | |||
105 | optlen = 4; | 105 | optlen = 4; |
106 | case OPTION_IP: | 106 | case OPTION_IP: |
107 | dest += sprint_nip(dest, "", option); | 107 | dest += sprint_nip(dest, "", option); |
108 | // TODO: it can be a list only if (type_p->flags & OPTION_LIST). | 108 | // TODO: it can be a list only if (optflag->flags & OPTION_LIST). |
109 | // Should we bail out/warn if we see multi-ip option which is | 109 | // Should we bail out/warn if we see multi-ip option which is |
110 | // not allowed to be such? For example, DHCP_BROADCAST... | 110 | // not allowed to be such? For example, DHCP_BROADCAST... |
111 | break; | 111 | break; |
@@ -237,10 +237,10 @@ static char **fill_envp(struct dhcp_packet *packet) | |||
237 | uint8_t over = 0; | 237 | uint8_t over = 0; |
238 | 238 | ||
239 | if (packet) { | 239 | if (packet) { |
240 | for (i = 0; dhcp_options[i].code; i++) { | 240 | for (i = 0; dhcp_optflags[i].code; i++) { |
241 | if (udhcp_get_option(packet, dhcp_options[i].code)) { | 241 | if (udhcp_get_option(packet, dhcp_optflags[i].code)) { |
242 | num_options++; | 242 | num_options++; |
243 | if (dhcp_options[i].code == DHCP_SUBNET) | 243 | if (dhcp_optflags[i].code == DHCP_SUBNET) |
244 | num_options++; /* for mton */ | 244 | num_options++; /* for mton */ |
245 | } | 245 | } |
246 | } | 246 | } |
@@ -269,14 +269,14 @@ static char **fill_envp(struct dhcp_packet *packet) | |||
269 | opt_name = dhcp_option_strings; | 269 | opt_name = dhcp_option_strings; |
270 | i = 0; | 270 | i = 0; |
271 | while (*opt_name) { | 271 | while (*opt_name) { |
272 | temp = udhcp_get_option(packet, dhcp_options[i].code); | 272 | temp = udhcp_get_option(packet, dhcp_optflags[i].code); |
273 | if (!temp) | 273 | if (!temp) |
274 | goto next; | 274 | goto next; |
275 | *curr = xmalloc_optname_optval(temp, &dhcp_options[i], opt_name); | 275 | *curr = xmalloc_optname_optval(temp, &dhcp_optflags[i], opt_name); |
276 | putenv(*curr++); | 276 | putenv(*curr++); |
277 | 277 | ||
278 | /* Fill in a subnet bits option for things like /24 */ | 278 | /* Fill in a subnet bits option for things like /24 */ |
279 | if (dhcp_options[i].code == DHCP_SUBNET) { | 279 | if (dhcp_optflags[i].code == DHCP_SUBNET) { |
280 | uint32_t subnet; | 280 | uint32_t subnet; |
281 | move_from_unaligned32(subnet, temp); | 281 | move_from_unaligned32(subnet, temp); |
282 | *curr = xasprintf("mask=%d", mton(subnet)); | 282 | *curr = xasprintf("mask=%d", mton(subnet)); |
@@ -366,8 +366,8 @@ static void add_client_options(struct dhcp_packet *packet) | |||
366 | int end = udhcp_end_option(packet->options); | 366 | int end = udhcp_end_option(packet->options); |
367 | int i, len = 0; | 367 | int i, len = 0; |
368 | 368 | ||
369 | for (i = 0; (c = dhcp_options[i].code) != 0; i++) { | 369 | for (i = 0; (c = dhcp_optflags[i].code) != 0; i++) { |
370 | if (( (dhcp_options[i].flags & OPTION_REQ) | 370 | if (( (dhcp_optflags[i].flags & OPTION_REQ) |
371 | && !client_config.no_default_options | 371 | && !client_config.no_default_options |
372 | ) | 372 | ) |
373 | || (client_config.opt_mask[c >> 3] & (1 << (c & 7))) | 373 | || (client_config.opt_mask[c >> 3] & (1 << (c & 7))) |
@@ -905,7 +905,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) | |||
905 | while (list_O) { | 905 | while (list_O) { |
906 | char *optstr = llist_pop(&list_O); | 906 | char *optstr = llist_pop(&list_O); |
907 | unsigned n = udhcp_option_idx(optstr); | 907 | unsigned n = udhcp_option_idx(optstr); |
908 | n = dhcp_options[n].code; | 908 | n = dhcp_optflags[n].code; |
909 | client_config.opt_mask[n >> 3] |= 1 << (n & 7); | 909 | client_config.opt_mask[n >> 3] |= 1 << (n & 7); |
910 | } | 910 | } |
911 | while (list_x) { | 911 | while (list_x) { |