aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-05-26 15:01:13 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-05-26 15:03:05 +0200
commitbcb1fc3e6ca6fe902610f507eaf9b0b58a5c583a (patch)
tree7d591d16007a2a162e13b1f601fc33c9115299e8
parent818d9e02f2de87aef3ba72c2b3bcec6eed4ef974 (diff)
downloadbusybox-w32-bcb1fc3e6ca6fe902610f507eaf9b0b58a5c583a.tar.gz
busybox-w32-bcb1fc3e6ca6fe902610f507eaf9b0b58a5c583a.tar.bz2
busybox-w32-bcb1fc3e6ca6fe902610f507eaf9b0b58a5c583a.zip
udhcp: rename client_config to client_data, server_config to server_data
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/udhcp/d6_dhcpc.c152
-rw-r--r--networking/udhcp/dhcpc.c214
-rw-r--r--networking/udhcp/dhcpc.h8
-rw-r--r--networking/udhcp/dhcpd.h2
4 files changed, 188 insertions, 188 deletions
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c
index 1973af99b..15e9f3924 100644
--- a/networking/udhcp/d6_dhcpc.c
+++ b/networking/udhcp/d6_dhcpc.c
@@ -63,7 +63,7 @@
63#include <netpacket/packet.h> 63#include <netpacket/packet.h>
64#include <linux/filter.h> 64#include <linux/filter.h>
65 65
66/* "struct client_config_t client_config" is in bb_common_bufsiz1 */ 66/* "struct client_data_t client_data" is in bb_common_bufsiz1 */
67 67
68static const struct dhcp_optflag d6_optflags[] = { 68static const struct dhcp_optflag d6_optflags[] = {
69#if ENABLE_FEATURE_UDHCPC6_RFC3646 69#if ENABLE_FEATURE_UDHCPC6_RFC3646
@@ -427,7 +427,7 @@ static char **fill_envp(const uint8_t *option, const uint8_t *option_end)
427 client6_data.env_ptr = NULL; 427 client6_data.env_ptr = NULL;
428 client6_data.env_idx = 0; 428 client6_data.env_idx = 0;
429 429
430 *new_env() = xasprintf("interface=%s", client_config.interface); 430 *new_env() = xasprintf("interface=%s", client_data.interface);
431 431
432 if (option) 432 if (option)
433 option_to_env(option, option_end); 433 option_to_env(option, option_end);
@@ -449,8 +449,8 @@ static void d6_run_script(const uint8_t *option, const uint8_t *option_end,
449 envp = fill_envp(option, option_end); 449 envp = fill_envp(option, option_end);
450 450
451 /* call script */ 451 /* call script */
452 log1("executing %s %s", client_config.script, name); 452 log1("executing %s %s", client_data.script, name);
453 argv[0] = (char*) client_config.script; 453 argv[0] = (char*) client_data.script;
454 argv[1] = (char*) name; 454 argv[1] = (char*) name;
455 argv[2] = NULL; 455 argv[2] = NULL;
456 spawn_and_wait(argv); 456 spawn_and_wait(argv);
@@ -486,7 +486,7 @@ static uint8_t *init_d6_packet(struct d6_packet *packet, char type, uint32_t xid
486 packet->d6_xid32 = xid; 486 packet->d6_xid32 = xid;
487 packet->d6_msg_type = type; 487 packet->d6_msg_type = type;
488 488
489 clientid = (void*)client_config.clientid; 489 clientid = (void*)client_data.clientid;
490 return mempcpy(packet->d6_options, clientid, clientid->len + 2+2); 490 return mempcpy(packet->d6_options, clientid, clientid->len + 2+2);
491} 491}
492 492
@@ -499,7 +499,7 @@ static uint8_t *add_d6_client_options(uint8_t *ptr)
499 499
500 ptr += 4; 500 ptr += 4;
501 for (option = 1; option < 256; option++) { 501 for (option = 1; option < 256; option++) {
502 if (client_config.opt_mask[option >> 3] & (1 << (option & 7))) { 502 if (client_data.opt_mask[option >> 3] & (1 << (option & 7))) {
503 ptr[0] = (option >> 8); 503 ptr[0] = (option >> 8);
504 ptr[1] = option; 504 ptr[1] = option;
505 ptr += 2; 505 ptr += 2;
@@ -518,7 +518,7 @@ static uint8_t *add_d6_client_options(uint8_t *ptr)
518 ptr = mempcpy(ptr, &opt_fqdn_req, sizeof(opt_fqdn_req)); 518 ptr = mempcpy(ptr, &opt_fqdn_req, sizeof(opt_fqdn_req));
519#endif 519#endif
520 /* Add -x options if any */ 520 /* Add -x options if any */
521 curr = client_config.options; 521 curr = client_data.options;
522 while (curr) { 522 while (curr) {
523 len = (curr->data[D6_OPT_LEN] << 8) | curr->data[D6_OPT_LEN + 1]; 523 len = (curr->data[D6_OPT_LEN] << 8) | curr->data[D6_OPT_LEN + 1];
524 ptr = mempcpy(ptr, curr->data, D6_OPT_DATA + len); 524 ptr = mempcpy(ptr, curr->data, D6_OPT_DATA + len);
@@ -528,7 +528,7 @@ static uint8_t *add_d6_client_options(uint8_t *ptr)
528 return ptr; 528 return ptr;
529} 529}
530 530
531static int d6_mcast_from_client_config_ifindex(struct d6_packet *packet, uint8_t *end) 531static int d6_mcast_from_client_data_ifindex(struct d6_packet *packet, uint8_t *end)
532{ 532{
533 /* FF02::1:2 is "All_DHCP_Relay_Agents_and_Servers" address */ 533 /* FF02::1:2 is "All_DHCP_Relay_Agents_and_Servers" address */
534 static const uint8_t FF02__1_2[16] = { 534 static const uint8_t FF02__1_2[16] = {
@@ -540,7 +540,7 @@ static int d6_mcast_from_client_config_ifindex(struct d6_packet *packet, uint8_t
540 packet, (end - (uint8_t*) packet), 540 packet, (end - (uint8_t*) packet),
541 /*src*/ &client6_data.ll_ip6, CLIENT_PORT6, 541 /*src*/ &client6_data.ll_ip6, CLIENT_PORT6,
542 /*dst*/ (struct in6_addr*)FF02__1_2, SERVER_PORT6, MAC_BCAST_ADDR, 542 /*dst*/ (struct in6_addr*)FF02__1_2, SERVER_PORT6, MAC_BCAST_ADDR,
543 client_config.ifindex 543 client_data.ifindex
544 ); 544 );
545} 545}
546 546
@@ -671,7 +671,7 @@ static NOINLINE int send_d6_discover(uint32_t xid, struct in6_addr *requested_ip
671 opt_ptr = add_d6_client_options(opt_ptr); 671 opt_ptr = add_d6_client_options(opt_ptr);
672 672
673 bb_info_msg("sending %s", "discover"); 673 bb_info_msg("sending %s", "discover");
674 return d6_mcast_from_client_config_ifindex(&packet, opt_ptr); 674 return d6_mcast_from_client_data_ifindex(&packet, opt_ptr);
675} 675}
676 676
677/* Multicast a DHCPv6 request message 677/* Multicast a DHCPv6 request message
@@ -728,7 +728,7 @@ static NOINLINE int send_d6_select(uint32_t xid)
728 opt_ptr = add_d6_client_options(opt_ptr); 728 opt_ptr = add_d6_client_options(opt_ptr);
729 729
730 bb_info_msg("sending %s", "select"); 730 bb_info_msg("sending %s", "select");
731 return d6_mcast_from_client_config_ifindex(&packet, opt_ptr); 731 return d6_mcast_from_client_data_ifindex(&packet, opt_ptr);
732} 732}
733 733
734/* Unicast or broadcast a DHCP renew message 734/* Unicast or broadcast a DHCP renew message
@@ -806,9 +806,9 @@ static NOINLINE int send_d6_renew(uint32_t xid, struct in6_addr *server_ipv6, st
806 &packet, (opt_ptr - (uint8_t*) &packet), 806 &packet, (opt_ptr - (uint8_t*) &packet),
807 our_cur_ipv6, CLIENT_PORT6, 807 our_cur_ipv6, CLIENT_PORT6,
808 server_ipv6, SERVER_PORT6, 808 server_ipv6, SERVER_PORT6,
809 client_config.ifindex 809 client_data.ifindex
810 ); 810 );
811 return d6_mcast_from_client_config_ifindex(&packet, opt_ptr); 811 return d6_mcast_from_client_data_ifindex(&packet, opt_ptr);
812} 812}
813 813
814/* Unicast a DHCP release message */ 814/* Unicast a DHCP release message */
@@ -835,7 +835,7 @@ int send_d6_release(struct in6_addr *server_ipv6, struct in6_addr *our_cur_ipv6)
835 &packet, (opt_ptr - (uint8_t*) &packet), 835 &packet, (opt_ptr - (uint8_t*) &packet),
836 our_cur_ipv6, CLIENT_PORT6, 836 our_cur_ipv6, CLIENT_PORT6,
837 server_ipv6, SERVER_PORT6, 837 server_ipv6, SERVER_PORT6,
838 client_config.ifindex 838 client_data.ifindex
839 ); 839 );
840} 840}
841 841
@@ -903,12 +903,12 @@ static NOINLINE int d6_recv_raw_packet(struct in6_addr *peer_ipv6, struct d6_pac
903 903
904/*** Main ***/ 904/*** Main ***/
905 905
906/* Values for client_config.listen_mode */ 906/* Values for client_data.listen_mode */
907#define LISTEN_NONE 0 907#define LISTEN_NONE 0
908#define LISTEN_KERNEL 1 908#define LISTEN_KERNEL 1
909#define LISTEN_RAW 2 909#define LISTEN_RAW 2
910 910
911/* Values for client_config.state */ 911/* Values for client_data.state */
912/* initial state: (re)start DHCP negotiation */ 912/* initial state: (re)start DHCP negotiation */
913#define INIT_SELECTING 0 913#define INIT_SELECTING 0
914/* discover was sent, DHCPOFFER reply received */ 914/* discover was sent, DHCPOFFER reply received */
@@ -1016,35 +1016,35 @@ static void change_listen_mode(int new_mode)
1016 : "none" 1016 : "none"
1017 ); 1017 );
1018 1018
1019 client_config.listen_mode = new_mode; 1019 client_data.listen_mode = new_mode;
1020 if (client_config.sockfd >= 0) { 1020 if (client_data.sockfd >= 0) {
1021 close(client_config.sockfd); 1021 close(client_data.sockfd);
1022 client_config.sockfd = -1; 1022 client_data.sockfd = -1;
1023 } 1023 }
1024 if (new_mode == LISTEN_KERNEL) 1024 if (new_mode == LISTEN_KERNEL)
1025 client_config.sockfd = udhcp_listen_socket(/*INADDR_ANY,*/ CLIENT_PORT6, client_config.interface); 1025 client_data.sockfd = udhcp_listen_socket(/*INADDR_ANY,*/ CLIENT_PORT6, client_data.interface);
1026 else if (new_mode != LISTEN_NONE) 1026 else if (new_mode != LISTEN_NONE)
1027 client_config.sockfd = d6_raw_socket(client_config.ifindex); 1027 client_data.sockfd = d6_raw_socket(client_data.ifindex);
1028 /* else LISTEN_NONE: client_config.sockfd stays closed */ 1028 /* else LISTEN_NONE: client_data.sockfd stays closed */
1029} 1029}
1030 1030
1031/* Called only on SIGUSR1 */ 1031/* Called only on SIGUSR1 */
1032static void perform_renew(void) 1032static void perform_renew(void)
1033{ 1033{
1034 bb_info_msg("performing DHCP renew"); 1034 bb_info_msg("performing DHCP renew");
1035 switch (client_config.state) { 1035 switch (client_data.state) {
1036 case BOUND: 1036 case BOUND:
1037 change_listen_mode(LISTEN_KERNEL); 1037 change_listen_mode(LISTEN_KERNEL);
1038 case RENEWING: 1038 case RENEWING:
1039 case REBINDING: 1039 case REBINDING:
1040 client_config.state = RENEW_REQUESTED; 1040 client_data.state = RENEW_REQUESTED;
1041 break; 1041 break;
1042 case RENEW_REQUESTED: /* impatient are we? fine, square 1 */ 1042 case RENEW_REQUESTED: /* impatient are we? fine, square 1 */
1043 d6_run_script_no_option("deconfig"); 1043 d6_run_script_no_option("deconfig");
1044 case REQUESTING: 1044 case REQUESTING:
1045 case RELEASED: 1045 case RELEASED:
1046 change_listen_mode(LISTEN_RAW); 1046 change_listen_mode(LISTEN_RAW);
1047 client_config.state = INIT_SELECTING; 1047 client_data.state = INIT_SELECTING;
1048 break; 1048 break;
1049 case INIT_SELECTING: 1049 case INIT_SELECTING:
1050 break; 1050 break;
@@ -1054,10 +1054,10 @@ static void perform_renew(void)
1054static void perform_d6_release(struct in6_addr *server_ipv6, struct in6_addr *our_cur_ipv6) 1054static void perform_d6_release(struct in6_addr *server_ipv6, struct in6_addr *our_cur_ipv6)
1055{ 1055{
1056 /* send release packet */ 1056 /* send release packet */
1057 if (client_config.state == BOUND 1057 if (client_data.state == BOUND
1058 || client_config.state == RENEWING 1058 || client_data.state == RENEWING
1059 || client_config.state == REBINDING 1059 || client_data.state == REBINDING
1060 || client_config.state == RENEW_REQUESTED 1060 || client_data.state == RENEW_REQUESTED
1061 ) { 1061 ) {
1062 bb_info_msg("unicasting a release"); 1062 bb_info_msg("unicasting a release");
1063 send_d6_release(server_ipv6, our_cur_ipv6); /* unicast */ 1063 send_d6_release(server_ipv6, our_cur_ipv6); /* unicast */
@@ -1071,7 +1071,7 @@ static void perform_d6_release(struct in6_addr *server_ipv6, struct in6_addr *ou
1071 */ 1071 */
1072 d6_run_script_no_option("deconfig"); 1072 d6_run_script_no_option("deconfig");
1073 change_listen_mode(LISTEN_NONE); 1073 change_listen_mode(LISTEN_NONE);
1074 client_config.state = RELEASED; 1074 client_data.state = RELEASED;
1075} 1075}
1076 1076
1077///static uint8_t* alloc_dhcp_option(int code, const char *str, int extra) 1077///static uint8_t* alloc_dhcp_option(int code, const char *str, int extra)
@@ -1091,7 +1091,7 @@ static void client_background(void)
1091 bb_daemonize(0); 1091 bb_daemonize(0);
1092 logmode &= ~LOGMODE_STDIO; 1092 logmode &= ~LOGMODE_STDIO;
1093 /* rewrite pidfile, as our pid is different now */ 1093 /* rewrite pidfile, as our pid is different now */
1094 write_pidfile(client_config.pidfile); 1094 write_pidfile(client_data.pidfile);
1095} 1095}
1096#endif 1096#endif
1097 1097
@@ -1170,9 +1170,9 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1170 /* Default options */ 1170 /* Default options */
1171 IF_FEATURE_UDHCP_PORT(SERVER_PORT6 = 547;) 1171 IF_FEATURE_UDHCP_PORT(SERVER_PORT6 = 547;)
1172 IF_FEATURE_UDHCP_PORT(CLIENT_PORT6 = 546;) 1172 IF_FEATURE_UDHCP_PORT(CLIENT_PORT6 = 546;)
1173 client_config.interface = "eth0"; 1173 client_data.interface = "eth0";
1174 client_config.script = CONFIG_UDHCPC_DEFAULT_SCRIPT; 1174 client_data.script = CONFIG_UDHCPC_DEFAULT_SCRIPT;
1175 client_config.sockfd = -1; 1175 client_data.sockfd = -1;
1176 1176
1177 /* Parse command line */ 1177 /* Parse command line */
1178 opt = getopt32long(argv, "^" 1178 opt = getopt32long(argv, "^"
@@ -1184,8 +1184,8 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1184 "v" 1184 "v"
1185 "\0" IF_UDHCP_VERBOSE("vv") /* -v is a counter */ 1185 "\0" IF_UDHCP_VERBOSE("vv") /* -v is a counter */
1186 , udhcpc6_longopts 1186 , udhcpc6_longopts
1187 , &client_config.interface, &client_config.pidfile, &str_r /* i,p */ 1187 , &client_data.interface, &client_data.pidfile, &str_r /* i,p */
1188 , &client_config.script /* s */ 1188 , &client_data.script /* s */
1189 , &discover_timeout, &discover_retries, &tryagain_timeout /* T,t,A */ 1189 , &discover_timeout, &discover_retries, &tryagain_timeout /* T,t,A */
1190 , &list_O 1190 , &list_O
1191 , &list_x 1191 , &list_x
@@ -1216,29 +1216,29 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1216 n = udhcp_option_idx(optstr, d6_option_strings); 1216 n = udhcp_option_idx(optstr, d6_option_strings);
1217 n = d6_optflags[n].code; 1217 n = d6_optflags[n].code;
1218 } 1218 }
1219 client_config.opt_mask[n >> 3] |= 1 << (n & 7); 1219 client_data.opt_mask[n >> 3] |= 1 << (n & 7);
1220 } 1220 }
1221 if (!(opt & OPT_o)) { 1221 if (!(opt & OPT_o)) {
1222 unsigned i, n; 1222 unsigned i, n;
1223 for (i = 0; (n = d6_optflags[i].code) != 0; i++) { 1223 for (i = 0; (n = d6_optflags[i].code) != 0; i++) {
1224 if (d6_optflags[i].flags & OPTION_REQ) { 1224 if (d6_optflags[i].flags & OPTION_REQ) {
1225 client_config.opt_mask[n >> 3] |= 1 << (n & 7); 1225 client_data.opt_mask[n >> 3] |= 1 << (n & 7);
1226 } 1226 }
1227 } 1227 }
1228 } 1228 }
1229 while (list_x) { 1229 while (list_x) {
1230 char *optstr = xstrdup(llist_pop(&list_x)); 1230 char *optstr = xstrdup(llist_pop(&list_x));
1231 udhcp_str2optset(optstr, &client_config.options, 1231 udhcp_str2optset(optstr, &client_data.options,
1232 d6_optflags, d6_option_strings, 1232 d6_optflags, d6_option_strings,
1233 /*dhcpv6:*/ 1 1233 /*dhcpv6:*/ 1
1234 ); 1234 );
1235 free(optstr); 1235 free(optstr);
1236 } 1236 }
1237 1237
1238 if (d6_read_interface(client_config.interface, 1238 if (d6_read_interface(client_data.interface,
1239 &client_config.ifindex, 1239 &client_data.ifindex,
1240 &client6_data.ll_ip6, 1240 &client6_data.ll_ip6,
1241 client_config.client_mac) 1241 client_data.client_mac)
1242 ) { 1242 ) {
1243 return 1; 1243 return 1;
1244 } 1244 }
@@ -1252,8 +1252,8 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1252 clientid->data[1] = 3; /* DUID-LL */ 1252 clientid->data[1] = 3; /* DUID-LL */
1253 clientid->data[3] = 1; /* ethernet */ 1253 clientid->data[3] = 1; /* ethernet */
1254 clientid_mac_ptr = clientid->data + 2+2; 1254 clientid_mac_ptr = clientid->data + 2+2;
1255 memcpy(clientid_mac_ptr, client_config.client_mac, 6); 1255 memcpy(clientid_mac_ptr, client_data.client_mac, 6);
1256 client_config.clientid = (void*)clientid; 1256 client_data.clientid = (void*)clientid;
1257 } 1257 }
1258 1258
1259#if !BB_MMU 1259#if !BB_MMU
@@ -1271,13 +1271,13 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1271 /* Make sure fd 0,1,2 are open */ 1271 /* Make sure fd 0,1,2 are open */
1272 bb_sanitize_stdio(); 1272 bb_sanitize_stdio();
1273 /* Create pidfile */ 1273 /* Create pidfile */
1274 write_pidfile(client_config.pidfile); 1274 write_pidfile(client_data.pidfile);
1275 /* Goes to stdout (unless NOMMU) and possibly syslog */ 1275 /* Goes to stdout (unless NOMMU) and possibly syslog */
1276 bb_info_msg("started, v"BB_VER); 1276 bb_info_msg("started, v"BB_VER);
1277 /* Set up the signal pipe */ 1277 /* Set up the signal pipe */
1278 udhcp_sp_setup(); 1278 udhcp_sp_setup();
1279 1279
1280 client_config.state = INIT_SELECTING; 1280 client_data.state = INIT_SELECTING;
1281 d6_run_script_no_option("deconfig"); 1281 d6_run_script_no_option("deconfig");
1282 change_listen_mode(LISTEN_RAW); 1282 change_listen_mode(LISTEN_RAW);
1283 packet_num = 0; 1283 packet_num = 0;
@@ -1296,16 +1296,16 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1296 /* silence "uninitialized!" warning */ 1296 /* silence "uninitialized!" warning */
1297 unsigned timestamp_before_wait = timestamp_before_wait; 1297 unsigned timestamp_before_wait = timestamp_before_wait;
1298 1298
1299 //bb_error_msg("sockfd:%d, listen_mode:%d", client_config.sockfd, client_config.listen_mode); 1299 //bb_error_msg("sockfd:%d, listen_mode:%d", client_data.sockfd, client_data.listen_mode);
1300 1300
1301 /* Was opening raw or udp socket here 1301 /* Was opening raw or udp socket here
1302 * if (client_config.listen_mode != LISTEN_NONE && client_config.sockfd < 0), 1302 * if (client_data.listen_mode != LISTEN_NONE && client_data.sockfd < 0),
1303 * but on fast network renew responses return faster 1303 * but on fast network renew responses return faster
1304 * than we open sockets. Thus this code is moved 1304 * than we open sockets. Thus this code is moved
1305 * to change_listen_mode(). Thus we open listen socket 1305 * to change_listen_mode(). Thus we open listen socket
1306 * BEFORE we send renew request (see "case BOUND:"). */ 1306 * BEFORE we send renew request (see "case BOUND:"). */
1307 1307
1308 udhcp_sp_fd_set(pfds, client_config.sockfd); 1308 udhcp_sp_fd_set(pfds, client_data.sockfd);
1309 1309
1310 tv = timeout - already_waited_sec; 1310 tv = timeout - already_waited_sec;
1311 retval = 0; 1311 retval = 0;
@@ -1334,20 +1334,20 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1334 * or if the status of the bridge changed). 1334 * or if the status of the bridge changed).
1335 * Refresh ifindex and client_mac: 1335 * Refresh ifindex and client_mac:
1336 */ 1336 */
1337 if (d6_read_interface(client_config.interface, 1337 if (d6_read_interface(client_data.interface,
1338 &client_config.ifindex, 1338 &client_data.ifindex,
1339 &client6_data.ll_ip6, 1339 &client6_data.ll_ip6,
1340 client_config.client_mac) 1340 client_data.client_mac)
1341 ) { 1341 ) {
1342 goto ret0; /* iface is gone? */ 1342 goto ret0; /* iface is gone? */
1343 } 1343 }
1344 1344
1345 memcpy(clientid_mac_ptr, client_config.client_mac, 6); 1345 memcpy(clientid_mac_ptr, client_data.client_mac, 6);
1346 1346
1347 /* We will restart the wait in any case */ 1347 /* We will restart the wait in any case */
1348 already_waited_sec = 0; 1348 already_waited_sec = 0;
1349 1349
1350 switch (client_config.state) { 1350 switch (client_data.state) {
1351 case INIT_SELECTING: 1351 case INIT_SELECTING:
1352 if (!discover_retries || packet_num < discover_retries) { 1352 if (!discover_retries || packet_num < discover_retries) {
1353 if (packet_num == 0) 1353 if (packet_num == 0)
@@ -1396,12 +1396,12 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1396 * were seen in the wild. Treat them similarly 1396 * were seen in the wild. Treat them similarly
1397 * to "no response to discover" case */ 1397 * to "no response to discover" case */
1398 change_listen_mode(LISTEN_RAW); 1398 change_listen_mode(LISTEN_RAW);
1399 client_config.state = INIT_SELECTING; 1399 client_data.state = INIT_SELECTING;
1400 goto leasefail; 1400 goto leasefail;
1401 case BOUND: 1401 case BOUND:
1402 /* 1/2 lease passed, enter renewing state */ 1402 /* 1/2 lease passed, enter renewing state */
1403 client_config.state = RENEWING; 1403 client_data.state = RENEWING;
1404 client_config.first_secs = 0; /* make secs field count from 0 */ 1404 client_data.first_secs = 0; /* make secs field count from 0 */
1405 change_listen_mode(LISTEN_KERNEL); 1405 change_listen_mode(LISTEN_KERNEL);
1406 log1("entering renew state"); 1406 log1("entering renew state");
1407 /* fall right through */ 1407 /* fall right through */
@@ -1424,7 +1424,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1424 } 1424 }
1425 /* Timed out, enter rebinding state */ 1425 /* Timed out, enter rebinding state */
1426 log1("entering rebinding state"); 1426 log1("entering rebinding state");
1427 client_config.state = REBINDING; 1427 client_data.state = REBINDING;
1428 /* fall right through */ 1428 /* fall right through */
1429 case REBINDING: 1429 case REBINDING:
1430 /* Switch to bcast receive */ 1430 /* Switch to bcast receive */
@@ -1440,8 +1440,8 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1440 /* Timed out, enter init state */ 1440 /* Timed out, enter init state */
1441 bb_info_msg("lease lost, entering init state"); 1441 bb_info_msg("lease lost, entering init state");
1442 d6_run_script_no_option("deconfig"); 1442 d6_run_script_no_option("deconfig");
1443 client_config.state = INIT_SELECTING; 1443 client_data.state = INIT_SELECTING;
1444 client_config.first_secs = 0; /* make secs field count from 0 */ 1444 client_data.first_secs = 0; /* make secs field count from 0 */
1445 /*timeout = 0; - already is */ 1445 /*timeout = 0; - already is */
1446 packet_num = 0; 1446 packet_num = 0;
1447 continue; 1447 continue;
@@ -1457,10 +1457,10 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1457 /* Is it a signal? */ 1457 /* Is it a signal? */
1458 switch (udhcp_sp_read()) { 1458 switch (udhcp_sp_read()) {
1459 case SIGUSR1: 1459 case SIGUSR1:
1460 client_config.first_secs = 0; /* make secs field count from 0 */ 1460 client_data.first_secs = 0; /* make secs field count from 0 */
1461 already_waited_sec = 0; 1461 already_waited_sec = 0;
1462 perform_renew(); 1462 perform_renew();
1463 if (client_config.state == RENEW_REQUESTED) { 1463 if (client_data.state == RENEW_REQUESTED) {
1464 /* We might be either on the same network 1464 /* We might be either on the same network
1465 * (in which case renew might work), 1465 * (in which case renew might work),
1466 * or we might be on a completely different one 1466 * or we might be on a completely different one
@@ -1495,15 +1495,15 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1495 int len; 1495 int len;
1496 1496
1497 /* A packet is ready, read it */ 1497 /* A packet is ready, read it */
1498 if (client_config.listen_mode == LISTEN_KERNEL) 1498 if (client_data.listen_mode == LISTEN_KERNEL)
1499 len = d6_recv_kernel_packet(&srv6_buf, &packet, client_config.sockfd); 1499 len = d6_recv_kernel_packet(&srv6_buf, &packet, client_data.sockfd);
1500 else 1500 else
1501 len = d6_recv_raw_packet(&srv6_buf, &packet, client_config.sockfd); 1501 len = d6_recv_raw_packet(&srv6_buf, &packet, client_data.sockfd);
1502 if (len == -1) { 1502 if (len == -1) {
1503 /* Error is severe, reopen socket */ 1503 /* Error is severe, reopen socket */
1504 bb_error_msg("read error: "STRERROR_FMT", reopening socket" STRERROR_ERRNO); 1504 bb_error_msg("read error: "STRERROR_FMT", reopening socket" STRERROR_ERRNO);
1505 sleep(discover_timeout); /* 3 seconds by default */ 1505 sleep(discover_timeout); /* 3 seconds by default */
1506 change_listen_mode(client_config.listen_mode); /* just close and reopen */ 1506 change_listen_mode(client_data.listen_mode); /* just close and reopen */
1507 } 1507 }
1508 /* If this packet will turn out to be unrelated/bogus, 1508 /* If this packet will turn out to be unrelated/bogus,
1509 * we will go back and wait for next one. 1509 * we will go back and wait for next one.
@@ -1520,7 +1520,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1520 continue; 1520 continue;
1521 } 1521 }
1522 1522
1523 switch (client_config.state) { 1523 switch (client_data.state) {
1524 case INIT_SELECTING: 1524 case INIT_SELECTING:
1525 if (packet.d6_msg_type == D6_MSG_ADVERTISE) 1525 if (packet.d6_msg_type == D6_MSG_ADVERTISE)
1526 goto type_is_ok; 1526 goto type_is_ok;
@@ -1546,12 +1546,12 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1546 bb_info_msg("received DHCP NAK (%u)", option->data[4]); 1546 bb_info_msg("received DHCP NAK (%u)", option->data[4]);
1547 d6_run_script(packet.d6_options, 1547 d6_run_script(packet.d6_options,
1548 packet_end, "nak"); 1548 packet_end, "nak");
1549 if (client_config.state != REQUESTING) 1549 if (client_data.state != REQUESTING)
1550 d6_run_script_no_option("deconfig"); 1550 d6_run_script_no_option("deconfig");
1551 change_listen_mode(LISTEN_RAW); 1551 change_listen_mode(LISTEN_RAW);
1552 sleep(3); /* avoid excessive network traffic */ 1552 sleep(3); /* avoid excessive network traffic */
1553 client_config.state = INIT_SELECTING; 1553 client_data.state = INIT_SELECTING;
1554 client_config.first_secs = 0; /* make secs field count from 0 */ 1554 client_data.first_secs = 0; /* make secs field count from 0 */
1555 requested_ipv6 = NULL; 1555 requested_ipv6 = NULL;
1556 timeout = 0; 1556 timeout = 0;
1557 packet_num = 0; 1557 packet_num = 0;
@@ -1571,7 +1571,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1571 client6_data.server_id = option; 1571 client6_data.server_id = option;
1572 if (packet.d6_msg_type == D6_MSG_ADVERTISE) { 1572 if (packet.d6_msg_type == D6_MSG_ADVERTISE) {
1573 /* enter requesting state */ 1573 /* enter requesting state */
1574 client_config.state = REQUESTING; 1574 client_data.state = REQUESTING;
1575 timeout = 0; 1575 timeout = 0;
1576 packet_num = 0; 1576 packet_num = 0;
1577 already_waited_sec = 0; 1577 already_waited_sec = 0;
@@ -1746,9 +1746,9 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1746 timeout = 61; 1746 timeout = 61;
1747 /* enter bound state */ 1747 /* enter bound state */
1748 d6_run_script(packet.d6_options, packet_end, 1748 d6_run_script(packet.d6_options, packet_end,
1749 (client_config.state == REQUESTING ? "bound" : "renew")); 1749 (client_data.state == REQUESTING ? "bound" : "renew"));
1750 1750
1751 client_config.state = BOUND; 1751 client_data.state = BOUND;
1752 change_listen_mode(LISTEN_NONE); 1752 change_listen_mode(LISTEN_NONE);
1753 if (opt & OPT_q) { /* quit after lease */ 1753 if (opt & OPT_q) { /* quit after lease */
1754 goto ret0; 1754 goto ret0;
@@ -1777,7 +1777,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1777 perform_d6_release(&srv6_buf, requested_ipv6); 1777 perform_d6_release(&srv6_buf, requested_ipv6);
1778 retval = 0; 1778 retval = 0;
1779 ret: 1779 ret:
1780 /*if (client_config.pidfile) - remove_pidfile has its own check */ 1780 /*if (client_data.pidfile) - remove_pidfile has its own check */
1781 remove_pidfile(client_config.pidfile); 1781 remove_pidfile(client_data.pidfile);
1782 return retval; 1782 return retval;
1783} 1783}
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 7b1b23706..cb85fa9e3 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -49,7 +49,7 @@ struct tpacket_auxdata {
49#endif 49#endif
50 50
51 51
52/* "struct client_config_t client_config" is in bb_common_bufsiz1 */ 52/* "struct client_data_t client_data" is in bb_common_bufsiz1 */
53 53
54 54
55#if ENABLE_LONG_OPTS 55#if ENABLE_LONG_OPTS
@@ -477,7 +477,7 @@ static char **fill_envp(struct dhcp_packet *packet)
477 } 477 }
478 curr = envp = xzalloc(sizeof(envp[0]) * envc); 478 curr = envp = xzalloc(sizeof(envp[0]) * envc);
479 479
480 *curr = xasprintf("interface=%s", client_config.interface); 480 *curr = xasprintf("interface=%s", client_data.interface);
481 putenv(*curr++); 481 putenv(*curr++);
482 482
483 if (!packet) 483 if (!packet)
@@ -577,8 +577,8 @@ static void udhcp_run_script(struct dhcp_packet *packet, const char *name)
577 envp = fill_envp(packet); 577 envp = fill_envp(packet);
578 578
579 /* call script */ 579 /* call script */
580 log1("executing %s %s", client_config.script, name); 580 log1("executing %s %s", client_data.script, name);
581 argv[0] = (char*) client_config.script; 581 argv[0] = (char*) client_data.script;
582 argv[1] = (char*) name; 582 argv[1] = (char*) name;
583 argv[2] = NULL; 583 argv[2] = NULL;
584 spawn_and_wait(argv); 584 spawn_and_wait(argv);
@@ -608,15 +608,15 @@ static void init_packet(struct dhcp_packet *packet, char type)
608 608
609 packet->xid = random_xid(); 609 packet->xid = random_xid();
610 610
611 client_config.last_secs = monotonic_sec(); 611 client_data.last_secs = monotonic_sec();
612 if (client_config.first_secs == 0) 612 if (client_data.first_secs == 0)
613 client_config.first_secs = client_config.last_secs; 613 client_data.first_secs = client_data.last_secs;
614 secs = client_config.last_secs - client_config.first_secs; 614 secs = client_data.last_secs - client_data.first_secs;
615 packet->secs = htons(secs); 615 packet->secs = htons(secs);
616 616
617 memcpy(packet->chaddr, client_config.client_mac, 6); 617 memcpy(packet->chaddr, client_data.client_mac, 6);
618 if (client_config.clientid) 618 if (client_data.clientid)
619 udhcp_add_binary_option(packet, client_config.clientid); 619 udhcp_add_binary_option(packet, client_data.clientid);
620} 620}
621 621
622static void add_client_options(struct dhcp_packet *packet) 622static void add_client_options(struct dhcp_packet *packet)
@@ -631,7 +631,7 @@ static void add_client_options(struct dhcp_packet *packet)
631 end = udhcp_end_option(packet->options); 631 end = udhcp_end_option(packet->options);
632 len = 0; 632 len = 0;
633 for (i = 1; i < DHCP_END; i++) { 633 for (i = 1; i < DHCP_END; i++) {
634 if (client_config.opt_mask[i >> 3] & (1 << (i & 7))) { 634 if (client_data.opt_mask[i >> 3] & (1 << (i & 7))) {
635 packet->options[end + OPT_DATA + len] = i; 635 packet->options[end + OPT_DATA + len] = i;
636 len++; 636 len++;
637 } 637 }
@@ -642,12 +642,12 @@ static void add_client_options(struct dhcp_packet *packet)
642 packet->options[end + OPT_DATA + len] = DHCP_END; 642 packet->options[end + OPT_DATA + len] = DHCP_END;
643 } 643 }
644 644
645 if (client_config.vendorclass) 645 if (client_data.vendorclass)
646 udhcp_add_binary_option(packet, client_config.vendorclass); 646 udhcp_add_binary_option(packet, client_data.vendorclass);
647 if (client_config.hostname) 647 if (client_data.hostname)
648 udhcp_add_binary_option(packet, client_config.hostname); 648 udhcp_add_binary_option(packet, client_data.hostname);
649 if (client_config.fqdn) 649 if (client_data.fqdn)
650 udhcp_add_binary_option(packet, client_config.fqdn); 650 udhcp_add_binary_option(packet, client_data.fqdn);
651 651
652 /* Request broadcast replies if we have no IP addr */ 652 /* Request broadcast replies if we have no IP addr */
653 if ((option_mask32 & OPT_B) && packet->ciaddr == 0) 653 if ((option_mask32 & OPT_B) && packet->ciaddr == 0)
@@ -655,15 +655,15 @@ static void add_client_options(struct dhcp_packet *packet)
655 655
656 /* Add -x options if any */ 656 /* Add -x options if any */
657 { 657 {
658 struct option_set *curr = client_config.options; 658 struct option_set *curr = client_data.options;
659 while (curr) { 659 while (curr) {
660 udhcp_add_binary_option(packet, curr->data); 660 udhcp_add_binary_option(packet, curr->data);
661 curr = curr->next; 661 curr = curr->next;
662 } 662 }
663// if (client_config.sname) 663// if (client_data.sname)
664// strncpy((char*)packet->sname, client_config.sname, sizeof(packet->sname) - 1); 664// strncpy((char*)packet->sname, client_data.sname, sizeof(packet->sname) - 1);
665// if (client_config.boot_file) 665// if (client_data.boot_file)
666// strncpy((char*)packet->file, client_config.boot_file, sizeof(packet->file) - 1); 666// strncpy((char*)packet->file, client_data.boot_file, sizeof(packet->file) - 1);
667 } 667 }
668 668
669 // This will be needed if we remove -V VENDOR_STR in favor of 669 // This will be needed if we remove -V VENDOR_STR in favor of
@@ -691,12 +691,12 @@ static void add_client_options(struct dhcp_packet *packet)
691 * client reverts to using the IP broadcast address. 691 * client reverts to using the IP broadcast address.
692 */ 692 */
693 693
694static int raw_bcast_from_client_config_ifindex(struct dhcp_packet *packet, uint32_t src_nip) 694static int raw_bcast_from_client_data_ifindex(struct dhcp_packet *packet, uint32_t src_nip)
695{ 695{
696 return udhcp_send_raw_packet(packet, 696 return udhcp_send_raw_packet(packet,
697 /*src*/ src_nip, CLIENT_PORT, 697 /*src*/ src_nip, CLIENT_PORT,
698 /*dst*/ INADDR_BROADCAST, SERVER_PORT, MAC_BCAST_ADDR, 698 /*dst*/ INADDR_BROADCAST, SERVER_PORT, MAC_BCAST_ADDR,
699 client_config.ifindex); 699 client_data.ifindex);
700} 700}
701 701
702static int bcast_or_ucast(struct dhcp_packet *packet, uint32_t ciaddr, uint32_t server) 702static int bcast_or_ucast(struct dhcp_packet *packet, uint32_t ciaddr, uint32_t server)
@@ -705,7 +705,7 @@ static int bcast_or_ucast(struct dhcp_packet *packet, uint32_t ciaddr, uint32_t
705 return udhcp_send_kernel_packet(packet, 705 return udhcp_send_kernel_packet(packet,
706 ciaddr, CLIENT_PORT, 706 ciaddr, CLIENT_PORT,
707 server, SERVER_PORT); 707 server, SERVER_PORT);
708 return raw_bcast_from_client_config_ifindex(packet, ciaddr); 708 return raw_bcast_from_client_data_ifindex(packet, ciaddr);
709} 709}
710 710
711/* Broadcast a DHCP discover packet to the network, with an optionally requested IP */ 711/* Broadcast a DHCP discover packet to the network, with an optionally requested IP */
@@ -731,7 +731,7 @@ static NOINLINE int send_discover(uint32_t xid, uint32_t requested)
731 add_client_options(&packet); 731 add_client_options(&packet);
732 732
733 bb_info_msg("sending %s", "discover"); 733 bb_info_msg("sending %s", "discover");
734 return raw_bcast_from_client_config_ifindex(&packet, INADDR_ANY); 734 return raw_bcast_from_client_data_ifindex(&packet, INADDR_ANY);
735} 735}
736 736
737/* Broadcast a DHCP request message */ 737/* Broadcast a DHCP request message */
@@ -775,7 +775,7 @@ static NOINLINE int send_select(uint32_t xid, uint32_t server, uint32_t requeste
775 775
776 temp_addr.s_addr = requested; 776 temp_addr.s_addr = requested;
777 bb_info_msg("sending select for %s", inet_ntoa(temp_addr)); 777 bb_info_msg("sending select for %s", inet_ntoa(temp_addr));
778 return raw_bcast_from_client_config_ifindex(&packet, INADDR_ANY); 778 return raw_bcast_from_client_data_ifindex(&packet, INADDR_ANY);
779} 779}
780 780
781/* Unicast or broadcast a DHCP renew message */ 781/* Unicast or broadcast a DHCP renew message */
@@ -845,7 +845,7 @@ static NOINLINE int send_decline(/*uint32_t xid,*/ uint32_t server, uint32_t req
845 udhcp_add_simple_option(&packet, DHCP_SERVER_ID, server); 845 udhcp_add_simple_option(&packet, DHCP_SERVER_ID, server);
846 846
847 bb_info_msg("sending %s", "decline"); 847 bb_info_msg("sending %s", "decline");
848 return raw_bcast_from_client_config_ifindex(&packet, INADDR_ANY); 848 return raw_bcast_from_client_data_ifindex(&packet, INADDR_ANY);
849} 849}
850#endif 850#endif
851 851
@@ -984,12 +984,12 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
984 984
985/*** Main ***/ 985/*** Main ***/
986 986
987/* Values for client_config.listen_mode */ 987/* Values for client_data.listen_mode */
988#define LISTEN_NONE 0 988#define LISTEN_NONE 0
989#define LISTEN_KERNEL 1 989#define LISTEN_KERNEL 1
990#define LISTEN_RAW 2 990#define LISTEN_RAW 2
991 991
992/* Values for client_config.state */ 992/* Values for client_data.state */
993/* initial state: (re)start DHCP negotiation */ 993/* initial state: (re)start DHCP negotiation */
994#define INIT_SELECTING 0 994#define INIT_SELECTING 0
995/* discover was sent, DHCPOFFER reply received */ 995/* discover was sent, DHCPOFFER reply received */
@@ -1100,35 +1100,35 @@ static void change_listen_mode(int new_mode)
1100 : "none" 1100 : "none"
1101 ); 1101 );
1102 1102
1103 client_config.listen_mode = new_mode; 1103 client_data.listen_mode = new_mode;
1104 if (client_config.sockfd >= 0) { 1104 if (client_data.sockfd >= 0) {
1105 close(client_config.sockfd); 1105 close(client_data.sockfd);
1106 client_config.sockfd = -1; 1106 client_data.sockfd = -1;
1107 } 1107 }
1108 if (new_mode == LISTEN_KERNEL) 1108 if (new_mode == LISTEN_KERNEL)
1109 client_config.sockfd = udhcp_listen_socket(/*INADDR_ANY,*/ CLIENT_PORT, client_config.interface); 1109 client_data.sockfd = udhcp_listen_socket(/*INADDR_ANY,*/ CLIENT_PORT, client_data.interface);
1110 else if (new_mode != LISTEN_NONE) 1110 else if (new_mode != LISTEN_NONE)
1111 client_config.sockfd = udhcp_raw_socket(client_config.ifindex); 1111 client_data.sockfd = udhcp_raw_socket(client_data.ifindex);
1112 /* else LISTEN_NONE: client_config.sockfd stays closed */ 1112 /* else LISTEN_NONE: client_data.sockfd stays closed */
1113} 1113}
1114 1114
1115/* Called only on SIGUSR1 */ 1115/* Called only on SIGUSR1 */
1116static void perform_renew(void) 1116static void perform_renew(void)
1117{ 1117{
1118 bb_info_msg("performing DHCP renew"); 1118 bb_info_msg("performing DHCP renew");
1119 switch (client_config.state) { 1119 switch (client_data.state) {
1120 case BOUND: 1120 case BOUND:
1121 change_listen_mode(LISTEN_KERNEL); 1121 change_listen_mode(LISTEN_KERNEL);
1122 case RENEWING: 1122 case RENEWING:
1123 case REBINDING: 1123 case REBINDING:
1124 client_config.state = RENEW_REQUESTED; 1124 client_data.state = RENEW_REQUESTED;
1125 break; 1125 break;
1126 case RENEW_REQUESTED: /* impatient are we? fine, square 1 */ 1126 case RENEW_REQUESTED: /* impatient are we? fine, square 1 */
1127 udhcp_run_script(NULL, "deconfig"); 1127 udhcp_run_script(NULL, "deconfig");
1128 case REQUESTING: 1128 case REQUESTING:
1129 case RELEASED: 1129 case RELEASED:
1130 change_listen_mode(LISTEN_RAW); 1130 change_listen_mode(LISTEN_RAW);
1131 client_config.state = INIT_SELECTING; 1131 client_data.state = INIT_SELECTING;
1132 break; 1132 break;
1133 case INIT_SELECTING: 1133 case INIT_SELECTING:
1134 break; 1134 break;
@@ -1141,10 +1141,10 @@ static void perform_release(uint32_t server_addr, uint32_t requested_ip)
1141 struct in_addr temp_addr; 1141 struct in_addr temp_addr;
1142 1142
1143 /* send release packet */ 1143 /* send release packet */
1144 if (client_config.state == BOUND 1144 if (client_data.state == BOUND
1145 || client_config.state == RENEWING 1145 || client_data.state == RENEWING
1146 || client_config.state == REBINDING 1146 || client_data.state == REBINDING
1147 || client_config.state == RENEW_REQUESTED 1147 || client_data.state == RENEW_REQUESTED
1148 ) { 1148 ) {
1149 temp_addr.s_addr = server_addr; 1149 temp_addr.s_addr = server_addr;
1150 strcpy(buffer, inet_ntoa(temp_addr)); 1150 strcpy(buffer, inet_ntoa(temp_addr));
@@ -1163,7 +1163,7 @@ static void perform_release(uint32_t server_addr, uint32_t requested_ip)
1163 udhcp_run_script(NULL, "deconfig"); 1163 udhcp_run_script(NULL, "deconfig");
1164 1164
1165 change_listen_mode(LISTEN_NONE); 1165 change_listen_mode(LISTEN_NONE);
1166 client_config.state = RELEASED; 1166 client_data.state = RELEASED;
1167} 1167}
1168 1168
1169static uint8_t* alloc_dhcp_option(int code, const char *str, int extra) 1169static uint8_t* alloc_dhcp_option(int code, const char *str, int extra)
@@ -1183,7 +1183,7 @@ static void client_background(void)
1183 bb_daemonize(0); 1183 bb_daemonize(0);
1184 logmode &= ~LOGMODE_STDIO; 1184 logmode &= ~LOGMODE_STDIO;
1185 /* rewrite pidfile, as our pid is different now */ 1185 /* rewrite pidfile, as our pid is different now */
1186 write_pidfile(client_config.pidfile); 1186 write_pidfile(client_data.pidfile);
1187} 1187}
1188#endif 1188#endif
1189 1189
@@ -1266,9 +1266,9 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1266 /* Default options */ 1266 /* Default options */
1267 IF_FEATURE_UDHCP_PORT(SERVER_PORT = 67;) 1267 IF_FEATURE_UDHCP_PORT(SERVER_PORT = 67;)
1268 IF_FEATURE_UDHCP_PORT(CLIENT_PORT = 68;) 1268 IF_FEATURE_UDHCP_PORT(CLIENT_PORT = 68;)
1269 client_config.interface = "eth0"; 1269 client_data.interface = "eth0";
1270 client_config.script = CONFIG_UDHCPC_DEFAULT_SCRIPT; 1270 client_data.script = CONFIG_UDHCPC_DEFAULT_SCRIPT;
1271 client_config.sockfd = -1; 1271 client_data.sockfd = -1;
1272 str_V = "udhcp "BB_VER; 1272 str_V = "udhcp "BB_VER;
1273 1273
1274 /* Parse command line */ 1274 /* Parse command line */
@@ -1282,9 +1282,9 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1282 "\0" IF_UDHCP_VERBOSE("vv") /* -v is a counter */ 1282 "\0" IF_UDHCP_VERBOSE("vv") /* -v is a counter */
1283 , udhcpc_longopts 1283 , udhcpc_longopts
1284 , &str_V, &str_h, &str_h, &str_F 1284 , &str_V, &str_h, &str_h, &str_F
1285 , &client_config.interface, &client_config.pidfile /* i,p */ 1285 , &client_data.interface, &client_data.pidfile /* i,p */
1286 , &str_r /* r */ 1286 , &str_r /* r */
1287 , &client_config.script /* s */ 1287 , &client_data.script /* s */
1288 , &discover_timeout, &discover_retries, &tryagain_timeout /* T,t,A */ 1288 , &discover_timeout, &discover_retries, &tryagain_timeout /* T,t,A */
1289 , &list_O 1289 , &list_O
1290 , &list_x 1290 , &list_x
@@ -1295,11 +1295,11 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1295 if (opt & (OPT_h|OPT_H)) { 1295 if (opt & (OPT_h|OPT_H)) {
1296 //msg added 2011-11 1296 //msg added 2011-11
1297 bb_error_msg("option -h NAME is deprecated, use -x hostname:NAME"); 1297 bb_error_msg("option -h NAME is deprecated, use -x hostname:NAME");
1298 client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0); 1298 client_data.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0);
1299 } 1299 }
1300 if (opt & OPT_F) { 1300 if (opt & OPT_F) {
1301 /* FQDN option format: [0x51][len][flags][0][0]<fqdn> */ 1301 /* FQDN option format: [0x51][len][flags][0][0]<fqdn> */
1302 client_config.fqdn = alloc_dhcp_option(DHCP_FQDN, str_F, 3); 1302 client_data.fqdn = alloc_dhcp_option(DHCP_FQDN, str_F, 3);
1303 /* Flag bits: 0000NEOS 1303 /* Flag bits: 0000NEOS
1304 * S: 1 = Client requests server to update A RR in DNS as well as PTR 1304 * S: 1 = Client requests server to update A RR in DNS as well as PTR
1305 * O: 1 = Server indicates to client that DNS has been updated regardless 1305 * O: 1 = Server indicates to client that DNS has been updated regardless
@@ -1308,9 +1308,9 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1308 * N: 1 = Client requests server to not update DNS (S must be 0 then) 1308 * N: 1 = Client requests server to not update DNS (S must be 0 then)
1309 * Two [0] bytes which follow are deprecated and must be 0. 1309 * Two [0] bytes which follow are deprecated and must be 0.
1310 */ 1310 */
1311 client_config.fqdn[OPT_DATA + 0] = 0x1; 1311 client_data.fqdn[OPT_DATA + 0] = 0x1;
1312 /*client_config.fqdn[OPT_DATA + 1] = 0; - xzalloc did it */ 1312 /*client_data.fqdn[OPT_DATA + 1] = 0; - xzalloc did it */
1313 /*client_config.fqdn[OPT_DATA + 2] = 0; */ 1313 /*client_data.fqdn[OPT_DATA + 2] = 0; */
1314 } 1314 }
1315 if (opt & OPT_r) 1315 if (opt & OPT_r)
1316 requested_ip = inet_addr(str_r); 1316 requested_ip = inet_addr(str_r);
@@ -1328,49 +1328,49 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1328 n = udhcp_option_idx(optstr, dhcp_option_strings); 1328 n = udhcp_option_idx(optstr, dhcp_option_strings);
1329 n = dhcp_optflags[n].code; 1329 n = dhcp_optflags[n].code;
1330 } 1330 }
1331 client_config.opt_mask[n >> 3] |= 1 << (n & 7); 1331 client_data.opt_mask[n >> 3] |= 1 << (n & 7);
1332 } 1332 }
1333 if (!(opt & OPT_o)) { 1333 if (!(opt & OPT_o)) {
1334 unsigned i, n; 1334 unsigned i, n;
1335 for (i = 0; (n = dhcp_optflags[i].code) != 0; i++) { 1335 for (i = 0; (n = dhcp_optflags[i].code) != 0; i++) {
1336 if (dhcp_optflags[i].flags & OPTION_REQ) { 1336 if (dhcp_optflags[i].flags & OPTION_REQ) {
1337 client_config.opt_mask[n >> 3] |= 1 << (n & 7); 1337 client_data.opt_mask[n >> 3] |= 1 << (n & 7);
1338 } 1338 }
1339 } 1339 }
1340 } 1340 }
1341 while (list_x) { 1341 while (list_x) {
1342 char *optstr = xstrdup(llist_pop(&list_x)); 1342 char *optstr = xstrdup(llist_pop(&list_x));
1343 udhcp_str2optset(optstr, &client_config.options, 1343 udhcp_str2optset(optstr, &client_data.options,
1344 dhcp_optflags, dhcp_option_strings, 1344 dhcp_optflags, dhcp_option_strings,
1345 /*dhcpv6:*/ 0 1345 /*dhcpv6:*/ 0
1346 ); 1346 );
1347 free(optstr); 1347 free(optstr);
1348 } 1348 }
1349 1349
1350 if (udhcp_read_interface(client_config.interface, 1350 if (udhcp_read_interface(client_data.interface,
1351 &client_config.ifindex, 1351 &client_data.ifindex,
1352 NULL, 1352 NULL,
1353 client_config.client_mac) 1353 client_data.client_mac)
1354 ) { 1354 ) {
1355 return 1; 1355 return 1;
1356 } 1356 }
1357 1357
1358 clientid_mac_ptr = NULL; 1358 clientid_mac_ptr = NULL;
1359 if (!(opt & OPT_C) && !udhcp_find_option(client_config.options, DHCP_CLIENT_ID)) { 1359 if (!(opt & OPT_C) && !udhcp_find_option(client_data.options, DHCP_CLIENT_ID)) {
1360 /* not suppressed and not set, set the default client ID */ 1360 /* not suppressed and not set, set the default client ID */
1361 client_config.clientid = alloc_dhcp_option(DHCP_CLIENT_ID, "", 7); 1361 client_data.clientid = alloc_dhcp_option(DHCP_CLIENT_ID, "", 7);
1362 client_config.clientid[OPT_DATA] = 1; /* type: ethernet */ 1362 client_data.clientid[OPT_DATA] = 1; /* type: ethernet */
1363 clientid_mac_ptr = client_config.clientid + OPT_DATA+1; 1363 clientid_mac_ptr = client_data.clientid + OPT_DATA+1;
1364 memcpy(clientid_mac_ptr, client_config.client_mac, 6); 1364 memcpy(clientid_mac_ptr, client_data.client_mac, 6);
1365 } 1365 }
1366 if (str_V[0] != '\0') { 1366 if (str_V[0] != '\0') {
1367 // can drop -V, str_V, client_config.vendorclass, 1367 // can drop -V, str_V, client_data.vendorclass,
1368 // but need to add "vendor" to the list of recognized 1368 // but need to add "vendor" to the list of recognized
1369 // string opts for this to work; 1369 // string opts for this to work;
1370 // and need to tweak add_client_options() too... 1370 // and need to tweak add_client_options() too...
1371 // ...so the question is, should we? 1371 // ...so the question is, should we?
1372 //bb_error_msg("option -V VENDOR is deprecated, use -x vendor:VENDOR"); 1372 //bb_error_msg("option -V VENDOR is deprecated, use -x vendor:VENDOR");
1373 client_config.vendorclass = alloc_dhcp_option(DHCP_VENDOR, str_V, 0); 1373 client_data.vendorclass = alloc_dhcp_option(DHCP_VENDOR, str_V, 0);
1374 } 1374 }
1375 1375
1376#if !BB_MMU 1376#if !BB_MMU
@@ -1388,7 +1388,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1388 /* Make sure fd 0,1,2 are open */ 1388 /* Make sure fd 0,1,2 are open */
1389 bb_sanitize_stdio(); 1389 bb_sanitize_stdio();
1390 /* Create pidfile */ 1390 /* Create pidfile */
1391 write_pidfile(client_config.pidfile); 1391 write_pidfile(client_data.pidfile);
1392 /* Goes to stdout (unless NOMMU) and possibly syslog */ 1392 /* Goes to stdout (unless NOMMU) and possibly syslog */
1393 bb_info_msg("started, v"BB_VER); 1393 bb_info_msg("started, v"BB_VER);
1394 /* Set up the signal pipe */ 1394 /* Set up the signal pipe */
@@ -1396,7 +1396,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1396 /* We want random_xid to be random... */ 1396 /* We want random_xid to be random... */
1397 srand(monotonic_us()); 1397 srand(monotonic_us());
1398 1398
1399 client_config.state = INIT_SELECTING; 1399 client_data.state = INIT_SELECTING;
1400 udhcp_run_script(NULL, "deconfig"); 1400 udhcp_run_script(NULL, "deconfig");
1401 change_listen_mode(LISTEN_RAW); 1401 change_listen_mode(LISTEN_RAW);
1402 packet_num = 0; 1402 packet_num = 0;
@@ -1414,16 +1414,16 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1414 /* silence "uninitialized!" warning */ 1414 /* silence "uninitialized!" warning */
1415 unsigned timestamp_before_wait = timestamp_before_wait; 1415 unsigned timestamp_before_wait = timestamp_before_wait;
1416 1416
1417 //bb_error_msg("sockfd:%d, listen_mode:%d", client_config.sockfd, client_config.listen_mode); 1417 //bb_error_msg("sockfd:%d, listen_mode:%d", client_data.sockfd, client_data.listen_mode);
1418 1418
1419 /* Was opening raw or udp socket here 1419 /* Was opening raw or udp socket here
1420 * if (client_config.listen_mode != LISTEN_NONE && client_config.sockfd < 0), 1420 * if (client_data.listen_mode != LISTEN_NONE && client_data.sockfd < 0),
1421 * but on fast network renew responses return faster 1421 * but on fast network renew responses return faster
1422 * than we open sockets. Thus this code is moved 1422 * than we open sockets. Thus this code is moved
1423 * to change_listen_mode(). Thus we open listen socket 1423 * to change_listen_mode(). Thus we open listen socket
1424 * BEFORE we send renew request (see "case BOUND:"). */ 1424 * BEFORE we send renew request (see "case BOUND:"). */
1425 1425
1426 udhcp_sp_fd_set(pfds, client_config.sockfd); 1426 udhcp_sp_fd_set(pfds, client_data.sockfd);
1427 1427
1428 tv = timeout - already_waited_sec; 1428 tv = timeout - already_waited_sec;
1429 retval = 0; 1429 retval = 0;
@@ -1452,20 +1452,20 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1452 * or if the status of the bridge changed). 1452 * or if the status of the bridge changed).
1453 * Refresh ifindex and client_mac: 1453 * Refresh ifindex and client_mac:
1454 */ 1454 */
1455 if (udhcp_read_interface(client_config.interface, 1455 if (udhcp_read_interface(client_data.interface,
1456 &client_config.ifindex, 1456 &client_data.ifindex,
1457 NULL, 1457 NULL,
1458 client_config.client_mac) 1458 client_data.client_mac)
1459 ) { 1459 ) {
1460 goto ret0; /* iface is gone? */ 1460 goto ret0; /* iface is gone? */
1461 } 1461 }
1462 if (clientid_mac_ptr) 1462 if (clientid_mac_ptr)
1463 memcpy(clientid_mac_ptr, client_config.client_mac, 6); 1463 memcpy(clientid_mac_ptr, client_data.client_mac, 6);
1464 1464
1465 /* We will restart the wait in any case */ 1465 /* We will restart the wait in any case */
1466 already_waited_sec = 0; 1466 already_waited_sec = 0;
1467 1467
1468 switch (client_config.state) { 1468 switch (client_data.state) {
1469 case INIT_SELECTING: 1469 case INIT_SELECTING:
1470 if (!discover_retries || packet_num < discover_retries) { 1470 if (!discover_retries || packet_num < discover_retries) {
1471 if (packet_num == 0) 1471 if (packet_num == 0)
@@ -1514,12 +1514,12 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1514 * were seen in the wild. Treat them similarly 1514 * were seen in the wild. Treat them similarly
1515 * to "no response to discover" case */ 1515 * to "no response to discover" case */
1516 change_listen_mode(LISTEN_RAW); 1516 change_listen_mode(LISTEN_RAW);
1517 client_config.state = INIT_SELECTING; 1517 client_data.state = INIT_SELECTING;
1518 goto leasefail; 1518 goto leasefail;
1519 case BOUND: 1519 case BOUND:
1520 /* 1/2 lease passed, enter renewing state */ 1520 /* 1/2 lease passed, enter renewing state */
1521 client_config.state = RENEWING; 1521 client_data.state = RENEWING;
1522 client_config.first_secs = 0; /* make secs field count from 0 */ 1522 client_data.first_secs = 0; /* make secs field count from 0 */
1523 change_listen_mode(LISTEN_KERNEL); 1523 change_listen_mode(LISTEN_KERNEL);
1524 log1("entering renew state"); 1524 log1("entering renew state");
1525 /* fall right through */ 1525 /* fall right through */
@@ -1555,7 +1555,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1555 } 1555 }
1556 /* Timed out or error, enter rebinding state */ 1556 /* Timed out or error, enter rebinding state */
1557 log1("entering rebinding state"); 1557 log1("entering rebinding state");
1558 client_config.state = REBINDING; 1558 client_data.state = REBINDING;
1559 /* fall right through */ 1559 /* fall right through */
1560 case REBINDING: 1560 case REBINDING:
1561 /* Switch to bcast receive */ 1561 /* Switch to bcast receive */
@@ -1571,8 +1571,8 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1571 /* Timed out, enter init state */ 1571 /* Timed out, enter init state */
1572 bb_info_msg("lease lost, entering init state"); 1572 bb_info_msg("lease lost, entering init state");
1573 udhcp_run_script(NULL, "deconfig"); 1573 udhcp_run_script(NULL, "deconfig");
1574 client_config.state = INIT_SELECTING; 1574 client_data.state = INIT_SELECTING;
1575 client_config.first_secs = 0; /* make secs field count from 0 */ 1575 client_data.first_secs = 0; /* make secs field count from 0 */
1576 /*timeout = 0; - already is */ 1576 /*timeout = 0; - already is */
1577 packet_num = 0; 1577 packet_num = 0;
1578 continue; 1578 continue;
@@ -1588,10 +1588,10 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1588 /* Is it a signal? */ 1588 /* Is it a signal? */
1589 switch (udhcp_sp_read()) { 1589 switch (udhcp_sp_read()) {
1590 case SIGUSR1: 1590 case SIGUSR1:
1591 client_config.first_secs = 0; /* make secs field count from 0 */ 1591 client_data.first_secs = 0; /* make secs field count from 0 */
1592 already_waited_sec = 0; 1592 already_waited_sec = 0;
1593 perform_renew(); 1593 perform_renew();
1594 if (client_config.state == RENEW_REQUESTED) { 1594 if (client_data.state == RENEW_REQUESTED) {
1595 /* We might be either on the same network 1595 /* We might be either on the same network
1596 * (in which case renew might work), 1596 * (in which case renew might work),
1597 * or we might be on a completely different one 1597 * or we might be on a completely different one
@@ -1626,15 +1626,15 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1626 int len; 1626 int len;
1627 1627
1628 /* A packet is ready, read it */ 1628 /* A packet is ready, read it */
1629 if (client_config.listen_mode == LISTEN_KERNEL) 1629 if (client_data.listen_mode == LISTEN_KERNEL)
1630 len = udhcp_recv_kernel_packet(&packet, client_config.sockfd); 1630 len = udhcp_recv_kernel_packet(&packet, client_data.sockfd);
1631 else 1631 else
1632 len = udhcp_recv_raw_packet(&packet, client_config.sockfd); 1632 len = udhcp_recv_raw_packet(&packet, client_data.sockfd);
1633 if (len == -1) { 1633 if (len == -1) {
1634 /* Error is severe, reopen socket */ 1634 /* Error is severe, reopen socket */
1635 bb_error_msg("read error: "STRERROR_FMT", reopening socket" STRERROR_ERRNO); 1635 bb_error_msg("read error: "STRERROR_FMT", reopening socket" STRERROR_ERRNO);
1636 sleep(discover_timeout); /* 3 seconds by default */ 1636 sleep(discover_timeout); /* 3 seconds by default */
1637 change_listen_mode(client_config.listen_mode); /* just close and reopen */ 1637 change_listen_mode(client_data.listen_mode); /* just close and reopen */
1638 } 1638 }
1639 /* If this packet will turn out to be unrelated/bogus, 1639 /* If this packet will turn out to be unrelated/bogus,
1640 * we will go back and wait for next one. 1640 * we will go back and wait for next one.
@@ -1652,7 +1652,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1652 1652
1653 /* Ignore packets that aren't for us */ 1653 /* Ignore packets that aren't for us */
1654 if (packet.hlen != 6 1654 if (packet.hlen != 6
1655 || memcmp(packet.chaddr, client_config.client_mac, 6) != 0 1655 || memcmp(packet.chaddr, client_data.client_mac, 6) != 0
1656 ) { 1656 ) {
1657//FIXME: need to also check that last 10 bytes are zero 1657//FIXME: need to also check that last 10 bytes are zero
1658 log1("chaddr does not match, ignoring packet"); // log2? 1658 log1("chaddr does not match, ignoring packet"); // log2?
@@ -1665,7 +1665,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1665 continue; 1665 continue;
1666 } 1666 }
1667 1667
1668 switch (client_config.state) { 1668 switch (client_data.state) {
1669 case INIT_SELECTING: 1669 case INIT_SELECTING:
1670 /* Must be a DHCPOFFER */ 1670 /* Must be a DHCPOFFER */
1671 if (*message == DHCPOFFER) { 1671 if (*message == DHCPOFFER) {
@@ -1707,7 +1707,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1707 requested_ip = packet.yiaddr; 1707 requested_ip = packet.yiaddr;
1708 1708
1709 /* enter requesting state */ 1709 /* enter requesting state */
1710 client_config.state = REQUESTING; 1710 client_data.state = REQUESTING;
1711 timeout = 0; 1711 timeout = 0;
1712 packet_num = 0; 1712 packet_num = 0;
1713 already_waited_sec = 0; 1713 already_waited_sec = 0;
@@ -1754,19 +1754,19 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1754 if (!arpping(packet.yiaddr, 1754 if (!arpping(packet.yiaddr,
1755 NULL, 1755 NULL,
1756 (uint32_t) 0, 1756 (uint32_t) 0,
1757 client_config.client_mac, 1757 client_data.client_mac,
1758 client_config.interface, 1758 client_data.interface,
1759 arpping_ms) 1759 arpping_ms)
1760 ) { 1760 ) {
1761 bb_info_msg("offered address is in use " 1761 bb_info_msg("offered address is in use "
1762 "(got ARP reply), declining"); 1762 "(got ARP reply), declining");
1763 send_decline(/*xid,*/ server_addr, packet.yiaddr); 1763 send_decline(/*xid,*/ server_addr, packet.yiaddr);
1764 1764
1765 if (client_config.state != REQUESTING) 1765 if (client_data.state != REQUESTING)
1766 udhcp_run_script(NULL, "deconfig"); 1766 udhcp_run_script(NULL, "deconfig");
1767 change_listen_mode(LISTEN_RAW); 1767 change_listen_mode(LISTEN_RAW);
1768 client_config.state = INIT_SELECTING; 1768 client_data.state = INIT_SELECTING;
1769 client_config.first_secs = 0; /* make secs field count from 0 */ 1769 client_data.first_secs = 0; /* make secs field count from 0 */
1770 requested_ip = 0; 1770 requested_ip = 0;
1771 timeout = tryagain_timeout; 1771 timeout = tryagain_timeout;
1772 packet_num = 0; 1772 packet_num = 0;
@@ -1782,7 +1782,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1782 requested_ip = packet.yiaddr; 1782 requested_ip = packet.yiaddr;
1783 1783
1784 start = monotonic_sec(); 1784 start = monotonic_sec();
1785 udhcp_run_script(&packet, client_config.state == REQUESTING ? "bound" : "renew"); 1785 udhcp_run_script(&packet, client_data.state == REQUESTING ? "bound" : "renew");
1786 already_waited_sec = (unsigned)monotonic_sec() - start; 1786 already_waited_sec = (unsigned)monotonic_sec() - start;
1787 timeout = lease_seconds / 2; 1787 timeout = lease_seconds / 2;
1788 if ((unsigned)timeout < already_waited_sec) { 1788 if ((unsigned)timeout < already_waited_sec) {
@@ -1790,7 +1790,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1790 timeout = already_waited_sec = 0; 1790 timeout = already_waited_sec = 0;
1791 } 1791 }
1792 1792
1793 client_config.state = BOUND; 1793 client_data.state = BOUND;
1794 change_listen_mode(LISTEN_NONE); 1794 change_listen_mode(LISTEN_NONE);
1795 if (opt & OPT_q) { /* quit after lease */ 1795 if (opt & OPT_q) { /* quit after lease */
1796 goto ret0; 1796 goto ret0;
@@ -1832,12 +1832,12 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1832 /* return to init state */ 1832 /* return to init state */
1833 bb_info_msg("received %s", "DHCP NAK"); 1833 bb_info_msg("received %s", "DHCP NAK");
1834 udhcp_run_script(&packet, "nak"); 1834 udhcp_run_script(&packet, "nak");
1835 if (client_config.state != REQUESTING) 1835 if (client_data.state != REQUESTING)
1836 udhcp_run_script(NULL, "deconfig"); 1836 udhcp_run_script(NULL, "deconfig");
1837 change_listen_mode(LISTEN_RAW); 1837 change_listen_mode(LISTEN_RAW);
1838 sleep(3); /* avoid excessive network traffic */ 1838 sleep(3); /* avoid excessive network traffic */
1839 client_config.state = INIT_SELECTING; 1839 client_data.state = INIT_SELECTING;
1840 client_config.first_secs = 0; /* make secs field count from 0 */ 1840 client_data.first_secs = 0; /* make secs field count from 0 */
1841 requested_ip = 0; 1841 requested_ip = 0;
1842 timeout = 0; 1842 timeout = 0;
1843 packet_num = 0; 1843 packet_num = 0;
@@ -1855,7 +1855,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1855 perform_release(server_addr, requested_ip); 1855 perform_release(server_addr, requested_ip);
1856 retval = 0; 1856 retval = 0;
1857 ret: 1857 ret:
1858 /*if (client_config.pidfile) - remove_pidfile has its own check */ 1858 /*if (client_data.pidfile) - remove_pidfile has its own check */
1859 remove_pidfile(client_config.pidfile); 1859 remove_pidfile(client_data.pidfile);
1860 return retval; 1860 return retval;
1861} 1861}
diff --git a/networking/udhcp/dhcpc.h b/networking/udhcp/dhcpc.h
index 2618b12b5..42fe71a36 100644
--- a/networking/udhcp/dhcpc.h
+++ b/networking/udhcp/dhcpc.h
@@ -7,7 +7,7 @@
7 7
8PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN 8PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
9 9
10struct client_config_t { 10struct client_data_t {
11 uint8_t client_mac[6]; /* Our mac address */ 11 uint8_t client_mac[6]; /* Our mac address */
12 IF_FEATURE_UDHCP_PORT(uint16_t port;) 12 IF_FEATURE_UDHCP_PORT(uint16_t port;)
13 int ifindex; /* Index number of the interface to use */ 13 int ifindex; /* Index number of the interface to use */
@@ -31,11 +31,11 @@ struct client_config_t {
31} FIX_ALIASING; 31} FIX_ALIASING;
32 32
33/* server_config sits in 1st half of bb_common_bufsiz1 */ 33/* server_config sits in 1st half of bb_common_bufsiz1 */
34#define client_config (*(struct client_config_t*)(&bb_common_bufsiz1[COMMON_BUFSIZE / 2])) 34#define client_data (*(struct client_data_t*)(&bb_common_bufsiz1[COMMON_BUFSIZE / 2]))
35 35
36#if ENABLE_FEATURE_UDHCP_PORT 36#if ENABLE_FEATURE_UDHCP_PORT
37#define CLIENT_PORT (client_config.port) 37#define CLIENT_PORT (client_data.port)
38#define CLIENT_PORT6 (client_config.port) 38#define CLIENT_PORT6 (client_data.port)
39#else 39#else
40#define CLIENT_PORT 68 40#define CLIENT_PORT 68
41#define CLIENT_PORT6 546 41#define CLIENT_PORT6 546
diff --git a/networking/udhcp/dhcpd.h b/networking/udhcp/dhcpd.h
index 5c3bf5147..ba11d77e8 100644
--- a/networking/udhcp/dhcpd.h
+++ b/networking/udhcp/dhcpd.h
@@ -54,7 +54,7 @@ struct server_config_t {
54} FIX_ALIASING; 54} FIX_ALIASING;
55 55
56#define server_config (*(struct server_config_t*)bb_common_bufsiz1) 56#define server_config (*(struct server_config_t*)bb_common_bufsiz1)
57/* client_config sits in 2nd half of bb_common_bufsiz1 */ 57/* client_data sits in 2nd half of bb_common_bufsiz1 */
58 58
59#if ENABLE_FEATURE_UDHCP_PORT 59#if ENABLE_FEATURE_UDHCP_PORT
60#define SERVER_PORT (server_config.port) 60#define SERVER_PORT (server_config.port)