diff options
author | Denys Vlasenko | 2021-06-02 15:51:50 +0200 |
---|---|---|
committer | Denys Vlasenko | 2021-06-02 15:51:50 +0200 |
commit | 949e9621d10faada3bb55a4aa206df44e7d39ae8 (patch) | |
tree | 63778eac77dc9b9fb6f30410a581d87f7ae2b707 /networking/udhcp/d6_dhcpc.c | |
parent | 698cdef538f51bb85b68d591b1e42eb6b04d891c (diff) | |
download | busybox-949e9621d10faada3bb55a4aa206df44e7d39ae8.zip busybox-949e9621d10faada3bb55a4aa206df44e7d39ae8.tar.gz |
udhcpc: get rid of client_data.fqdn field
function old new delta
attach_option 253 276 +23
udhcpc_main 2582 2588 +6
udhcpc6_main 2579 2571 -8
add_client_options 175 158 -17
udhcp_insert_new_option 169 138 -31
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/3 up/down: 29/-56) Total: -27 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/udhcp/d6_dhcpc.c')
-rw-r--r-- | networking/udhcp/d6_dhcpc.c | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c index 3fd1fa7..c68dc8c 100644 --- a/networking/udhcp/d6_dhcpc.c +++ b/networking/udhcp/d6_dhcpc.c @@ -1111,17 +1111,6 @@ static void perform_d6_release(struct in6_addr *server_ipv6, struct in6_addr *ou client_data.state = RELEASED; } -///static uint8_t* alloc_dhcp_option(int code, const char *str, int extra) -///{ -/// uint8_t *storage; -/// int len = strnlen(str, 255); -/// storage = xzalloc(len + extra + OPT_DATA); -/// storage[OPT_CODE] = code; -/// storage[OPT_LEN] = len + extra; -/// memcpy(storage + extra + OPT_DATA, str, len); -/// return storage; -///} - #if BB_MMU static void client_background(void) { @@ -1283,23 +1272,24 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv) free(optstr); } - if (d6_read_interface(client_data.interface, - &client_data.ifindex, - &client6_data.ll_ip6, - client_data_client_mac) - ) { - return 1; - } - clientid_mac_ptr = NULL; if (!udhcp_find_option(client_data.options, D6_OPT_CLIENTID)) { /* not set, set the default client ID */ - client_data.clientid[1] = 3; /* DUID-LL */ - client_data.clientid[3] = 1; /* ethernet */ clientid_mac_ptr = udhcp_insert_new_option( &client_data.options, D6_OPT_CLIENTID, - client_data.clientid, 2+2 + 6, /*dhcp6:*/ 1); - clientid_mac_ptr += 2+2 + 2+2; /* skip option code, len, DUID-LL, ethernet */ + 2+2 + 6, /*dhcp6:*/ 1); + clientid_mac_ptr += 2+2; /* skip option code, len */ + clientid_mac_ptr[1] = 3; /* DUID-LL */ + clientid_mac_ptr[3] = 1; /* type: ethernet */ + clientid_mac_ptr += 2+2; /* skip DUID-LL, ethernet */ + } + + if (d6_read_interface(client_data.interface, + &client_data.ifindex, + &client6_data.ll_ip6, + client_data.client_mac) + ) { + return 1; } #if !BB_MMU @@ -1386,13 +1376,13 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv) if (d6_read_interface(client_data.interface, &client_data.ifindex, &client6_data.ll_ip6, - client_data_client_mac) + client_data.client_mac) ) { goto ret0; /* iface is gone? */ } if (clientid_mac_ptr) - memcpy(clientid_mac_ptr, client_data_client_mac, 6); + memcpy(clientid_mac_ptr, client_data.client_mac, 6); switch (client_data.state) { case INIT_SELECTING: |