diff options
Diffstat (limited to 'patches')
-rw-r--r-- | patches/eject.diff | 10 | ||||
-rw-r--r-- | patches/tftp_timeout_multicast.diff | 192 | ||||
-rw-r--r-- | patches/udhcp_additional_items.diff | 16 | ||||
-rw-r--r-- | patches/udhcp_config_paths.diff | 108 | ||||
-rw-r--r-- | patches/udhcpd_foreground.diff | 8 |
5 files changed, 167 insertions, 167 deletions
diff --git a/patches/eject.diff b/patches/eject.diff index 3efd449c0..fcc234d02 100644 --- a/patches/eject.diff +++ b/patches/eject.diff | |||
@@ -6,15 +6,15 @@ diff -u -r1.40 AUTHORS | |||
6 | --- a/AUTHORS 9 Oct 2003 21:19:21 -0000 1.40 | 6 | --- a/AUTHORS 9 Oct 2003 21:19:21 -0000 1.40 |
7 | +++ b/AUTHORS 5 Mar 2004 07:23:17 -0000 | 7 | +++ b/AUTHORS 5 Mar 2004 07:23:17 -0000 |
8 | @@ -8,6 +8,9 @@ | 8 | @@ -8,6 +8,9 @@ |
9 | 9 | ||
10 | ----------- | 10 | ----------- |
11 | 11 | ||
12 | +Peter Willis <psyphreak@phreaker.net> | 12 | +Peter Willis <psyphreak@phreaker.net> |
13 | + eject | 13 | + eject |
14 | + | 14 | + |
15 | Emanuele Aina <emanuele.aina@tiscali.it> | 15 | Emanuele Aina <emanuele.aina@tiscali.it> |
16 | run-parts | 16 | run-parts |
17 | 17 | ||
18 | Index: coreutils/Config.in | 18 | Index: coreutils/Config.in |
19 | =================================================================== | 19 | =================================================================== |
20 | RCS file: /var/cvs/busybox/coreutils/Config.in,v | 20 | RCS file: /var/cvs/busybox/coreutils/Config.in,v |
@@ -25,7 +25,7 @@ diff -u -r1.23 Config.in | |||
25 | @@ -164,6 +164,13 @@ | 25 | @@ -164,6 +164,13 @@ |
26 | a command; without options it displays the current | 26 | a command; without options it displays the current |
27 | environment. | 27 | environment. |
28 | 28 | ||
29 | +config CONFIG_EJECT | 29 | +config CONFIG_EJECT |
30 | + bool "eject" | 30 | + bool "eject" |
31 | + default n | 31 | + default n |
@@ -151,7 +151,7 @@ diff -u -r1.191 usage.h | |||
151 | @@ -537,6 +537,13 @@ | 151 | @@ -537,6 +537,13 @@ |
152 | "\t-, -i\tstart with an empty environment\n" \ | 152 | "\t-, -i\tstart with an empty environment\n" \ |
153 | "\t-u\tremove variable from the environment\n" | 153 | "\t-u\tremove variable from the environment\n" |
154 | 154 | ||
155 | +#define eject_trivial_usage \ | 155 | +#define eject_trivial_usage \ |
156 | + "[-t] [FILE]" | 156 | + "[-t] [FILE]" |
157 | +#define eject_full_usage \ | 157 | +#define eject_full_usage \ |
diff --git a/patches/tftp_timeout_multicast.diff b/patches/tftp_timeout_multicast.diff index a76a18c61..0f09d4a04 100644 --- a/patches/tftp_timeout_multicast.diff +++ b/patches/tftp_timeout_multicast.diff | |||
@@ -6,15 +6,15 @@ diff -u -r1.40 AUTHORS | |||
6 | --- a/AUTHORS 9 Oct 2003 21:19:21 -0000 1.40 | 6 | --- a/AUTHORS 9 Oct 2003 21:19:21 -0000 1.40 |
7 | +++ b/AUTHORS 5 Mar 2004 15:45:47 -0000 | 7 | +++ b/AUTHORS 5 Mar 2004 15:45:47 -0000 |
8 | @@ -92,6 +92,9 @@ | 8 | @@ -92,6 +92,9 @@ |
9 | Original author of BusyBox in 1995, 1996. Some of his code can | 9 | Original author of BusyBox in 1995, 1996. Some of his code can |
10 | still be found hiding here and there... | 10 | still be found hiding here and there... |
11 | 11 | ||
12 | +John Powers <jpp@ti.com> | 12 | +John Powers <jpp@ti.com> |
13 | + Added multicast option (rfc2090) and timeout option (rfc2349) to tftp. | 13 | + Added multicast option (rfc2090) and timeout option (rfc2349) to tftp. |
14 | + | 14 | + |
15 | Tim Riker <Tim@Rikers.org> | 15 | Tim Riker <Tim@Rikers.org> |
16 | bug fixes, member of fan club | 16 | bug fixes, member of fan club |
17 | 17 | ||
18 | Index: include/usage.h | 18 | Index: include/usage.h |
19 | =================================================================== | 19 | =================================================================== |
20 | RCS file: /var/cvs/busybox/include/usage.h,v | 20 | RCS file: /var/cvs/busybox/include/usage.h,v |
@@ -41,7 +41,7 @@ diff -u -r1.191 usage.h | |||
41 | +#else | 41 | +#else |
42 | + #define USAGE_TFTP_DEBUG(a) | 42 | + #define USAGE_TFTP_DEBUG(a) |
43 | +#endif | 43 | +#endif |
44 | 44 | ||
45 | #define tftp_trivial_usage \ | 45 | #define tftp_trivial_usage \ |
46 | "[OPTION]... HOST [PORT]" | 46 | "[OPTION]... HOST [PORT]" |
47 | @@ -2508,6 +2523,16 @@ | 47 | @@ -2508,6 +2523,16 @@ |
@@ -71,7 +71,7 @@ diff -u -r1.27 Config.in | |||
71 | @@ -522,6 +522,13 @@ | 71 | @@ -522,6 +522,13 @@ |
72 | Add support for the GET command within the TFTP client. This allows | 72 | Add support for the GET command within the TFTP client. This allows |
73 | a client to retrieve a file from a TFTP server. | 73 | a client to retrieve a file from a TFTP server. |
74 | 74 | ||
75 | +config CONFIG_FEATURE_TFTP_MULTICAST | 75 | +config CONFIG_FEATURE_TFTP_MULTICAST |
76 | + bool " Enable \"multicast\" option" | 76 | + bool " Enable \"multicast\" option" |
77 | + default n | 77 | + default n |
@@ -84,7 +84,7 @@ diff -u -r1.27 Config.in | |||
84 | default y | 84 | default y |
85 | @@ -531,12 +538,19 @@ | 85 | @@ -531,12 +538,19 @@ |
86 | a client to transfer a file to a TFTP server. | 86 | a client to transfer a file to a TFTP server. |
87 | 87 | ||
88 | config CONFIG_FEATURE_TFTP_BLOCKSIZE | 88 | config CONFIG_FEATURE_TFTP_BLOCKSIZE |
89 | - bool " Enable \"blocksize\" command" | 89 | - bool " Enable \"blocksize\" command" |
90 | + bool " Enable \"blksize\" option" | 90 | + bool " Enable \"blksize\" option" |
@@ -92,7 +92,7 @@ diff -u -r1.27 Config.in | |||
92 | depends on CONFIG_TFTP | 92 | depends on CONFIG_TFTP |
93 | help | 93 | help |
94 | Allow the client to specify the desired block size for transfers. | 94 | Allow the client to specify the desired block size for transfers. |
95 | 95 | ||
96 | +config CONFIG_FEATURE_TFTP_TIMEOUT | 96 | +config CONFIG_FEATURE_TFTP_TIMEOUT |
97 | + bool " Enable \"timeout\" option" | 97 | + bool " Enable \"timeout\" option" |
98 | + default n | 98 | + default n |
@@ -138,15 +138,15 @@ diff -u -r1.25 tftp.c | |||
138 | /* */ | 138 | /* */ |
139 | /* Parts of the code based on: */ | 139 | /* Parts of the code based on: */ |
140 | @@ -46,8 +61,20 @@ | 140 | @@ -46,8 +61,20 @@ |
141 | 141 | ||
142 | #include "busybox.h" | 142 | #include "busybox.h" |
143 | 143 | ||
144 | +#if defined(CONFIG_FEATURE_TFTP_BLOCKSIZE) || defined(CONFIG_FEATURE_TFTP_MULTICAST) || defined(CONFIG_FEATURE_TFTP_TIMEOUT) | 144 | +#if defined(CONFIG_FEATURE_TFTP_BLOCKSIZE) || defined(CONFIG_FEATURE_TFTP_MULTICAST) || defined(CONFIG_FEATURE_TFTP_TIMEOUT) |
145 | + #define TFTP_OPTIONS | 145 | + #define TFTP_OPTIONS |
146 | +#endif | 146 | +#endif |
147 | + | 147 | + |
148 | //#define CONFIG_FEATURE_TFTP_DEBUG | 148 | //#define CONFIG_FEATURE_TFTP_DEBUG |
149 | 149 | ||
150 | +#ifdef CONFIG_FEATURE_TFTP_DEBUG | 150 | +#ifdef CONFIG_FEATURE_TFTP_DEBUG |
151 | + static void printtime(void); | 151 | + static void printtime(void); |
152 | + #define dprintf(fmt...) if (debug) {printtime(); printf(fmt);} | 152 | + #define dprintf(fmt...) if (debug) {printtime(); printf(fmt);} |
@@ -157,7 +157,7 @@ diff -u -r1.25 tftp.c | |||
157 | + | 157 | + |
158 | #define TFTP_BLOCKSIZE_DEFAULT 512 /* according to RFC 1350, don't change */ | 158 | #define TFTP_BLOCKSIZE_DEFAULT 512 /* according to RFC 1350, don't change */ |
159 | #define TFTP_TIMEOUT 5 /* seconds */ | 159 | #define TFTP_TIMEOUT 5 /* seconds */ |
160 | 160 | ||
161 | @@ -68,12 +95,24 @@ | 161 | @@ -68,12 +95,24 @@ |
162 | "Illegal TFTP operation", | 162 | "Illegal TFTP operation", |
163 | "Unknown transfer ID", | 163 | "Unknown transfer ID", |
@@ -168,10 +168,10 @@ diff -u -r1.25 tftp.c | |||
168 | + "Unsupported option", | 168 | + "Unsupported option", |
169 | +#endif | 169 | +#endif |
170 | }; | 170 | }; |
171 | 171 | ||
172 | const int tftp_cmd_get = 1; | 172 | const int tftp_cmd_get = 1; |
173 | const int tftp_cmd_put = 2; | 173 | const int tftp_cmd_put = 2; |
174 | 174 | ||
175 | + | 175 | + |
176 | +struct tftp_option { | 176 | +struct tftp_option { |
177 | + int multicast; | 177 | + int multicast; |
@@ -182,12 +182,12 @@ diff -u -r1.25 tftp.c | |||
182 | + | 182 | + |
183 | + | 183 | + |
184 | #ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE | 184 | #ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE |
185 | 185 | ||
186 | static int tftp_blocksize_check(int blocksize, int bufsize) | 186 | static int tftp_blocksize_check(int blocksize, int bufsize) |
187 | @@ -93,16 +132,158 @@ | 187 | @@ -93,16 +132,158 @@ |
188 | return blocksize; | 188 | return blocksize; |
189 | } | 189 | } |
190 | 190 | ||
191 | +#endif | 191 | +#endif |
192 | + | 192 | + |
193 | +#ifdef CONFIG_FEATURE_TFTP_TIMEOUT | 193 | +#ifdef CONFIG_FEATURE_TFTP_TIMEOUT |
@@ -332,15 +332,15 @@ diff -u -r1.25 tftp.c | |||
332 | + | 332 | + |
333 | +#ifdef TFTP_OPTIONS | 333 | +#ifdef TFTP_OPTIONS |
334 | + | 334 | + |
335 | static char *tftp_option_get(char *buf, int len, char *option) | 335 | static char *tftp_option_get(char *buf, int len, char *option) |
336 | { | 336 | { |
337 | - int opt_val = 0; | 337 | - int opt_val = 0; |
338 | + int opt_val = 0; | 338 | + int opt_val = 0; |
339 | int opt_found = 0; | 339 | int opt_found = 0; |
340 | int k; | 340 | int k; |
341 | - | 341 | - |
342 | - while (len > 0) { | 342 | - while (len > 0) { |
343 | 343 | ||
344 | + while (len > 0) { | 344 | + while (len > 0) { |
345 | /* Make sure the options are terminated correctly */ | 345 | /* Make sure the options are terminated correctly */ |
346 | - | 346 | - |
@@ -351,7 +351,7 @@ diff -u -r1.25 tftp.c | |||
351 | if (strcasecmp(buf, option) == 0) { | 351 | if (strcasecmp(buf, option) == 0) { |
352 | opt_found = 1; | 352 | opt_found = 1; |
353 | } | 353 | } |
354 | - } | 354 | - } |
355 | - else { | 355 | - else { |
356 | - if (opt_found) { | 356 | - if (opt_found) { |
357 | + } else { | 357 | + } else { |
@@ -361,7 +361,7 @@ diff -u -r1.25 tftp.c | |||
361 | } | 361 | } |
362 | @@ -138,7 +318,8 @@ | 362 | @@ -138,7 +318,8 @@ |
363 | #endif | 363 | #endif |
364 | 364 | ||
365 | static inline int tftp(const int cmd, const struct hostent *host, | 365 | static inline int tftp(const int cmd, const struct hostent *host, |
366 | - const char *remotefile, int localfd, const unsigned short port, int tftp_bufsize) | 366 | - const char *remotefile, int localfd, const unsigned short port, int tftp_bufsize) |
367 | + const char *remotefile, int localfd, const unsigned short port, | 367 | + const char *remotefile, int localfd, const unsigned short port, |
@@ -376,7 +376,7 @@ diff -u -r1.25 tftp.c | |||
376 | - int timeout = bb_tftp_num_retries; | 376 | - int timeout = bb_tftp_num_retries; |
377 | + int retry = bb_tftp_num_retries; | 377 | + int retry = bb_tftp_num_retries; |
378 | unsigned short block_nr = 1; | 378 | unsigned short block_nr = 1; |
379 | 379 | ||
380 | -#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE | 380 | -#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE |
381 | - int want_option_ack = 0; | 381 | - int want_option_ack = 0; |
382 | +#ifdef CONFIG_FEATURE_TFTP_MULTICAST | 382 | +#ifdef CONFIG_FEATURE_TFTP_MULTICAST |
@@ -393,21 +393,21 @@ diff -u -r1.25 tftp.c | |||
393 | + #define master_client 1 | 393 | + #define master_client 1 |
394 | + #define ack_oack 0 | 394 | + #define ack_oack 0 |
395 | #endif | 395 | #endif |
396 | 396 | ||
397 | /* Can't use RESERVE_CONFIG_BUFFER here since the allocation | 397 | /* Can't use RESERVE_CONFIG_BUFFER here since the allocation |
398 | * size varies meaning BUFFERS_GO_ON_STACK would fail */ | 398 | * size varies meaning BUFFERS_GO_ON_STACK would fail */ |
399 | - char *buf=xmalloc(tftp_bufsize + 4); | 399 | - char *buf=xmalloc(tftp_bufsize + 4); |
400 | + char *buf=xmalloc(option->blksize + 4); | 400 | + char *buf=xmalloc(option->blksize + 4); |
401 | 401 | ||
402 | - tftp_bufsize += 4; | 402 | - tftp_bufsize += 4; |
403 | + int tftp_bufsize = option->blksize + 4; | 403 | + int tftp_bufsize = option->blksize + 4; |
404 | 404 | ||
405 | if ((socketfd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) { | 405 | if ((socketfd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) { |
406 | bb_perror_msg("socket"); | 406 | bb_perror_msg("socket"); |
407 | @@ -183,15 +375,21 @@ | 407 | @@ -183,15 +375,21 @@ |
408 | memcpy(&sa.sin_addr, (struct in_addr *) host->h_addr, | 408 | memcpy(&sa.sin_addr, (struct in_addr *) host->h_addr, |
409 | sizeof(sa.sin_addr)); | 409 | sizeof(sa.sin_addr)); |
410 | 410 | ||
411 | - /* build opcode */ | 411 | - /* build opcode */ |
412 | - | 412 | - |
413 | - if (cmd_get) { | 413 | - if (cmd_get) { |
@@ -423,48 +423,48 @@ diff -u -r1.25 tftp.c | |||
423 | + memset(mcblockmap, 0, bmsize+1); | 423 | + memset(mcblockmap, 0, bmsize+1); |
424 | } | 424 | } |
425 | +#endif | 425 | +#endif |
426 | 426 | ||
427 | - if (cmd_put) { | 427 | - if (cmd_put) { |
428 | - opcode = TFTP_WRQ; | 428 | - opcode = TFTP_WRQ; |
429 | - } | 429 | - } |
430 | + /* build opcode */ | 430 | + /* build opcode */ |
431 | + | 431 | + |
432 | + opcode = cmd_get ? TFTP_RRQ : TFTP_WRQ; | 432 | + opcode = cmd_get ? TFTP_RRQ : TFTP_WRQ; |
433 | 433 | ||
434 | while (1) { | 434 | while (1) { |
435 | 435 | ||
436 | @@ -203,7 +401,7 @@ | 436 | @@ -203,7 +401,7 @@ |
437 | 437 | ||
438 | cp += 2; | 438 | cp += 2; |
439 | 439 | ||
440 | - /* add filename and mode */ | 440 | - /* add filename and mode */ |
441 | + /* First packet of file transfer includes file name, mode, and options */ | 441 | + /* First packet of file transfer includes file name, mode, and options */ |
442 | 442 | ||
443 | if ((cmd_get && (opcode == TFTP_RRQ)) || | 443 | if ((cmd_get && (opcode == TFTP_RRQ)) || |
444 | (cmd_put && (opcode == TFTP_WRQ))) { | 444 | (cmd_put && (opcode == TFTP_WRQ))) { |
445 | @@ -223,7 +421,7 @@ | 445 | @@ -223,7 +421,7 @@ |
446 | } | 446 | } |
447 | 447 | ||
448 | if (too_long || ((&buf[tftp_bufsize - 1] - cp) < 6)) { | 448 | if (too_long || ((&buf[tftp_bufsize - 1] - cp) < 6)) { |
449 | - bb_error_msg("too long remote-filename"); | 449 | - bb_error_msg("too long remote-filename"); |
450 | + bb_error_msg("too long: remote filename"); | 450 | + bb_error_msg("too long: remote filename"); |
451 | break; | 451 | break; |
452 | } | 452 | } |
453 | 453 | ||
454 | @@ -238,8 +436,8 @@ | 454 | @@ -238,8 +436,8 @@ |
455 | 455 | ||
456 | if (len != TFTP_BLOCKSIZE_DEFAULT) { | 456 | if (len != TFTP_BLOCKSIZE_DEFAULT) { |
457 | 457 | ||
458 | - if ((&buf[tftp_bufsize - 1] - cp) < 15) { | 458 | - if ((&buf[tftp_bufsize - 1] - cp) < 15) { |
459 | - bb_error_msg("too long remote-filename"); | 459 | - bb_error_msg("too long remote-filename"); |
460 | + if ((&buf[tftp_bufsize - 1] - cp) < 15) { | 460 | + if ((&buf[tftp_bufsize - 1] - cp) < 15) { |
461 | + bb_error_msg("buffer too small for blksize option"); | 461 | + bb_error_msg("buffer too small for blksize option"); |
462 | break; | 462 | break; |
463 | } | 463 | } |
464 | 464 | ||
465 | @@ -249,16 +447,65 @@ | 465 | @@ -249,16 +447,65 @@ |
466 | cp += 8; | 466 | cp += 8; |
467 | 467 | ||
468 | cp += snprintf(cp, 6, "%d", len) + 1; | 468 | cp += snprintf(cp, 6, "%d", len) + 1; |
469 | + } | 469 | + } |
470 | +#endif | 470 | +#endif |
@@ -480,7 +480,7 @@ diff -u -r1.25 tftp.c | |||
480 | + } | 480 | + } |
481 | + | 481 | + |
482 | + /* add "multicast" option */ | 482 | + /* add "multicast" option */ |
483 | 483 | ||
484 | - want_option_ack = 1; | 484 | - want_option_ack = 1; |
485 | + memcpy(cp, "multicast\0", 11); | 485 | + memcpy(cp, "multicast\0", 11); |
486 | + cp += 11; | 486 | + cp += 11; |
@@ -509,9 +509,9 @@ diff -u -r1.25 tftp.c | |||
509 | +#endif | 509 | +#endif |
510 | + | 510 | + |
511 | } | 511 | } |
512 | 512 | ||
513 | /* add ack and data */ | 513 | /* add ack and data */ |
514 | 514 | ||
515 | - if ((cmd_get && (opcode == TFTP_ACK)) || | 515 | - if ((cmd_get && (opcode == TFTP_ACK)) || |
516 | - (cmd_put && (opcode == TFTP_DATA))) { | 516 | - (cmd_put && (opcode == TFTP_DATA))) { |
517 | +#ifdef CONFIG_FEATURE_TFTP_MULTICAST | 517 | +#ifdef CONFIG_FEATURE_TFTP_MULTICAST |
@@ -528,33 +528,33 @@ diff -u -r1.25 tftp.c | |||
528 | +#endif | 528 | +#endif |
529 | + else if ((cmd_get && opcode == TFTP_ACK) || | 529 | + else if ((cmd_get && opcode == TFTP_ACK) || |
530 | + (cmd_put && opcode == TFTP_DATA)) { | 530 | + (cmd_put && opcode == TFTP_DATA)) { |
531 | 531 | ||
532 | *((unsigned short *) cp) = htons(block_nr); | 532 | *((unsigned short *) cp) = htons(block_nr); |
533 | 533 | ||
534 | @@ -275,7 +522,7 @@ | 534 | @@ -275,7 +522,7 @@ |
535 | } | 535 | } |
536 | 536 | ||
537 | if (len != (tftp_bufsize - 4)) { | 537 | if (len != (tftp_bufsize - 4)) { |
538 | - finished++; | 538 | - finished++; |
539 | + finished = 1; | 539 | + finished = 1; |
540 | } | 540 | } |
541 | 541 | ||
542 | cp += len; | 542 | cp += len; |
543 | @@ -283,82 +530,119 @@ | 543 | @@ -283,82 +530,119 @@ |
544 | } | 544 | } |
545 | 545 | ||
546 | 546 | ||
547 | - /* send packet */ | 547 | - /* send packet */ |
548 | + /* send packet and receive reply */ | 548 | + /* send packet and receive reply */ |
549 | 549 | ||
550 | 550 | ||
551 | - timeout = bb_tftp_num_retries; /* re-initialize */ | 551 | - timeout = bb_tftp_num_retries; /* re-initialize */ |
552 | + retry = bb_tftp_num_retries; /* re-initialize */ | 552 | + retry = bb_tftp_num_retries; /* re-initialize */ |
553 | do { | 553 | do { |
554 | - | 554 | - |
555 | + int selectrc; | 555 | + int selectrc; |
556 | len = cp - buf; | 556 | len = cp - buf; |
557 | 557 | ||
558 | -#ifdef CONFIG_FEATURE_TFTP_DEBUG | 558 | -#ifdef CONFIG_FEATURE_TFTP_DEBUG |
559 | - fprintf(stderr, "sending %u bytes\n", len); | 559 | - fprintf(stderr, "sending %u bytes\n", len); |
560 | - for (cp = buf; cp < &buf[len]; cp++) | 560 | - for (cp = buf; cp < &buf[len]; cp++) |
@@ -570,7 +570,7 @@ diff -u -r1.25 tftp.c | |||
570 | - | 570 | - |
571 | + /* send packet */ | 571 | + /* send packet */ |
572 | + if ((len > 2) && (! option->multicast || master_client || ack_oack)) { | 572 | + if ((len > 2) && (! option->multicast || master_client || ack_oack)) { |
573 | 573 | ||
574 | - if (finished && (opcode == TFTP_ACK)) { | 574 | - if (finished && (opcode == TFTP_ACK)) { |
575 | - break; | 575 | - break; |
576 | +#ifdef CONFIG_FEATURE_TFTP_DEBUG | 576 | +#ifdef CONFIG_FEATURE_TFTP_DEBUG |
@@ -593,17 +593,17 @@ diff -u -r1.25 tftp.c | |||
593 | + break; | 593 | + break; |
594 | + } | 594 | + } |
595 | } | 595 | } |
596 | 596 | ||
597 | - /* receive packet */ | 597 | - /* receive packet */ |
598 | + /* receive reply packet */ | 598 | + /* receive reply packet */ |
599 | 599 | ||
600 | memset(&from, 0, sizeof(from)); | 600 | memset(&from, 0, sizeof(from)); |
601 | fromlen = sizeof(from); | 601 | fromlen = sizeof(from); |
602 | 602 | ||
603 | - tv.tv_sec = TFTP_TIMEOUT; | 603 | - tv.tv_sec = TFTP_TIMEOUT; |
604 | + tv.tv_sec = option->client_timeout; | 604 | + tv.tv_sec = option->client_timeout; |
605 | tv.tv_usec = 0; | 605 | tv.tv_usec = 0; |
606 | 606 | ||
607 | FD_ZERO(&rfds); | 607 | FD_ZERO(&rfds); |
608 | FD_SET(socketfd, &rfds); | 608 | FD_SET(socketfd, &rfds); |
609 | + dprintf("set to receive from socketfd (%d)\n", socketfd); | 609 | + dprintf("set to receive from socketfd (%d)\n", socketfd); |
@@ -613,7 +613,7 @@ diff -u -r1.25 tftp.c | |||
613 | + dprintf("set to receive from mcfd (%d)\n", mcfd); | 613 | + dprintf("set to receive from mcfd (%d)\n", mcfd); |
614 | + } | 614 | + } |
615 | +#endif | 615 | +#endif |
616 | 616 | ||
617 | - switch (select(FD_SETSIZE, &rfds, NULL, NULL, &tv)) { | 617 | - switch (select(FD_SETSIZE, &rfds, NULL, NULL, &tv)) { |
618 | - case 1: | 618 | - case 1: |
619 | - len = recvfrom(socketfd, buf, tftp_bufsize, 0, | 619 | - len = recvfrom(socketfd, buf, tftp_bufsize, 0, |
@@ -646,7 +646,7 @@ diff -u -r1.25 tftp.c | |||
646 | + } | 646 | + } |
647 | + } | 647 | + } |
648 | } | 648 | } |
649 | 649 | ||
650 | - timeout = 0; | 650 | - timeout = 0; |
651 | - | 651 | - |
652 | - if (sa.sin_port == port) { | 652 | - if (sa.sin_port == port) { |
@@ -677,13 +677,13 @@ diff -u -r1.25 tftp.c | |||
677 | - /* discard the packet - treat as timeout */ | 677 | - /* discard the packet - treat as timeout */ |
678 | - timeout = bb_tftp_num_retries; | 678 | - timeout = bb_tftp_num_retries; |
679 | +#endif | 679 | +#endif |
680 | 680 | ||
681 | - case 0: | 681 | - case 0: |
682 | + } else if (selectrc == 0) { | 682 | + } else if (selectrc == 0) { |
683 | + /* Time out */ | 683 | + /* Time out */ |
684 | + dprintf("timeout\n"); | 684 | + dprintf("timeout\n"); |
685 | bb_error_msg("timeout"); | 685 | bb_error_msg("timeout"); |
686 | 686 | ||
687 | - timeout--; | 687 | - timeout--; |
688 | - if (timeout == 0) { | 688 | - if (timeout == 0) { |
689 | + retry--; | 689 | + retry--; |
@@ -700,59 +700,59 @@ diff -u -r1.25 tftp.c | |||
700 | bb_perror_msg("select"); | 700 | bb_perror_msg("select"); |
701 | len = -1; | 701 | len = -1; |
702 | } | 702 | } |
703 | 703 | ||
704 | - } while (timeout && (len >= 0)); | 704 | - } while (timeout && (len >= 0)); |
705 | + } while (retry && len >= 0); | 705 | + } while (retry && len >= 0); |
706 | 706 | ||
707 | if ((finished) || (len < 0)) { | 707 | if ((finished) || (len < 0)) { |
708 | break; | 708 | break; |
709 | @@ -370,9 +654,8 @@ | 709 | @@ -370,9 +654,8 @@ |
710 | opcode = ntohs(*((unsigned short *) buf)); | 710 | opcode = ntohs(*((unsigned short *) buf)); |
711 | tmp = ntohs(*((unsigned short *) &buf[2])); | 711 | tmp = ntohs(*((unsigned short *) &buf[2])); |
712 | 712 | ||
713 | -#ifdef CONFIG_FEATURE_TFTP_DEBUG | 713 | -#ifdef CONFIG_FEATURE_TFTP_DEBUG |
714 | - fprintf(stderr, "received %d bytes: %04x %04x\n", len, opcode, tmp); | 714 | - fprintf(stderr, "received %d bytes: %04x %04x\n", len, opcode, tmp); |
715 | -#endif | 715 | -#endif |
716 | + dprintf("received %d bytes: %04x %04x\n", len, opcode, tmp); | 716 | + dprintf("received %d bytes: %04x %04x\n", len, opcode, tmp); |
717 | + dprintf("master_client=%d\n", master_client); | 717 | + dprintf("master_client=%d\n", master_client); |
718 | 718 | ||
719 | if (opcode == TFTP_ERROR) { | 719 | if (opcode == TFTP_ERROR) { |
720 | char *msg = NULL; | 720 | char *msg = NULL; |
721 | @@ -393,55 +676,116 @@ | 721 | @@ -393,55 +676,116 @@ |
722 | break; | 722 | break; |
723 | } | 723 | } |
724 | 724 | ||
725 | -#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE | 725 | -#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE |
726 | - if (want_option_ack) { | 726 | - if (want_option_ack) { |
727 | +#ifdef TFTP_OPTIONS | 727 | +#ifdef TFTP_OPTIONS |
728 | 728 | ||
729 | - want_option_ack = 0; | 729 | - want_option_ack = 0; |
730 | + if (opcode == TFTP_OACK) { | 730 | + if (opcode == TFTP_OACK) { |
731 | 731 | ||
732 | - if (opcode == TFTP_OACK) { | 732 | - if (opcode == TFTP_OACK) { |
733 | + /* server seems to support options */ | 733 | + /* server seems to support options */ |
734 | 734 | ||
735 | - /* server seems to support options */ | 735 | - /* server seems to support options */ |
736 | + char *res; | 736 | + char *res; |
737 | + | 737 | + |
738 | + block_nr = 0; /* acknowledge option packet with block number 0 */ | 738 | + block_nr = 0; /* acknowledge option packet with block number 0 */ |
739 | + opcode = cmd_put ? TFTP_DATA : TFTP_ACK; | 739 | + opcode = cmd_put ? TFTP_DATA : TFTP_ACK; |
740 | 740 | ||
741 | - char *res; | 741 | - char *res; |
742 | 742 | ||
743 | - res = tftp_option_get(&buf[2], len-2, | 743 | - res = tftp_option_get(&buf[2], len-2, |
744 | - "blksize"); | 744 | - "blksize"); |
745 | +#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE | 745 | +#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE |
746 | + res = tftp_option_get(&buf[2], len-2, "blksize"); | 746 | + res = tftp_option_get(&buf[2], len-2, "blksize"); |
747 | 747 | ||
748 | - if (res) { | 748 | - if (res) { |
749 | - int blksize = atoi(res); | 749 | - int blksize = atoi(res); |
750 | - | 750 | - |
751 | - if (tftp_blocksize_check(blksize, | 751 | - if (tftp_blocksize_check(blksize, |
752 | - tftp_bufsize - 4)) { | 752 | - tftp_bufsize - 4)) { |
753 | + if (res) { | 753 | + if (res) { |
754 | + int blksize = atoi(res); | 754 | + int blksize = atoi(res); |
755 | 755 | ||
756 | - if (cmd_put) { | 756 | - if (cmd_put) { |
757 | - opcode = TFTP_DATA; | 757 | - opcode = TFTP_DATA; |
758 | - } | 758 | - } |
@@ -782,10 +782,10 @@ diff -u -r1.25 tftp.c | |||
782 | - bb_error_msg("bad server option"); | 782 | - bb_error_msg("bad server option"); |
783 | - break; | 783 | - break; |
784 | - } | 784 | - } |
785 | 785 | ||
786 | - bb_error_msg("warning: blksize not supported by server" | 786 | - bb_error_msg("warning: blksize not supported by server" |
787 | - " - reverting to 512"); | 787 | - " - reverting to 512"); |
788 | 788 | ||
789 | - tftp_bufsize = TFTP_BLOCKSIZE_DEFAULT + 4; | 789 | - tftp_bufsize = TFTP_BLOCKSIZE_DEFAULT + 4; |
790 | +#ifdef CONFIG_FEATURE_TFTP_MULTICAST | 790 | +#ifdef CONFIG_FEATURE_TFTP_MULTICAST |
791 | + res = tftp_option_get(&buf[2], len-2, "multicast"); | 791 | + res = tftp_option_get(&buf[2], len-2, "multicast"); |
@@ -837,9 +837,9 @@ diff -u -r1.25 tftp.c | |||
837 | } | 837 | } |
838 | + else | 838 | + else |
839 | #endif | 839 | #endif |
840 | 840 | ||
841 | if (cmd_get && (opcode == TFTP_DATA)) { | 841 | if (cmd_get && (opcode == TFTP_DATA)) { |
842 | 842 | ||
843 | +#ifdef CONFIG_FEATURE_TFTP_MULTICAST | 843 | +#ifdef CONFIG_FEATURE_TFTP_MULTICAST |
844 | + if (option->multicast) { | 844 | + if (option->multicast) { |
845 | + int bn = tmp - 1; | 845 | + int bn = tmp - 1; |
@@ -867,35 +867,35 @@ diff -u -r1.25 tftp.c | |||
867 | +#endif | 867 | +#endif |
868 | + | 868 | + |
869 | if (tmp == block_nr) { | 869 | if (tmp == block_nr) { |
870 | 870 | ||
871 | len = write(localfd, &buf[4], len - 4); | 871 | len = write(localfd, &buf[4], len - 4); |
872 | @@ -452,15 +796,14 @@ | 872 | @@ -452,15 +796,14 @@ |
873 | } | 873 | } |
874 | 874 | ||
875 | if (len != (tftp_bufsize - 4)) { | 875 | if (len != (tftp_bufsize - 4)) { |
876 | - finished++; | 876 | - finished++; |
877 | + finished = 1; | 877 | + finished = 1; |
878 | } | 878 | } |
879 | 879 | ||
880 | opcode = TFTP_ACK; | 880 | opcode = TFTP_ACK; |
881 | - continue; | 881 | - continue; |
882 | } | 882 | } |
883 | } | 883 | } |
884 | 884 | ||
885 | - if (cmd_put && (opcode == TFTP_ACK)) { | 885 | - if (cmd_put && (opcode == TFTP_ACK)) { |
886 | + else if (cmd_put && opcode == TFTP_ACK) { | 886 | + else if (cmd_put && opcode == TFTP_ACK) { |
887 | 887 | ||
888 | if (tmp == (unsigned short)(block_nr - 1)) { | 888 | if (tmp == (unsigned short)(block_nr - 1)) { |
889 | if (finished) { | 889 | if (finished) { |
890 | @@ -468,15 +811,19 @@ | 890 | @@ -468,15 +811,19 @@ |
891 | } | 891 | } |
892 | 892 | ||
893 | opcode = TFTP_DATA; | 893 | opcode = TFTP_DATA; |
894 | - continue; | 894 | - continue; |
895 | } | 895 | } |
896 | } | 896 | } |
897 | } | 897 | } |
898 | 898 | ||
899 | #ifdef CONFIG_FEATURE_CLEAN_UP | 899 | #ifdef CONFIG_FEATURE_CLEAN_UP |
900 | close(socketfd); | 900 | close(socketfd); |
901 | + free(buf); | 901 | + free(buf); |
@@ -904,10 +904,10 @@ diff -u -r1.25 tftp.c | |||
904 | + if (mcblockmap != NULL) | 904 | + if (mcblockmap != NULL) |
905 | + free(mcblockmap); | 905 | + free(mcblockmap); |
906 | +#endif | 906 | +#endif |
907 | 907 | ||
908 | - free(buf); | 908 | - free(buf); |
909 | #endif | 909 | #endif |
910 | 910 | ||
911 | return finished ? EXIT_SUCCESS : EXIT_FAILURE; | 911 | return finished ? EXIT_SUCCESS : EXIT_FAILURE; |
912 | @@ -487,13 +834,18 @@ | 912 | @@ -487,13 +834,18 @@ |
913 | struct hostent *host = NULL; | 913 | struct hostent *host = NULL; |
@@ -927,13 +927,13 @@ diff -u -r1.25 tftp.c | |||
927 | + .client_timeout = TFTP_TIMEOUT, | 927 | + .client_timeout = TFTP_TIMEOUT, |
928 | + .server_timeout = TFTP_TIMEOUT, | 928 | + .server_timeout = TFTP_TIMEOUT, |
929 | + }; | 929 | + }; |
930 | 930 | ||
931 | /* figure out what to pass to getopt */ | 931 | /* figure out what to pass to getopt */ |
932 | 932 | ||
933 | @@ -515,13 +867,45 @@ | 933 | @@ -515,13 +867,45 @@ |
934 | #define PUT | 934 | #define PUT |
935 | #endif | 935 | #endif |
936 | 936 | ||
937 | - while ((opt = getopt(argc, argv, BS GET PUT "l:r:")) != -1) { | 937 | - while ((opt = getopt(argc, argv, BS GET PUT "l:r:")) != -1) { |
938 | +#ifdef CONFIG_FEATURE_TFTP_TIMEOUT | 938 | +#ifdef CONFIG_FEATURE_TFTP_TIMEOUT |
939 | +#define TO "T:t:" | 939 | +#define TO "T:t:" |
@@ -994,7 +994,7 @@ diff -u -r1.25 tftp.c | |||
994 | + debug = 1; | 994 | + debug = 1; |
995 | + break; | 995 | + break; |
996 | +#endif | 996 | +#endif |
997 | case 'l': | 997 | case 'l': |
998 | localfile = bb_xstrdup(optarg); | 998 | localfile = bb_xstrdup(optarg); |
999 | break; | 999 | break; |
1000 | case 'r': | 1000 | case 'r': |
@@ -1004,7 +1004,7 @@ diff -u -r1.25 tftp.c | |||
1004 | + bb_show_usage(); | 1004 | + bb_show_usage(); |
1005 | } | 1005 | } |
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | if ((cmd == 0) || (optind == argc)) { | 1008 | if ((cmd == 0) || (optind == argc)) { |
1009 | bb_show_usage(); | 1009 | bb_show_usage(); |
1010 | } | 1010 | } |
@@ -1018,7 +1018,7 @@ diff -u -r1.25 tftp.c | |||
1018 | @@ -566,14 +966,12 @@ | 1018 | @@ -566,14 +966,12 @@ |
1019 | host = xgethostbyname(argv[optind]); | 1019 | host = xgethostbyname(argv[optind]); |
1020 | port = bb_lookup_port(argv[optind + 1], "udp", 69); | 1020 | port = bb_lookup_port(argv[optind + 1], "udp", 69); |
1021 | 1021 | ||
1022 | -#ifdef CONFIG_FEATURE_TFTP_DEBUG | 1022 | -#ifdef CONFIG_FEATURE_TFTP_DEBUG |
1023 | - fprintf(stderr, "using server \"%s\", remotefile \"%s\", " | 1023 | - fprintf(stderr, "using server \"%s\", remotefile \"%s\", " |
1024 | + dprintf("using server \"%s\", remotefile \"%s\", " | 1024 | + dprintf("using server \"%s\", remotefile \"%s\", " |
@@ -1026,10 +1026,10 @@ diff -u -r1.25 tftp.c | |||
1026 | inet_ntoa(*((struct in_addr *) host->h_addr)), | 1026 | inet_ntoa(*((struct in_addr *) host->h_addr)), |
1027 | remotefile, localfile); | 1027 | remotefile, localfile); |
1028 | -#endif | 1028 | -#endif |
1029 | 1029 | ||
1030 | - result = tftp(cmd, host, remotefile, fd, port, blocksize); | 1030 | - result = tftp(cmd, host, remotefile, fd, port, blocksize); |
1031 | + result = tftp(cmd, host, remotefile, fd, port, &option); | 1031 | + result = tftp(cmd, host, remotefile, fd, port, &option); |
1032 | 1032 | ||
1033 | #ifdef CONFIG_FEATURE_CLEAN_UP | 1033 | #ifdef CONFIG_FEATURE_CLEAN_UP |
1034 | if (!(fd == fileno(stdout) || fd == fileno(stdin))) { | 1034 | if (!(fd == fileno(stdout) || fd == fileno(stdin))) { |
1035 | @@ -582,3 +980,18 @@ | 1035 | @@ -582,3 +980,18 @@ |
diff --git a/patches/udhcp_additional_items.diff b/patches/udhcp_additional_items.diff index 262ccc266..933be2ad4 100644 --- a/patches/udhcp_additional_items.diff +++ b/patches/udhcp_additional_items.diff | |||
@@ -12,7 +12,7 @@ diff -u -r1.191 usage.h | |||
12 | + "\t-R,\t--require=NAME\tAdd NAME to request\n" \ | 12 | + "\t-R,\t--require=NAME\tAdd NAME to request\n" \ |
13 | "\t-s,\t--script=file\tRun file at dhcp events (default: /usr/share/udhcpc/default.script)\n" \ | 13 | "\t-s,\t--script=file\tRun file at dhcp events (default: /usr/share/udhcpc/default.script)\n" \ |
14 | "\t-v,\t--version\tDisplay version" | 14 | "\t-v,\t--version\tDisplay version" |
15 | 15 | ||
16 | Index: networking/udhcp/README.udhcpc | 16 | Index: networking/udhcp/README.udhcpc |
17 | =================================================================== | 17 | =================================================================== |
18 | RCS file: /var/cvs/busybox/networking/udhcp/README.udhcpc,v | 18 | RCS file: /var/cvs/busybox/networking/udhcp/README.udhcpc,v |
@@ -29,12 +29,12 @@ diff -u -r1.3 README.udhcpc | |||
29 | /usr/share/udhcpc/default.script) | 29 | /usr/share/udhcpc/default.script) |
30 | -v, --version Display version | 30 | -v, --version Display version |
31 | @@ -101,6 +102,8 @@ | 31 | @@ -101,6 +102,8 @@ |
32 | 32 | ||
33 | additional options are easily added in options.c. | 33 | additional options are easily added in options.c. |
34 | 34 | ||
35 | +By default, only a few basic items are requested. To request additional | 35 | +By default, only a few basic items are requested. To request additional |
36 | +items use the -R option. Example: "-R rootpath" | 36 | +items use the -R option. Example: "-R rootpath" |
37 | 37 | ||
38 | note on udhcpc's random seed | 38 | note on udhcpc's random seed |
39 | --------------------------- | 39 | --------------------------- |
40 | Index: networking/udhcp/dhcpc.c | 40 | Index: networking/udhcp/dhcpc.c |
@@ -67,7 +67,7 @@ diff -u -r1.16 dhcpc.c | |||
67 | - c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:s:v", arg_options, &option_index); | 67 | - c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:s:v", arg_options, &option_index); |
68 | + c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:R:s:v", arg_options, &option_index); | 68 | + c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:R:s:v", arg_options, &option_index); |
69 | if (c == -1) break; | 69 | if (c == -1) break; |
70 | 70 | ||
71 | switch (c) { | 71 | switch (c) { |
72 | @@ -254,6 +256,11 @@ | 72 | @@ -254,6 +256,11 @@ |
73 | case 'r': | 73 | case 'r': |
@@ -91,7 +91,7 @@ diff -u -r1.7 options.c | |||
91 | @@ -57,7 +57,19 @@ | 91 | @@ -57,7 +57,19 @@ |
92 | [OPTION_S32] = 4 | 92 | [OPTION_S32] = 4 |
93 | }; | 93 | }; |
94 | 94 | ||
95 | - | 95 | - |
96 | +/* find and mark requested item as required */ | 96 | +/* find and mark requested item as required */ |
97 | +int require_option(char *name) | 97 | +int require_option(char *name) |
@@ -105,7 +105,7 @@ diff -u -r1.7 options.c | |||
105 | + } | 105 | + } |
106 | + return 1; | 106 | + return 1; |
107 | +} | 107 | +} |
108 | + | 108 | + |
109 | /* get an option with bounds checking (warning, not aligned). */ | 109 | /* get an option with bounds checking (warning, not aligned). */ |
110 | uint8_t *get_option(struct dhcpMessage *packet, int code) | 110 | uint8_t *get_option(struct dhcpMessage *packet, int code) |
111 | { | 111 | { |
@@ -119,7 +119,7 @@ diff -u -r1.5 options.h | |||
119 | @@ -30,6 +30,7 @@ | 119 | @@ -30,6 +30,7 @@ |
120 | extern struct dhcp_option dhcp_options[]; | 120 | extern struct dhcp_option dhcp_options[]; |
121 | extern int option_lengths[]; | 121 | extern int option_lengths[]; |
122 | 122 | ||
123 | +int require_option(char *name); | 123 | +int require_option(char *name); |
124 | uint8_t *get_option(struct dhcpMessage *packet, int code); | 124 | uint8_t *get_option(struct dhcpMessage *packet, int code); |
125 | int end_option(uint8_t *optionptr); | 125 | int end_option(uint8_t *optionptr); |
diff --git a/patches/udhcp_config_paths.diff b/patches/udhcp_config_paths.diff index 299a68a8e..1d3a6b4b0 100644 --- a/patches/udhcp_config_paths.diff +++ b/patches/udhcp_config_paths.diff | |||
@@ -13,7 +13,7 @@ diff -u -r1.191 usage.h | |||
13 | + "\t-s,\t--script=file\tRun file at dhcp events (default: " \ | 13 | + "\t-s,\t--script=file\tRun file at dhcp events (default: " \ |
14 | + CONFIG_UDHCPC_SCRIPT_PATH ")\n" \ | 14 | + CONFIG_UDHCPC_SCRIPT_PATH ")\n" \ |
15 | "\t-v,\t--version\tDisplay version" | 15 | "\t-v,\t--version\tDisplay version" |
16 | 16 | ||
17 | #define udhcpd_trivial_usage \ | 17 | #define udhcpd_trivial_usage \ |
18 | Index: networking/udhcp/AUTHORS | 18 | Index: networking/udhcp/AUTHORS |
19 | =================================================================== | 19 | =================================================================== |
@@ -24,11 +24,11 @@ diff -u -r1.3 AUTHORS | |||
24 | +++ b/networking/udhcp/AUTHORS 5 Mar 2004 13:20:11 -0000 | 24 | +++ b/networking/udhcp/AUTHORS 5 Mar 2004 13:20:11 -0000 |
25 | @@ -10,5 +10,5 @@ | 25 | @@ -10,5 +10,5 @@ |
26 | Moreton Bay (http://www.moretonbay.com/) | 26 | Moreton Bay (http://www.moretonbay.com/) |
27 | Lineo (http://opensource.lineo.com) | ||
28 | Vladimir Oleynik <dzo@simtrea.ru> Size optimizations | 27 | Vladimir Oleynik <dzo@simtrea.ru> Size optimizations |
28 | |||
29 | - | 29 | - |
30 | +Tony J. White <tjw@tjw.org> additional busybox build options | 30 | +Tony J. White <tjw@tjw.org> additional busybox build options |
31 | 31 | ||
32 | Index: networking/udhcp/Config.in | 32 | Index: networking/udhcp/Config.in |
33 | =================================================================== | 33 | =================================================================== |
34 | RCS file: /var/cvs/busybox/networking/udhcp/Config.in,v | 34 | RCS file: /var/cvs/busybox/networking/udhcp/Config.in,v |
@@ -37,32 +37,32 @@ diff -u -r1.5 Config.in | |||
37 | --- a/networking/udhcp/Config.in 22 Oct 2003 09:58:38 -0000 1.5 | 37 | --- a/networking/udhcp/Config.in 22 Oct 2003 09:58:38 -0000 1.5 |
38 | +++ b/networking/udhcp/Config.in 5 Mar 2004 13:20:11 -0000 | 38 | +++ b/networking/udhcp/Config.in 5 Mar 2004 13:20:11 -0000 |
39 | @@ -58,5 +58,62 @@ | 39 | @@ -58,5 +58,62 @@ |
40 | 40 | ||
41 | See http://udhcp.busybox.net for further details. | 41 | See http://udhcp.busybox.net for further details. |
42 | 42 | ||
43 | +menu "udhcpd Configuration Options" | 43 | +menu "udhcpd Configuration Options" |
44 | + depends on CONFIG_UDHCPD | 44 | + depends on CONFIG_UDHCPD |
45 | + | 45 | + |
46 | +config CONFIG_UDHCPD_CONF_PATH | 46 | +config CONFIG_UDHCPD_CONF_PATH |
47 | + string "Path to default udhcpd.conf" | 47 | + string "Path to default udhcpd.conf" |
48 | + default "/etc/udhcpd.conf" | 48 | + default "/etc/udhcpd.conf" |
49 | + depends on CONFIG_UDHCPD | 49 | + depends on CONFIG_UDHCPD |
50 | + help | 50 | + help |
51 | + The full path to udhcpd's default configuration file. | 51 | + The full path to udhcpd's default configuration file. |
52 | + (default is: /etc/udhcpd.conf) | 52 | + (default is: /etc/udhcpd.conf) |
53 | + | 53 | + |
54 | +config CONFIG_UDHCPD_LEASE_PATH | 54 | +config CONFIG_UDHCPD_LEASE_PATH |
55 | + string "Path to default udhcpd.leases" | 55 | + string "Path to default udhcpd.leases" |
56 | + default "/var/lib/misc/udhcpd.leases" | 56 | + default "/var/lib/misc/udhcpd.leases" |
57 | + depends on CONFIG_UDHCPD | 57 | + depends on CONFIG_UDHCPD |
58 | + help | 58 | + help |
59 | + The full path to udhcpd's default leases file. | 59 | + The full path to udhcpd's default leases file. |
60 | + (default is: /var/lib/misc/udhcpd.leases) | 60 | + (default is: /var/lib/misc/udhcpd.leases) |
61 | + | 61 | + |
62 | +config CONFIG_UDHCPD_PID_PATH | 62 | +config CONFIG_UDHCPD_PID_PATH |
63 | + string "Path to default udhcpd PID file" | 63 | + string "Path to default udhcpd PID file" |
64 | + default "/var/run/udhcpd.pid" | 64 | + default "/var/run/udhcpd.pid" |
65 | + depends on CONFIG_UDHCPD | 65 | + depends on CONFIG_UDHCPD |
66 | + help | 66 | + help |
67 | + The full path to udhcpd's default pid file. | 67 | + The full path to udhcpd's default pid file. |
68 | + (default is: /var/run/udhcpd.pid) | 68 | + (default is: /var/run/udhcpd.pid) |
@@ -79,26 +79,26 @@ diff -u -r1.5 Config.in | |||
79 | + The full path to udhcpc's default event script file. | 79 | + The full path to udhcpc's default event script file. |
80 | + (default is: /usr/share/udhcpc/default.script OR | 80 | + (default is: /usr/share/udhcpc/default.script OR |
81 | + /share/udhcpc/default.script if CONFIG_INSTALL_NO_USR is set) | 81 | + /share/udhcpc/default.script if CONFIG_INSTALL_NO_USR is set) |
82 | + | 82 | + |
83 | + When udhcpc is started it executes this script to take care | 83 | + When udhcpc is started it executes this script to take care |
84 | + of system tasks after it completes DHCP communication. Such | 84 | + of system tasks after it completes DHCP communication. Such |
85 | + tasks include putting network interfaces up or down, setting | 85 | + tasks include putting network interfaces up or down, setting |
86 | + DNS info, adding routing information, etc. | 86 | + DNS info, adding routing information, etc. |
87 | + | 87 | + |
88 | +if CONFIG_INSTALL_NO_USR | 88 | +if CONFIG_INSTALL_NO_USR |
89 | +config CONFIG_UDHCPC_SCRIPT_PATH | 89 | +config CONFIG_UDHCPC_SCRIPT_PATH |
90 | + default "/share/udhcpc/default.script" | 90 | + default "/share/udhcpc/default.script" |
91 | +endif | 91 | +endif |
92 | + | 92 | + |
93 | +if !CONFIG_INSTALL_NO_USR | 93 | +if !CONFIG_INSTALL_NO_USR |
94 | +config CONFIG_UDHCPC_SCRIPT_PATH | 94 | +config CONFIG_UDHCPC_SCRIPT_PATH |
95 | + default "/usr/share/udhcpc/default.script" | 95 | + default "/usr/share/udhcpc/default.script" |
96 | +endif | 96 | +endif |
97 | + | 97 | + |
98 | +endmenu | 98 | +endmenu |
99 | + | 99 | + |
100 | endmenu | 100 | endmenu |
101 | 101 | ||
102 | Index: networking/udhcp/README | 102 | Index: networking/udhcp/README |
103 | =================================================================== | 103 | =================================================================== |
104 | RCS file: /var/cvs/busybox/networking/udhcp/README,v | 104 | RCS file: /var/cvs/busybox/networking/udhcp/README,v |
@@ -109,33 +109,33 @@ diff -u -r1.3 README | |||
109 | @@ -9,27 +9,42 @@ | 109 | @@ -9,27 +9,42 @@ |
110 | compile time options | 110 | compile time options |
111 | ------------------- | 111 | ------------------- |
112 | 112 | ||
113 | -The Makefile contains three of the compile time options: | 113 | -The Makefile contains three of the compile time options: |
114 | +The following options can be adjusted when configuring busybox: | 114 | +The following options can be adjusted when configuring busybox: |
115 | 115 | ||
116 | - UDHCP_DEBUG: If UDHCP_DEBUG is defined, udhcpd will output extra | 116 | - UDHCP_DEBUG: If UDHCP_DEBUG is defined, udhcpd will output extra |
117 | - debugging output, compile with -g, and not fork to the background when | 117 | - debugging output, compile with -g, and not fork to the background when |
118 | - run. | 118 | - run. |
119 | - UDHCP_SYSLOG: If UDHCP_SYSLOG is defined, udhcpd will log all its | 119 | - UDHCP_SYSLOG: If UDHCP_SYSLOG is defined, udhcpd will log all its |
120 | - messages syslog, otherwise, it will attempt to log them to stdout. | 120 | - messages syslog, otherwise, it will attempt to log them to stdout. |
121 | - | 121 | - |
122 | - COMBINED_BINARY: If COMBINED_BINARY is define, one binary, udhcpd, | 122 | - COMBINED_BINARY: If COMBINED_BINARY is define, one binary, udhcpd, |
123 | - is created. If called as udhcpd, the dhcp server will be started. | 123 | - is created. If called as udhcpd, the dhcp server will be started. |
124 | - If called as udhcpc, the dhcp client will be started. | 124 | - If called as udhcpc, the dhcp client will be started. |
125 | - | 125 | - |
126 | -dhcpd.h contains the other three compile time options: | 126 | -dhcpd.h contains the other three compile time options: |
127 | - | 127 | - |
128 | - LEASE_TIME: The default lease time if not specified in the config | 128 | - LEASE_TIME: The default lease time if not specified in the config |
129 | - file. | 129 | - file. |
130 | + CONFIG_FEATURE_UDHCP_DEBUG: | 130 | + CONFIG_FEATURE_UDHCP_DEBUG: |
131 | + If this is defined, udhcpd will output extra debugging output, | 131 | + If this is defined, udhcpd will output extra debugging output, |
132 | + compile with -g, and not fork to the background when run. | 132 | + compile with -g, and not fork to the background when run. |
133 | 133 | ||
134 | - LEASES_FILE: The default file for storing leases. | 134 | - LEASES_FILE: The default file for storing leases. |
135 | - | 135 | - |
136 | - DHCPD_CONFIG_FILE: The defualt config file to use. | 136 | - DHCPD_CONFIG_FILE: The defualt config file to use. |
137 | + CONFIG_FEATURE_UDHCP_SYSLOG: | 137 | + CONFIG_FEATURE_UDHCP_SYSLOG: |
138 | + If this is defined, udhcpd will log all its messages syslog, | 138 | + If this is defined, udhcpd will log all its messages syslog, |
139 | + otherwise, it will attempt to log them to stdout. | 139 | + otherwise, it will attempt to log them to stdout. |
140 | + | 140 | + |
141 | + CONFIG_UDHCPD_CONF_PATH: | 141 | + CONFIG_UDHCPD_CONF_PATH: |
@@ -158,14 +158,14 @@ diff -u -r1.3 README | |||
158 | + | 158 | + |
159 | + | 159 | + |
160 | +dhcpd.h contains the another compile time option: | 160 | +dhcpd.h contains the another compile time option: |
161 | 161 | ||
162 | + LEASE_TIME: | 162 | + LEASE_TIME: |
163 | + The default lease time if not specified in the config file. | 163 | + The default lease time if not specified in the config file. |
164 | + This option can also be changed at runtime with the 'lease' | 164 | + This option can also be changed at runtime with the 'lease' |
165 | + configuration option. | 165 | + configuration option. |
166 | + | 166 | + |
167 | options.c contains a set of dhcp options for the client: | 167 | options.c contains a set of dhcp options for the client: |
168 | 168 | ||
169 | name[10]: The name of the option as it will appear in scripts | 169 | name[10]: The name of the option as it will appear in scripts |
170 | Index: networking/udhcp/README.udhcpc | 170 | Index: networking/udhcp/README.udhcpc |
171 | =================================================================== | 171 | =================================================================== |
@@ -182,8 +182,8 @@ diff -u -r1.3 README.udhcpc | |||
182 | + /usr/share/udhcpc/default.script or | 182 | + /usr/share/udhcpc/default.script or |
183 | + CONFIG_UDHCPC_SCRIPT_PATH at build time) | 183 | + CONFIG_UDHCPC_SCRIPT_PATH at build time) |
184 | -v, --version Display version | 184 | -v, --version Display version |
185 | 185 | ||
186 | 186 | ||
187 | Index: networking/udhcp/README.udhcpd | 187 | Index: networking/udhcp/README.udhcpd |
188 | =================================================================== | 188 | =================================================================== |
189 | RCS file: /var/cvs/busybox/networking/udhcp/README.udhcpd,v | 189 | RCS file: /var/cvs/busybox/networking/udhcp/README.udhcpd,v |
@@ -192,21 +192,21 @@ diff -u -r1.1 README.udhcpd | |||
192 | --- a/networking/udhcp/README.udhcpd 31 Oct 2002 19:21:27 -0000 1.1 | 192 | --- a/networking/udhcp/README.udhcpd 31 Oct 2002 19:21:27 -0000 1.1 |
193 | +++ b/networking/udhcp/README.udhcpd 5 Mar 2004 13:20:11 -0000 | 193 | +++ b/networking/udhcp/README.udhcpd 5 Mar 2004 13:20:11 -0000 |
194 | @@ -50,10 +50,14 @@ | 194 | @@ -50,10 +50,14 @@ |
195 | 195 | ||
196 | compile time options | 196 | compile time options |
197 | ------------------- | 197 | ------------------- |
198 | + | 198 | + |
199 | +During busybox configuration, you can change the default paths for | 199 | +During busybox configuration, you can change the default paths for |
200 | +udhcpd.conf, udhcpd.leases, and udhcpd.pid files. See README for | 200 | +udhcpd.conf, udhcpd.leases, and udhcpd.pid files. See README for |
201 | +more details. | 201 | +more details. |
202 | 202 | ||
203 | -dhcpd.h contains the other two compile time options: | 203 | -dhcpd.h contains the other two compile time options: |
204 | +dhcpd.h contains the compile time option: | 204 | +dhcpd.h contains the compile time option: |
205 | 205 | ||
206 | LEASE_TIME: The default lease time if not specified in the config | 206 | LEASE_TIME: The default lease time if not specified in the config |
207 | file. | 207 | file. |
208 | + | 208 | + |
209 | 209 | ||
210 | - DHCPD_CONFIG_FILE: The defualt config file to use. | 210 | - DHCPD_CONFIG_FILE: The defualt config file to use. |
211 | Index: networking/udhcp/dhcpc.h | 211 | Index: networking/udhcp/dhcpc.h |
212 | =================================================================== | 212 | =================================================================== |
@@ -218,14 +218,14 @@ diff -u -r1.4 dhcpc.h | |||
218 | @@ -2,7 +2,11 @@ | 218 | @@ -2,7 +2,11 @@ |
219 | #ifndef _DHCPC_H | 219 | #ifndef _DHCPC_H |
220 | #define _DHCPC_H | 220 | #define _DHCPC_H |
221 | 221 | ||
222 | -#define DEFAULT_SCRIPT "/usr/share/udhcpc/default.script" | 222 | -#define DEFAULT_SCRIPT "/usr/share/udhcpc/default.script" |
223 | +#ifdef CONFIG_UDHCPC_SCRIPT_PATH | 223 | +#ifdef CONFIG_UDHCPC_SCRIPT_PATH |
224 | + #define DEFAULT_SCRIPT CONFIG_UDHCPC_SCRIPT_PATH | 224 | + #define DEFAULT_SCRIPT CONFIG_UDHCPC_SCRIPT_PATH |
225 | +#else | 225 | +#else |
226 | + #define DEFAULT_SCRIPT "/usr/share/udhcpc/default.script" | 226 | + #define DEFAULT_SCRIPT "/usr/share/udhcpc/default.script" |
227 | +#endif | 227 | +#endif |
228 | 228 | ||
229 | /* allow libbb_udhcp.h to redefine DEFAULT_SCRIPT */ | 229 | /* allow libbb_udhcp.h to redefine DEFAULT_SCRIPT */ |
230 | #include "libbb_udhcp.h" | 230 | #include "libbb_udhcp.h" |
231 | Index: networking/udhcp/dhcpd.c | 231 | Index: networking/udhcp/dhcpd.c |
@@ -240,25 +240,25 @@ diff -u -r1.5 dhcpd.c | |||
240 | int max_sock; | 240 | int max_sock; |
241 | unsigned long num_ips; | 241 | unsigned long num_ips; |
242 | + int daemonize = 1; | 242 | + int daemonize = 1; |
243 | + | 243 | + |
244 | + while (strcmp(argv[1],"-f")==0 || strcmp(argv[1],"--foreground")==0) { | 244 | + while (strcmp(argv[1],"-f")==0 || strcmp(argv[1],"--foreground")==0) { |
245 | + daemonize = 0; | 245 | + daemonize = 0; |
246 | + argv++; | 246 | + argv++; |
247 | + argc--; | 247 | + argc--; |
248 | + } | 248 | + } |
249 | 249 | ||
250 | memset(&server_config, 0, sizeof(struct server_config_t)); | 250 | memset(&server_config, 0, sizeof(struct server_config_t)); |
251 | read_config(argc < 2 ? DHCPD_CONF_FILE : argv[1]); | 251 | read_config(argc < 2 ? DHCPD_CONF_FILE : argv[1]); |
252 | @@ -99,9 +106,8 @@ | 252 | @@ -99,9 +106,8 @@ |
253 | &server_config.server, server_config.arp) < 0) | 253 | &server_config.server, server_config.arp) < 0) |
254 | return 1; | 254 | return 1; |
255 | 255 | ||
256 | -#ifndef UDHCP_DEBUG | 256 | -#ifndef UDHCP_DEBUG |
257 | - background(server_config.pidfile); /* hold lock during fork. */ | 257 | - background(server_config.pidfile); /* hold lock during fork. */ |
258 | -#endif | 258 | -#endif |
259 | + if(daemonize) | 259 | + if(daemonize) |
260 | + background(server_config.pidfile); /* hold lock during fork. */ | 260 | + background(server_config.pidfile); /* hold lock during fork. */ |
261 | 261 | ||
262 | /* Setup the signal pipe */ | 262 | /* Setup the signal pipe */ |
263 | udhcp_sp_setup(); | 263 | udhcp_sp_setup(); |
264 | Index: networking/udhcp/dhcpd.h | 264 | Index: networking/udhcp/dhcpd.h |
@@ -269,7 +269,7 @@ diff -u -r1.5 dhcpd.h | |||
269 | --- a/networking/udhcp/dhcpd.h 30 Jan 2004 23:45:12 -0000 1.5 | 269 | --- a/networking/udhcp/dhcpd.h 30 Jan 2004 23:45:12 -0000 1.5 |
270 | +++ b/networking/udhcp/dhcpd.h 5 Mar 2004 13:20:12 -0000 | 270 | +++ b/networking/udhcp/dhcpd.h 5 Mar 2004 13:20:12 -0000 |
271 | @@ -15,11 +15,25 @@ | 271 | @@ -15,11 +15,25 @@ |
272 | 272 | ||
273 | /* the period of time the client is allowed to use that address */ | 273 | /* the period of time the client is allowed to use that address */ |
274 | #define LEASE_TIME (60*60*24*10) /* 10 days of seconds */ | 274 | #define LEASE_TIME (60*60*24*10) /* 10 days of seconds */ |
275 | -#define LEASES_FILE "/var/lib/misc/udhcpd.leases" | 275 | -#define LEASES_FILE "/var/lib/misc/udhcpd.leases" |
@@ -279,7 +279,7 @@ diff -u -r1.5 dhcpd.h | |||
279 | +#else | 279 | +#else |
280 | + #define LEASES_FILE "/var/lib/misc/udhcpd.leases" | 280 | + #define LEASES_FILE "/var/lib/misc/udhcpd.leases" |
281 | +#endif | 281 | +#endif |
282 | 282 | ||
283 | /* where to find the DHCP server configuration file */ | 283 | /* where to find the DHCP server configuration file */ |
284 | -#define DHCPD_CONF_FILE "/etc/udhcpd.conf" | 284 | -#define DHCPD_CONF_FILE "/etc/udhcpd.conf" |
285 | +#ifdef CONFIG_UDHCPD_CONF_PATH | 285 | +#ifdef CONFIG_UDHCPD_CONF_PATH |
@@ -287,7 +287,7 @@ diff -u -r1.5 dhcpd.h | |||
287 | +#else | 287 | +#else |
288 | + #define DHCPD_CONF_FILE "/etc/udhcpd.conf" | 288 | + #define DHCPD_CONF_FILE "/etc/udhcpd.conf" |
289 | +#endif | 289 | +#endif |
290 | 290 | ||
291 | +#ifdef CONFIG_UDHCPD_PID_PATH | 291 | +#ifdef CONFIG_UDHCPD_PID_PATH |
292 | + #define DHCPD_PID_FILE CONFIG_UDHCPD_PID_PATH | 292 | + #define DHCPD_PID_FILE CONFIG_UDHCPD_PID_PATH |
293 | +#else | 293 | +#else |
@@ -322,7 +322,7 @@ diff -u -r1.5 libbb_udhcp.h | |||
322 | @@ -3,11 +3,6 @@ | 322 | @@ -3,11 +3,6 @@ |
323 | /* bit of a hack, do this no matter what the order of the includes. | 323 | /* bit of a hack, do this no matter what the order of the includes. |
324 | * (for busybox) */ | 324 | * (for busybox) */ |
325 | 325 | ||
326 | -#ifdef CONFIG_INSTALL_NO_USR | 326 | -#ifdef CONFIG_INSTALL_NO_USR |
327 | -#undef DEFUALT_SCRIPT | 327 | -#undef DEFUALT_SCRIPT |
328 | -#define DEFAULT_SCRIPT "/share/udhcpc/default.script" | 328 | -#define DEFAULT_SCRIPT "/share/udhcpc/default.script" |
@@ -330,4 +330,4 @@ diff -u -r1.5 libbb_udhcp.h | |||
330 | - | 330 | - |
331 | #ifndef _LIBBB_UDHCP_H | 331 | #ifndef _LIBBB_UDHCP_H |
332 | #define _LIBBB_UDHCP_H | 332 | #define _LIBBB_UDHCP_H |
333 | 333 | ||
diff --git a/patches/udhcpd_foreground.diff b/patches/udhcpd_foreground.diff index 9f1e3b913..3b8c7eb0c 100644 --- a/patches/udhcpd_foreground.diff +++ b/patches/udhcpd_foreground.diff | |||
@@ -10,24 +10,24 @@ diff -u -r1.5 dhcpd.c | |||
10 | int max_sock; | 10 | int max_sock; |
11 | unsigned long num_ips; | 11 | unsigned long num_ips; |
12 | + int daemonize = 1; | 12 | + int daemonize = 1; |
13 | + | 13 | + |
14 | + while (strcmp(argv[1],"-f")==0 || strcmp(argv[1],"--foreground")==0) { | 14 | + while (strcmp(argv[1],"-f")==0 || strcmp(argv[1],"--foreground")==0) { |
15 | + daemonize = 0; | 15 | + daemonize = 0; |
16 | + argv++; | 16 | + argv++; |
17 | + argc--; | 17 | + argc--; |
18 | + } | 18 | + } |
19 | 19 | ||
20 | memset(&server_config, 0, sizeof(struct server_config_t)); | 20 | memset(&server_config, 0, sizeof(struct server_config_t)); |
21 | read_config(argc < 2 ? DHCPD_CONF_FILE : argv[1]); | 21 | read_config(argc < 2 ? DHCPD_CONF_FILE : argv[1]); |
22 | @@ -99,9 +106,8 @@ | 22 | @@ -99,9 +106,8 @@ |
23 | &server_config.server, server_config.arp) < 0) | 23 | &server_config.server, server_config.arp) < 0) |
24 | return 1; | 24 | return 1; |
25 | 25 | ||
26 | -#ifndef UDHCP_DEBUG | 26 | -#ifndef UDHCP_DEBUG |
27 | - background(server_config.pidfile); /* hold lock during fork. */ | 27 | - background(server_config.pidfile); /* hold lock during fork. */ |
28 | -#endif | 28 | -#endif |
29 | + if(daemonize) | 29 | + if(daemonize) |
30 | + background(server_config.pidfile); /* hold lock during fork. */ | 30 | + background(server_config.pidfile); /* hold lock during fork. */ |
31 | 31 | ||
32 | /* Setup the signal pipe */ | 32 | /* Setup the signal pipe */ |
33 | udhcp_sp_setup(); | 33 | udhcp_sp_setup(); |