aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/udhcp/dhcpc.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index f0c8ace2d..7b679d10f 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -362,12 +362,6 @@ static void add_client_options(struct dhcp_packet *packet)
362 int i, end, len; 362 int i, end, len;
363 363
364 udhcp_add_simple_option(packet, DHCP_MAX_SIZE, htons(IP_UDP_DHCP_SIZE)); 364 udhcp_add_simple_option(packet, DHCP_MAX_SIZE, htons(IP_UDP_DHCP_SIZE));
365 if (client_config.hostname)
366 udhcp_add_binary_option(packet, client_config.hostname);
367 if (client_config.fqdn)
368 udhcp_add_binary_option(packet, client_config.fqdn);
369 if (client_config.vendorclass)
370 udhcp_add_binary_option(packet, client_config.vendorclass);
371 365
372 /* Add a "param req" option with the list of options we'd like to have 366 /* Add a "param req" option with the list of options we'd like to have
373 * from stubborn DHCP servers. Pull the data from the struct in common.c. 367 * from stubborn DHCP servers. Pull the data from the struct in common.c.
@@ -390,6 +384,13 @@ static void add_client_options(struct dhcp_packet *packet)
390 packet->options[end + OPT_DATA + len] = DHCP_END; 384 packet->options[end + OPT_DATA + len] = DHCP_END;
391 } 385 }
392 386
387 if (client_config.vendorclass)
388 udhcp_add_binary_option(packet, client_config.vendorclass);
389 if (client_config.hostname)
390 udhcp_add_binary_option(packet, client_config.hostname);
391 if (client_config.fqdn)
392 udhcp_add_binary_option(packet, client_config.fqdn);
393
393 /* Add -x options if any */ 394 /* Add -x options if any */
394 { 395 {
395 struct option_set *curr = client_config.options; 396 struct option_set *curr = client_config.options;
@@ -431,7 +432,7 @@ static int raw_bcast_from_client_config_ifindex(struct dhcp_packet *packet)
431} 432}
432 433
433/* Broadcast a DHCP discover packet to the network, with an optionally requested IP */ 434/* Broadcast a DHCP discover packet to the network, with an optionally requested IP */
434static int send_discover(uint32_t xid, uint32_t requested) 435static NOINLINE int send_discover(uint32_t xid, uint32_t requested)
435{ 436{
436 struct dhcp_packet packet; 437 struct dhcp_packet packet;
437 438
@@ -459,7 +460,7 @@ static int send_discover(uint32_t xid, uint32_t requested)
459/* RFC 2131 3.1 paragraph 3: 460/* RFC 2131 3.1 paragraph 3:
460 * "The client _broadcasts_ a DHCPREQUEST message..." 461 * "The client _broadcasts_ a DHCPREQUEST message..."
461 */ 462 */
462static int send_select(uint32_t xid, uint32_t server, uint32_t requested) 463static NOINLINE int send_select(uint32_t xid, uint32_t server, uint32_t requested)
463{ 464{
464 struct dhcp_packet packet; 465 struct dhcp_packet packet;
465 struct in_addr addr; 466 struct in_addr addr;
@@ -542,7 +543,7 @@ static int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr)
542 543
543#if ENABLE_FEATURE_UDHCPC_ARPING 544#if ENABLE_FEATURE_UDHCPC_ARPING
544/* Broadcast a DHCP decline message */ 545/* Broadcast a DHCP decline message */
545static int send_decline(uint32_t xid, uint32_t server, uint32_t requested) 546static NOINLINE int send_decline(uint32_t xid, uint32_t server, uint32_t requested)
546{ 547{
547 struct dhcp_packet packet; 548 struct dhcp_packet packet;
548 549
@@ -1356,7 +1357,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1356 /* TODO: why we don't just fetch server's IP from IP header? */ 1357 /* TODO: why we don't just fetch server's IP from IP header? */
1357 temp = udhcp_get_option(&packet, DHCP_SERVER_ID); 1358 temp = udhcp_get_option(&packet, DHCP_SERVER_ID);
1358 if (!temp) { 1359 if (!temp) {
1359 bb_error_msg("no server ID in message"); 1360 bb_error_msg("no server ID, ignoring packet");
1360 continue; 1361 continue;
1361 /* still selecting - this server looks bad */ 1362 /* still selecting - this server looks bad */
1362 } 1363 }