diff options
Diffstat (limited to 'networking/udhcp/dhcpc.c')
-rw-r--r-- | networking/udhcp/dhcpc.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 2c7608048..717c92c6b 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c | |||
@@ -319,22 +319,22 @@ static void init_packet(struct dhcp_packet *packet, char type) | |||
319 | udhcp_init_header(packet, type); | 319 | udhcp_init_header(packet, type); |
320 | memcpy(packet->chaddr, client_config.client_mac, 6); | 320 | memcpy(packet->chaddr, client_config.client_mac, 6); |
321 | if (client_config.clientid) | 321 | if (client_config.clientid) |
322 | udhcp_add_binary_option(packet->options, client_config.clientid); | 322 | udhcp_add_binary_option(packet, client_config.clientid); |
323 | if (client_config.hostname) | 323 | if (client_config.hostname) |
324 | udhcp_add_binary_option(packet->options, client_config.hostname); | 324 | udhcp_add_binary_option(packet, client_config.hostname); |
325 | if (client_config.fqdn) | 325 | if (client_config.fqdn) |
326 | udhcp_add_binary_option(packet->options, client_config.fqdn); | 326 | udhcp_add_binary_option(packet, client_config.fqdn); |
327 | if (type != DHCPDECLINE | 327 | if (type != DHCPDECLINE |
328 | && type != DHCPRELEASE | 328 | && type != DHCPRELEASE |
329 | && client_config.vendorclass | 329 | && client_config.vendorclass |
330 | ) { | 330 | ) { |
331 | udhcp_add_binary_option(packet->options, client_config.vendorclass); | 331 | udhcp_add_binary_option(packet, client_config.vendorclass); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | 334 | ||
335 | static void add_client_options(struct dhcp_packet *packet) | 335 | static void add_client_options(struct dhcp_packet *packet) |
336 | { | 336 | { |
337 | /* Add am "param req" option with the list of options we'd like to have | 337 | /* Add a "param req" option with the list of options we'd like to have |
338 | * from stubborn DHCP servers. Pull the data from the struct in common.c. | 338 | * from stubborn DHCP servers. Pull the data from the struct in common.c. |
339 | * No bounds checking because it goes towards the head of the packet. */ | 339 | * No bounds checking because it goes towards the head of the packet. */ |
340 | uint8_t c; | 340 | uint8_t c; |
@@ -361,7 +361,7 @@ static void add_client_options(struct dhcp_packet *packet) | |||
361 | { | 361 | { |
362 | struct option_set *curr = client_config.options; | 362 | struct option_set *curr = client_config.options; |
363 | while (curr) { | 363 | while (curr) { |
364 | udhcp_add_binary_option(packet->options, curr->data); | 364 | udhcp_add_binary_option(packet, curr->data); |
365 | curr = curr->next; | 365 | curr = curr->next; |
366 | } | 366 | } |
367 | // if (client_config.sname) | 367 | // if (client_config.sname) |
@@ -405,10 +405,10 @@ static int send_discover(uint32_t xid, uint32_t requested) | |||
405 | init_packet(&packet, DHCPDISCOVER); | 405 | init_packet(&packet, DHCPDISCOVER); |
406 | packet.xid = xid; | 406 | packet.xid = xid; |
407 | if (requested) | 407 | if (requested) |
408 | udhcp_add_simple_option(packet.options, DHCP_REQUESTED_IP, requested); | 408 | udhcp_add_simple_option(&packet, DHCP_REQUESTED_IP, requested); |
409 | /* Explicitly saying that we want RFC-compliant packets helps | 409 | /* Explicitly saying that we want RFC-compliant packets helps |
410 | * some buggy DHCP servers to NOT send bigger packets */ | 410 | * some buggy DHCP servers to NOT send bigger packets */ |
411 | udhcp_add_simple_option(packet.options, DHCP_MAX_SIZE, htons(576)); | 411 | udhcp_add_simple_option(&packet, DHCP_MAX_SIZE, htons(576)); |
412 | add_client_options(&packet); | 412 | add_client_options(&packet); |
413 | 413 | ||
414 | bb_info_msg("Sending discover..."); | 414 | bb_info_msg("Sending discover..."); |
@@ -426,8 +426,8 @@ static int send_select(uint32_t xid, uint32_t server, uint32_t requested) | |||
426 | 426 | ||
427 | init_packet(&packet, DHCPREQUEST); | 427 | init_packet(&packet, DHCPREQUEST); |
428 | packet.xid = xid; | 428 | packet.xid = xid; |
429 | udhcp_add_simple_option(packet.options, DHCP_REQUESTED_IP, requested); | 429 | udhcp_add_simple_option(&packet, DHCP_REQUESTED_IP, requested); |
430 | udhcp_add_simple_option(packet.options, DHCP_SERVER_ID, server); | 430 | udhcp_add_simple_option(&packet, DHCP_SERVER_ID, server); |
431 | add_client_options(&packet); | 431 | add_client_options(&packet); |
432 | 432 | ||
433 | addr.s_addr = requested; | 433 | addr.s_addr = requested; |
@@ -461,8 +461,8 @@ static int send_decline(uint32_t xid, uint32_t server, uint32_t requested) | |||
461 | 461 | ||
462 | init_packet(&packet, DHCPDECLINE); | 462 | init_packet(&packet, DHCPDECLINE); |
463 | packet.xid = xid; | 463 | packet.xid = xid; |
464 | udhcp_add_simple_option(packet.options, DHCP_REQUESTED_IP, requested); | 464 | udhcp_add_simple_option(&packet, DHCP_REQUESTED_IP, requested); |
465 | udhcp_add_simple_option(packet.options, DHCP_SERVER_ID, server); | 465 | udhcp_add_simple_option(&packet, DHCP_SERVER_ID, server); |
466 | 466 | ||
467 | bb_info_msg("Sending decline..."); | 467 | bb_info_msg("Sending decline..."); |
468 | return raw_bcast_from_client_config_ifindex(&packet); | 468 | return raw_bcast_from_client_config_ifindex(&packet); |
@@ -478,7 +478,7 @@ static int send_release(uint32_t server, uint32_t ciaddr) | |||
478 | packet.xid = random_xid(); | 478 | packet.xid = random_xid(); |
479 | packet.ciaddr = ciaddr; | 479 | packet.ciaddr = ciaddr; |
480 | 480 | ||
481 | udhcp_add_simple_option(packet.options, DHCP_SERVER_ID, server); | 481 | udhcp_add_simple_option(&packet, DHCP_SERVER_ID, server); |
482 | 482 | ||
483 | bb_info_msg("Sending release..."); | 483 | bb_info_msg("Sending release..."); |
484 | return udhcp_send_kernel_packet(&packet, ciaddr, CLIENT_PORT, server, SERVER_PORT); | 484 | return udhcp_send_kernel_packet(&packet, ciaddr, CLIENT_PORT, server, SERVER_PORT); |