aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/d6_dhcpc.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-06-02 15:51:50 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-06-02 15:51:50 +0200
commit949e9621d10faada3bb55a4aa206df44e7d39ae8 (patch)
tree63778eac77dc9b9fb6f30410a581d87f7ae2b707 /networking/udhcp/d6_dhcpc.c
parent698cdef538f51bb85b68d591b1e42eb6b04d891c (diff)
downloadbusybox-w32-949e9621d10faada3bb55a4aa206df44e7d39ae8.tar.gz
busybox-w32-949e9621d10faada3bb55a4aa206df44e7d39ae8.tar.bz2
busybox-w32-949e9621d10faada3bb55a4aa206df44e7d39ae8.zip
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.c40
1 files changed, 15 insertions, 25 deletions
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c
index 3fd1fa7ce..c68dc8c4f 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
1111 client_data.state = RELEASED; 1111 client_data.state = RELEASED;
1112} 1112}
1113 1113
1114///static uint8_t* alloc_dhcp_option(int code, const char *str, int extra)
1115///{
1116/// uint8_t *storage;
1117/// int len = strnlen(str, 255);
1118/// storage = xzalloc(len + extra + OPT_DATA);
1119/// storage[OPT_CODE] = code;
1120/// storage[OPT_LEN] = len + extra;
1121/// memcpy(storage + extra + OPT_DATA, str, len);
1122/// return storage;
1123///}
1124
1125#if BB_MMU 1114#if BB_MMU
1126static void client_background(void) 1115static void client_background(void)
1127{ 1116{
@@ -1283,23 +1272,24 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1283 free(optstr); 1272 free(optstr);
1284 } 1273 }
1285 1274
1286 if (d6_read_interface(client_data.interface,
1287 &client_data.ifindex,
1288 &client6_data.ll_ip6,
1289 client_data_client_mac)
1290 ) {
1291 return 1;
1292 }
1293
1294 clientid_mac_ptr = NULL; 1275 clientid_mac_ptr = NULL;
1295 if (!udhcp_find_option(client_data.options, D6_OPT_CLIENTID)) { 1276 if (!udhcp_find_option(client_data.options, D6_OPT_CLIENTID)) {
1296 /* not set, set the default client ID */ 1277 /* not set, set the default client ID */
1297 client_data.clientid[1] = 3; /* DUID-LL */
1298 client_data.clientid[3] = 1; /* ethernet */
1299 clientid_mac_ptr = udhcp_insert_new_option( 1278 clientid_mac_ptr = udhcp_insert_new_option(
1300 &client_data.options, D6_OPT_CLIENTID, 1279 &client_data.options, D6_OPT_CLIENTID,
1301 client_data.clientid, 2+2 + 6, /*dhcp6:*/ 1); 1280 2+2 + 6, /*dhcp6:*/ 1);
1302 clientid_mac_ptr += 2+2 + 2+2; /* skip option code, len, DUID-LL, ethernet */ 1281 clientid_mac_ptr += 2+2; /* skip option code, len */
1282 clientid_mac_ptr[1] = 3; /* DUID-LL */
1283 clientid_mac_ptr[3] = 1; /* type: ethernet */
1284 clientid_mac_ptr += 2+2; /* skip DUID-LL, ethernet */
1285 }
1286
1287 if (d6_read_interface(client_data.interface,
1288 &client_data.ifindex,
1289 &client6_data.ll_ip6,
1290 client_data.client_mac)
1291 ) {
1292 return 1;
1303 } 1293 }
1304 1294
1305#if !BB_MMU 1295#if !BB_MMU
@@ -1386,13 +1376,13 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1386 if (d6_read_interface(client_data.interface, 1376 if (d6_read_interface(client_data.interface,
1387 &client_data.ifindex, 1377 &client_data.ifindex,
1388 &client6_data.ll_ip6, 1378 &client6_data.ll_ip6,
1389 client_data_client_mac) 1379 client_data.client_mac)
1390 ) { 1380 ) {
1391 goto ret0; /* iface is gone? */ 1381 goto ret0; /* iface is gone? */
1392 } 1382 }
1393 1383
1394 if (clientid_mac_ptr) 1384 if (clientid_mac_ptr)
1395 memcpy(clientid_mac_ptr, client_data_client_mac, 6); 1385 memcpy(clientid_mac_ptr, client_data.client_mac, 6);
1396 1386
1397 switch (client_data.state) { 1387 switch (client_data.state) {
1398 case INIT_SELECTING: 1388 case INIT_SELECTING: