aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-06-13 20:44:05 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-06-13 20:44:05 +0000
commit21765fa063830923d13426ec6989c16da9210e49 (patch)
treeb564726ae79740552bff9bf6412e97f1ae34fbfd
parent76f812803b72b5ccca764cdc7bfc42276fd70413 (diff)
downloadbusybox-w32-21765fa063830923d13426ec6989c16da9210e49.tar.gz
busybox-w32-21765fa063830923d13426ec6989c16da9210e49.tar.bz2
busybox-w32-21765fa063830923d13426ec6989c16da9210e49.zip
udhcpc: kill undocumented -W, it was a no-op.
fix option parsing in the case some CONFIG_x are off. disable -b on NOMMU, make backgrounding work correctly (if a bit differently from MMU case). Previously, it wasn't working at all. stop using global data for flags in main(), opt bitfield works as well. function old new delta cryptpw_main 177 153 -24 packed_usage 24478 24452 -26 client_background 26 - -26 udhcpc_main 2462 2372 -90 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 0/3 up/down: 0/-166) Total: -166 bytes
-rw-r--r--applets/usage.c11
-rw-r--r--include/platform.h2
-rw-r--r--include/usage.h4
-rw-r--r--libbb/correct_password.c2
-rw-r--r--networking/udhcp/dhcpc.c170
-rw-r--r--networking/udhcp/dhcpc.h19
6 files changed, 108 insertions, 100 deletions
diff --git a/applets/usage.c b/applets/usage.c
index 4f6a569d4..a35817f9f 100644
--- a/applets/usage.c
+++ b/applets/usage.c
@@ -5,6 +5,17 @@
5 * object directory */ 5 * object directory */
6#include "../include/autoconf.h" 6#include "../include/autoconf.h"
7 7
8/* Since we can't use platform.h, have to do this again by hand: */
9#if ENABLE_NOMMU
10#define BB_MMU 0
11#define USE_FOR_NOMMU(...) __VA_ARGS__
12#define USE_FOR_MMU(...)
13#else
14#define BB_MMU 1
15#define USE_FOR_NOMMU(...)
16#define USE_FOR_MMU(...) __VA_ARGS__
17#endif
18
8static const char usage_messages[] = "" 19static const char usage_messages[] = ""
9#define MAKE_USAGE 20#define MAKE_USAGE
10#include "usage.h" 21#include "usage.h"
diff --git a/include/platform.h b/include/platform.h
index 21224fabf..cdc1151ad 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -248,12 +248,10 @@ typedef unsigned smalluint;
248 (defined __UCLIBC__ && __UCLIBC_MAJOR__ >= 0 && __UCLIBC_MINOR__ >= 9 && \ 248 (defined __UCLIBC__ && __UCLIBC_MAJOR__ >= 0 && __UCLIBC_MINOR__ >= 9 && \
249 __UCLIBC_SUBLEVEL__ > 28 && !defined __ARCH_USE_MMU__) 249 __UCLIBC_SUBLEVEL__ > 28 && !defined __ARCH_USE_MMU__)
250#define BB_MMU 0 250#define BB_MMU 0
251#define BB_NOMMU 1
252#define USE_FOR_NOMMU(...) __VA_ARGS__ 251#define USE_FOR_NOMMU(...) __VA_ARGS__
253#define USE_FOR_MMU(...) 252#define USE_FOR_MMU(...)
254#else 253#else
255#define BB_MMU 1 254#define BB_MMU 1
256/* BB_NOMMU is not defined in this case! */
257#define USE_FOR_NOMMU(...) 255#define USE_FOR_NOMMU(...)
258#define USE_FOR_MMU(...) __VA_ARGS__ 256#define USE_FOR_MMU(...) __VA_ARGS__
259#endif 257#endif
diff --git a/include/usage.h b/include/usage.h
index 3eb5b4867..4fba0e34e 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -4246,7 +4246,9 @@
4246 "\n -O,--request-option=OPT Request DHCP option OPT (cumulative)" \ 4246 "\n -O,--request-option=OPT Request DHCP option OPT (cumulative)" \
4247 "\n -o,--no-default-options Do not request any options (unless -O is also given)" \ 4247 "\n -o,--no-default-options Do not request any options (unless -O is also given)" \
4248 "\n -f,--foreground Run in foreground" \ 4248 "\n -f,--foreground Run in foreground" \
4249 USE_FOR_MMU( \
4249 "\n -b,--background Background if lease is not immediately obtained" \ 4250 "\n -b,--background Background if lease is not immediately obtained" \
4251 ) \
4250 "\n -S,--syslog Log to syslog too" \ 4252 "\n -S,--syslog Log to syslog too" \
4251 "\n -n,--now Exit with failure if lease is not immediately obtained" \ 4253 "\n -n,--now Exit with failure if lease is not immediately obtained" \
4252 "\n -q,--quit Quit after obtaining lease" \ 4254 "\n -q,--quit Quit after obtaining lease" \
@@ -4273,7 +4275,9 @@
4273 "\n -O OPT Request DHCP option OPT (cumulative)" \ 4275 "\n -O OPT Request DHCP option OPT (cumulative)" \
4274 "\n -o Do not request any options (unless -O is also given)" \ 4276 "\n -o Do not request any options (unless -O is also given)" \
4275 "\n -f Run in foreground" \ 4277 "\n -f Run in foreground" \
4278 USE_FOR_MMU( \
4276 "\n -b Background if lease is not immediately obtained" \ 4279 "\n -b Background if lease is not immediately obtained" \
4280 ) \
4277 "\n -S Log to syslog too" \ 4281 "\n -S Log to syslog too" \
4278 "\n -n Exit with failure if lease is not immediately obtained" \ 4282 "\n -n Exit with failure if lease is not immediately obtained" \
4279 "\n -q Quit after obtaining lease" \ 4283 "\n -q Quit after obtaining lease" \
diff --git a/libbb/correct_password.c b/libbb/correct_password.c
index f0b9384ea..f47642fd5 100644
--- a/libbb/correct_password.c
+++ b/libbb/correct_password.c
@@ -59,7 +59,7 @@ int correct_password(const struct passwd *pw)
59 /* getspnam_r may return 0 yet set result to NULL. 59 /* getspnam_r may return 0 yet set result to NULL.
60 * At least glibc 2.4 does this. Be extra paranoid here. */ 60 * At least glibc 2.4 does this. Be extra paranoid here. */
61 struct spwd *result = NULL; 61 struct spwd *result = NULL;
62 int r = getspnam_r(pw->pw_name, &spw, buffer, sizeof(buffer), &result); 62 r = getspnam_r(pw->pw_name, &spw, buffer, sizeof(buffer), &result);
63 correct = (r || !result) ? "aa" : result->sp_pwdp; 63 correct = (r || !result) ? "aa" : result->sp_pwdp;
64 } 64 }
65#endif 65#endif
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index f1aa36fe6..d135ba74d 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -98,24 +98,15 @@ static void perform_release(uint32_t requested_ip, uint32_t server_addr)
98} 98}
99 99
100 100
101#if BB_MMU
101static void client_background(void) 102static void client_background(void)
102{ 103{
103#if !BB_MMU
104 bb_error_msg("cannot background in uclinux (yet)");
105/* ... mainly because udhcpc calls client_background()
106 * in _the _middle _of _udhcpc _run_, not at the start!
107 * If that will be properly disabled for NOMMU, client_background()
108 * will work on NOMMU too */
109#else
110 bb_daemonize(0); 104 bb_daemonize(0);
111 logmode &= ~LOGMODE_STDIO; 105 logmode &= ~LOGMODE_STDIO;
112 /* rewrite pidfile, as our pid is different now */ 106 /* rewrite pidfile, as our pid is different now */
113 write_pidfile(client_config.pidfile); 107 write_pidfile(client_config.pidfile);
114#endif
115 /* Do not fork again. */
116 client_config.foreground = 1;
117 client_config.background_if_no_lease = 0;
118} 108}
109#endif
119 110
120 111
121static uint8_t* alloc_dhcp_option(int code, const char *str, int extra) 112static uint8_t* alloc_dhcp_option(int code, const char *str, int extra)
@@ -138,9 +129,6 @@ int udhcpc_main(int argc ATTRIBUTE_UNUSED, char **argv)
138 char *str_c, *str_V, *str_h, *str_F, *str_r; 129 char *str_c, *str_V, *str_h, *str_F, *str_r;
139 USE_FEATURE_UDHCP_PORT(char *str_P;) 130 USE_FEATURE_UDHCP_PORT(char *str_P;)
140 llist_t *list_O = NULL; 131 llist_t *list_O = NULL;
141#if ENABLE_FEATURE_UDHCPC_ARPING
142 char *str_W;
143#endif
144 int tryagain_timeout = 20; 132 int tryagain_timeout = 20;
145 int discover_timeout = 3; 133 int discover_timeout = 3;
146 int discover_retries = 3; 134 int discover_retries = 3;
@@ -158,41 +146,11 @@ int udhcpc_main(int argc ATTRIBUTE_UNUSED, char **argv)
158 struct dhcpMessage packet; 146 struct dhcpMessage packet;
159 fd_set rfds; 147 fd_set rfds;
160 148
161 enum {
162 OPT_c = 1 << 0,
163 OPT_C = 1 << 1,
164 OPT_V = 1 << 2,
165 OPT_f = 1 << 3,
166 OPT_b = 1 << 4,
167 OPT_H = 1 << 5,
168 OPT_h = 1 << 6,
169 OPT_F = 1 << 7,
170 OPT_i = 1 << 8,
171 OPT_n = 1 << 9,
172 OPT_p = 1 << 10,
173 OPT_q = 1 << 11,
174 OPT_R = 1 << 12,
175 OPT_r = 1 << 13,
176 OPT_s = 1 << 14,
177 OPT_T = 1 << 15,
178 OPT_t = 1 << 16,
179 OPT_v = 1 << 17,
180 OPT_S = 1 << 18,
181 OPT_A = 1 << 19,
182#if ENABLE_FEATURE_UDHCPC_ARPING
183 OPT_a = 1 << 20,
184 OPT_W = 1 << 21,
185#endif
186 OPT_P = 1 << 22,
187 OPT_o = 1 << 23,
188 };
189#if ENABLE_GETOPT_LONG 149#if ENABLE_GETOPT_LONG
190 static const char udhcpc_longopts[] ALIGN1 = 150 static const char udhcpc_longopts[] ALIGN1 =
191 "clientid\0" Required_argument "c" 151 "clientid\0" Required_argument "c"
192 "clientid-none\0" No_argument "C" 152 "clientid-none\0" No_argument "C"
193 "vendorclass\0" Required_argument "V" 153 "vendorclass\0" Required_argument "V"
194 "foreground\0" No_argument "f"
195 "background\0" No_argument "b"
196 "hostname\0" Required_argument "H" 154 "hostname\0" Required_argument "H"
197 "fqdn\0" Required_argument "F" 155 "fqdn\0" Required_argument "F"
198 "interface\0" Required_argument "i" 156 "interface\0" Required_argument "i"
@@ -207,16 +165,62 @@ int udhcpc_main(int argc ATTRIBUTE_UNUSED, char **argv)
207 "retries\0" Required_argument "t" 165 "retries\0" Required_argument "t"
208 "tryagain\0" Required_argument "A" 166 "tryagain\0" Required_argument "A"
209 "syslog\0" No_argument "S" 167 "syslog\0" No_argument "S"
168 "request-option\0" Required_argument "O"
169 "no-default-options\0" No_argument "o"
170 "foreground\0" No_argument "f"
171 "background\0" No_argument "b"
210#if ENABLE_FEATURE_UDHCPC_ARPING 172#if ENABLE_FEATURE_UDHCPC_ARPING
211 "arping\0" No_argument "a" 173 "arping\0" No_argument "a"
212#endif 174#endif
213 "request-option\0" Required_argument "O"
214#if ENABLE_FEATURE_UDHCP_PORT 175#if ENABLE_FEATURE_UDHCP_PORT
215 "client-port\0" Required_argument "P" 176 "client-port\0" Required_argument "P"
216#endif 177#endif
217 "no-default-options\0" No_argument "o"
218 ; 178 ;
219#endif 179#endif
180 enum {
181 OPT_c = 1 << 0,
182 OPT_C = 1 << 1,
183 OPT_V = 1 << 2,
184 OPT_H = 1 << 3,
185 OPT_h = 1 << 4,
186 OPT_F = 1 << 5,
187 OPT_i = 1 << 6,
188 OPT_n = 1 << 7,
189 OPT_p = 1 << 8,
190 OPT_q = 1 << 9,
191 OPT_R = 1 << 10,
192 OPT_r = 1 << 11,
193 OPT_s = 1 << 12,
194 OPT_T = 1 << 13,
195 OPT_t = 1 << 14,
196 OPT_v = 1 << 15,
197 OPT_S = 1 << 16,
198 OPT_A = 1 << 17,
199 OPT_O = 1 << 18,
200 OPT_o = 1 << 19,
201 OPT_f = 1 << 20,
202/* The rest has variable bit positions, need to be clever */
203 OPTBIT_f = 20,
204#if BB_MMU
205 OPTBIT_b,
206#endif
207#if ENABLE_FEATURE_UDHCPC_ARPING
208 OPTBIT_a,
209#endif
210#if ENABLE_FEATURE_UDHCP_PORT
211 OPTBIT_P,
212#endif
213#if BB_MMU
214 OPT_b = 1 << OPTBIT_b,
215#endif
216#if ENABLE_FEATURE_UDHCPC_ARPING
217 OPT_a = 1 << OPTBIT_a,
218#endif
219#if ENABLE_FEATURE_UDHCP_PORT
220 OPT_P = 1 << OPTBIT_P,
221#endif
222 };
223
220 /* Default options. */ 224 /* Default options. */
221#if ENABLE_FEATURE_UDHCP_PORT 225#if ENABLE_FEATURE_UDHCP_PORT
222 SERVER_PORT = 67; 226 SERVER_PORT = 67;
@@ -231,28 +235,21 @@ int udhcpc_main(int argc ATTRIBUTE_UNUSED, char **argv)
231#if ENABLE_GETOPT_LONG 235#if ENABLE_GETOPT_LONG
232 applet_long_options = udhcpc_longopts; 236 applet_long_options = udhcpc_longopts;
233#endif 237#endif
234 opt = getopt32(argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:vSA:" 238 opt = getopt32(argv, "c:CV:H:h:F:i:np:qRr:s:T:t:vSA:O:of"
235 USE_FEATURE_UDHCPC_ARPING("aW:") 239 USE_FOR_MMU("b")
240 USE_FEATURE_UDHCPC_ARPING("a")
236 USE_FEATURE_UDHCP_PORT("P:") 241 USE_FEATURE_UDHCP_PORT("P:")
237 "O:o"
238 , &str_c, &str_V, &str_h, &str_h, &str_F 242 , &str_c, &str_V, &str_h, &str_h, &str_F
239 , &client_config.interface, &client_config.pidfile, &str_r 243 , &client_config.interface, &client_config.pidfile, &str_r /* i,p */
240 , &client_config.script 244 , &client_config.script /* s */
241 , &discover_timeout, &discover_retries, &tryagain_timeout 245 , &discover_timeout, &discover_retries, &tryagain_timeout /* T,t,A */
242 USE_FEATURE_UDHCPC_ARPING(, &str_W)
243 USE_FEATURE_UDHCP_PORT(, &str_P)
244 , &list_O 246 , &list_O
247 USE_FEATURE_UDHCP_PORT(, &str_P)
245 ); 248 );
246
247 if (opt & OPT_c) 249 if (opt & OPT_c)
248 client_config.clientid = alloc_dhcp_option(DHCP_CLIENT_ID, str_c, 0); 250 client_config.clientid = alloc_dhcp_option(DHCP_CLIENT_ID, str_c, 0);
249 //if (opt & OPT_C)
250 if (opt & OPT_V) 251 if (opt & OPT_V)
251 client_config.vendorclass = alloc_dhcp_option(DHCP_VENDOR, str_V, 0); 252 client_config.vendorclass = alloc_dhcp_option(DHCP_VENDOR, str_V, 0);
252 if (opt & OPT_f)
253 client_config.foreground = 1;
254 if (opt & OPT_b)
255 client_config.background_if_no_lease = 1;
256 if (opt & (OPT_h|OPT_H)) 253 if (opt & (OPT_h|OPT_H))
257 client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0); 254 client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0);
258 if (opt & OPT_F) { 255 if (opt & OPT_F) {
@@ -267,28 +264,12 @@ int udhcpc_main(int argc ATTRIBUTE_UNUSED, char **argv)
267 /* client_config.fqdn[OPT_DATA + 1] = 0; - redundant */ 264 /* client_config.fqdn[OPT_DATA + 1] = 0; - redundant */
268 /* client_config.fqdn[OPT_DATA + 2] = 0; - redundant */ 265 /* client_config.fqdn[OPT_DATA + 2] = 0; - redundant */
269 } 266 }
270 // if (opt & OPT_i) client_config.interface = ...
271 if (opt & OPT_n)
272 client_config.abort_if_no_lease = 1;
273 // if (opt & OPT_p) client_config.pidfile = ...
274 if (opt & OPT_q)
275 client_config.quit_after_lease = 1;
276 if (opt & OPT_R)
277 client_config.release_on_quit = 1;
278 if (opt & OPT_r) 267 if (opt & OPT_r)
279 requested_ip = inet_addr(str_r); 268 requested_ip = inet_addr(str_r);
280 // if (opt & OPT_s) client_config.script = ...
281 // if (opt & OPT_T) discover_timeout = xatoi_u(str_T);
282 // if (opt & OPT_t) discover_retries = xatoi_u(str_t);
283 // if (opt & OPT_A) tryagain_timeout = xatoi_u(str_A);
284 if (opt & OPT_v) { 269 if (opt & OPT_v) {
285 puts("version "BB_VER); 270 puts("version "BB_VER);
286 return 0; 271 return 0;
287 } 272 }
288 if (opt & OPT_S) {
289 openlog(applet_name, LOG_PID, LOG_LOCAL0);
290 logmode |= LOGMODE_SYSLOG;
291 }
292#if ENABLE_FEATURE_UDHCP_PORT 273#if ENABLE_FEATURE_UDHCP_PORT
293 if (opt & OPT_P) { 274 if (opt & OPT_P) {
294 CLIENT_PORT = xatou16(str_P); 275 CLIENT_PORT = xatou16(str_P);
@@ -309,6 +290,17 @@ int udhcpc_main(int argc ATTRIBUTE_UNUSED, char **argv)
309 if (read_interface(client_config.interface, &client_config.ifindex, 290 if (read_interface(client_config.interface, &client_config.ifindex,
310 NULL, client_config.arp)) 291 NULL, client_config.arp))
311 return 1; 292 return 1;
293#if !BB_MMU
294 /* on NOMMU reexec (i.e., background) early */
295 if (!(opt & OPT_f)) {
296 bb_daemonize_or_rexec(0 /* flags */, argv);
297 logmode = 0;
298 }
299#endif
300 if (opt & OPT_S) {
301 openlog(applet_name, LOG_PID, LOG_LOCAL0);
302 logmode |= LOGMODE_SYSLOG;
303 }
312 304
313 /* Make sure fd 0,1,2 are open */ 305 /* Make sure fd 0,1,2 are open */
314 bb_sanitize_stdio(); 306 bb_sanitize_stdio();
@@ -317,9 +309,8 @@ int udhcpc_main(int argc ATTRIBUTE_UNUSED, char **argv)
317 309
318 /* Create pidfile */ 310 /* Create pidfile */
319 write_pidfile(client_config.pidfile); 311 write_pidfile(client_config.pidfile);
320 /* if (!..) bb_perror_msg("cannot create pidfile %s", pidfile); */
321 312
322 /* Goes to stdout and possibly syslog */ 313 /* Goes to stdout (unless NOMMU) and possibly syslog */
323 bb_info_msg("%s (v"BB_VER") started", applet_name); 314 bb_info_msg("%s (v"BB_VER") started", applet_name);
324 315
325 /* if not set, and not suppressed, setup the default client ID */ 316 /* if not set, and not suppressed, setup the default client ID */
@@ -393,10 +384,15 @@ int udhcpc_main(int argc ATTRIBUTE_UNUSED, char **argv)
393 continue; 384 continue;
394 } 385 }
395 udhcp_run_script(NULL, "leasefail"); 386 udhcp_run_script(NULL, "leasefail");
396 if (client_config.background_if_no_lease) { 387#if BB_MMU /* -b is not supported on NOMMU */
388 if (opt & OPT_b) { /* background if no lease */
397 bb_info_msg("No lease, forking to background"); 389 bb_info_msg("No lease, forking to background");
398 client_background(); 390 client_background();
399 } else if (client_config.abort_if_no_lease) { 391 /* do not background again! */
392 opt = ((opt & ~OPT_b) | OPT_f);
393 } else
394#endif
395 if (opt & OPT_n) { /* abort if no lease */
400 bb_info_msg("No lease, failing"); 396 bb_info_msg("No lease, failing");
401 retval = 1; 397 retval = 1;
402 goto ret; 398 goto ret;
@@ -584,14 +580,18 @@ int udhcpc_main(int argc ATTRIBUTE_UNUSED, char **argv)
584 580
585 state = BOUND; 581 state = BOUND;
586 change_listen_mode(LISTEN_NONE); 582 change_listen_mode(LISTEN_NONE);
587 if (client_config.quit_after_lease) { 583 if (opt & OPT_q) { /* quit after lease */
588 if (client_config.release_on_quit) 584 if (opt & OPT_R) /* release on quit */
589 perform_release(requested_ip, server_addr); 585 perform_release(requested_ip, server_addr);
590 goto ret0; 586 goto ret0;
591 } 587 }
592 if (!client_config.foreground) 588#if BB_MMU /* NOMMU case backgrounded earlier */
589 if (!(opt & OPT_f)) {
593 client_background(); 590 client_background();
594 591 /* do not background again! */
592 opt = ((opt & ~OPT_b) | OPT_f);
593 }
594#endif
595 already_waited_sec = 0; 595 already_waited_sec = 0;
596 continue; /* back to main loop */ 596 continue; /* back to main loop */
597 } 597 }
@@ -633,7 +633,7 @@ int udhcpc_main(int argc ATTRIBUTE_UNUSED, char **argv)
633 break; 633 break;
634 case SIGTERM: 634 case SIGTERM:
635 bb_info_msg("Received SIGTERM"); 635 bb_info_msg("Received SIGTERM");
636 if (client_config.release_on_quit) 636 if (opt & OPT_R) /* release on quit */
637 perform_release(requested_ip, server_addr); 637 perform_release(requested_ip, server_addr);
638 goto ret0; 638 goto ret0;
639 } 639 }
diff --git a/networking/udhcp/dhcpc.h b/networking/udhcp/dhcpc.h
index 97d3b3c9d..1ebccd405 100644
--- a/networking/udhcp/dhcpc.h
+++ b/networking/udhcp/dhcpc.h
@@ -9,14 +9,15 @@
9#endif 9#endif
10 10
11struct client_config_t { 11struct client_config_t {
12 uint8_t arp[6]; /* Our arp address */
12 /* TODO: combine flag fields into single "unsigned opt" */ 13 /* TODO: combine flag fields into single "unsigned opt" */
13 /* (can be set directly to the result of getopt32) */ 14 /* (can be set directly to the result of getopt32) */
14 char foreground; /* Do not fork */
15 char quit_after_lease; /* Quit after obtaining lease */
16 char release_on_quit; /* Perform release on quit */
17 char abort_if_no_lease; /* Abort if no lease */
18 char background_if_no_lease; /* Fork to background if no lease */
19 char no_default_options; /* Do not include default optins in request */ 15 char no_default_options; /* Do not include default optins in request */
16#if ENABLE_FEATURE_UDHCP_PORT
17 uint16_t port;
18#endif
19 int ifindex; /* Index number of the interface to use */
20 uint8_t opt_mask[256 / 8]; /* Bitmask of options to send (-O option) */
20 const char *interface; /* The name of the interface to use */ 21 const char *interface; /* The name of the interface to use */
21 char *pidfile; /* Optionally store the process ID */ 22 char *pidfile; /* Optionally store the process ID */
22 const char *script; /* User script to run at dhcp events */ 23 const char *script; /* User script to run at dhcp events */
@@ -24,16 +25,10 @@ struct client_config_t {
24 uint8_t *vendorclass; /* Optional vendor class-id to use */ 25 uint8_t *vendorclass; /* Optional vendor class-id to use */
25 uint8_t *hostname; /* Optional hostname to use */ 26 uint8_t *hostname; /* Optional hostname to use */
26 uint8_t *fqdn; /* Optional fully qualified domain name to use */ 27 uint8_t *fqdn; /* Optional fully qualified domain name to use */
27 int ifindex; /* Index number of the interface to use */
28#if ENABLE_FEATURE_UDHCP_PORT
29 uint16_t port;
30#endif
31 uint8_t arp[6]; /* Our arp address */
32 uint8_t opt_mask[256 / 8]; /* Bitmask of options to send (-O option) */
33}; 28};
34 29
35/* server_config sits in 1st half of bb_common_bufsiz1 */ 30/* server_config sits in 1st half of bb_common_bufsiz1 */
36#define client_config (*(struct client_config_t*)(&bb_common_bufsiz1[COMMON_BUFSIZE/2])) 31#define client_config (*(struct client_config_t*)(&bb_common_bufsiz1[COMMON_BUFSIZE / 2]))
37 32
38#if ENABLE_FEATURE_UDHCP_PORT 33#if ENABLE_FEATURE_UDHCP_PORT
39#define CLIENT_PORT (client_config.port) 34#define CLIENT_PORT (client_config.port)