1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
#
# Patch managed by http://www.holgerschurig.de/patcher.html
#
--- busybox-1.00-rc3/networking/udhcp/dhcpc.c~dhcpretrytime
+++ busybox-1.00-rc3/networking/udhcp/dhcpc.c
@@ -48,6 +48,7 @@
static unsigned long requested_ip; /* = 0 */
static unsigned long server_addr;
static unsigned long timeout;
+static unsigned long retrytime = 60;
static int packet_num; /* = 0 */
static int fd = -1;
@@ -90,6 +91,7 @@
" -r, --request=IP IP address to request (default: none)\n"
" -s, --script=file Run file at dhcp events (default:\n"
" " DEFAULT_SCRIPT ")\n"
+" -t, --retrytime time to retry DHCP request (default 60s)\n")
" -v, --version Display version\n"
);
exit(0);
@@ -204,6 +206,7 @@
{"quit", no_argument, 0, 'q'},
{"request", required_argument, 0, 'r'},
{"script", required_argument, 0, 's'},
+ {"retrytime", required_argument, 0, 't'},
{"version", no_argument, 0, 'v'},
{0, 0, 0, 0}
};
@@ -211,7 +214,7 @@
/* get options */
while (1) {
int option_index = 0;
- c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:s:v", arg_options, &option_index);
+ c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:s:t:v", arg_options, &option_index);
if (c == -1) break;
switch (c) {
@@ -257,6 +260,9 @@
case 's':
client_config.script = optarg;
break;
+ case 't':
+ retrytime = atol(optarg);
+ break;
case 'v':
printf("udhcpcd, version %s\n\n", VERSION);
return 0;
@@ -335,7 +341,7 @@
}
/* wait to try again */
packet_num = 0;
- timeout = now + 60;
+ timeout = now + retrytime;
}
break;
case RENEW_REQUESTED:
--- busybox-1.00-rc3/networking/ifupdown.c~dhcpretrytime
+++ busybox-1.00-rc3/networking/ifupdown.c
@@ -538,7 +538,7 @@
static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
{
if (execable("/sbin/udhcpc")) {
- return( execute("udhcpc -n -p /var/run/udhcpc.%iface%.pid -i "
+ return( execute("udhcpc -b -p /var/run/udhcpc.%iface%.pid -i "
"%iface% [[-H %hostname%]] [[-c %clientid%]]", ifd, exec));
} else if (execable("/sbin/pump")) {
return( execute("pump -i %iface% [[-h %hostname%]] [[-l %leasehours%]]", ifd, exec));
@@ -558,8 +558,8 @@
/* SIGUSR2 forces udhcpc to release the current lease and go inactive,
* and SIGTERM causes udhcpc to exit. Signals are queued and processed
* sequentially so we don't need to sleep */
- result = execute("kill -USR2 `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec);
- result += execute("kill -TERM `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec);
+ result = execute("kill -USR2 `cat /var/run/udhcpc.%iface%.pid 2>/dev/null` 2>/dev/null", ifd, exec);
+ result += execute("kill -TERM `cat /var/run/udhcpc.%iface%.pid 2>/dev/null` 2>/dev/null", ifd, exec);
} else if (execable("/sbin/pump")) {
result = execute("pump -i %iface% -k", ifd, exec);
} else if (execable("/sbin/dhclient")) {
|