-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy path获取不到ip,dhcp超时时间是30s,把超时时间增大到90s.patch
48 lines (42 loc) · 2.23 KB
/
获取不到ip,dhcp超时时间是30s,把超时时间增大到90s.patch
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
commit 2d1de25c4bff1d60a17ae274a6d9fff154272446
Author: blb <[email protected]>
Date: Mon Jun 1 11:04:00 2015 +0800
Increase dhcpcd's Timeout from 30s to 60s for dealing with terrible network.
diff --git a/libnetutils/dhcp_utils.c b/libnetutils/dhcp_utils.c
index e1df874..3b6f972 100644
--- a/libnetutils/dhcp_utils.c
+++ b/libnetutils/dhcp_utils.c
@@ -218,10 +218,10 @@ int dhcp_do_request(const char *interface,
/* Start the daemon and wait until it's ready */
if (property_get(HOSTNAME_PROP_NAME, prop_value, NULL) && (prop_value[0] != '\0'))
- snprintf(daemon_cmd, sizeof(daemon_cmd), "%s_%s:-f %s -h %s %s", DAEMON_NAME,
+ snprintf(daemon_cmd, sizeof(daemon_cmd), "%s_%s:-f %s -h %s %s -t 60", DAEMON_NAME,
p2p_interface, DHCP_CONFIG_PATH, prop_value, interface);
else
- snprintf(daemon_cmd, sizeof(daemon_cmd), "%s_%s:-f %s %s", DAEMON_NAME,
+ snprintf(daemon_cmd, sizeof(daemon_cmd), "%s_%s:-f %s %s -t 60", DAEMON_NAME,
p2p_interface, DHCP_CONFIG_PATH, interface);
memset(prop_value, '\0', PROPERTY_VALUE_MAX);
property_set(ctrl_prop, daemon_cmd);
@@ -231,7 +231,7 @@ int dhcp_do_request(const char *interface,
}
/* Wait for the daemon to return a result */
- if (wait_for_property(result_prop_name, NULL, 30) < 0) {
+ if (wait_for_property(result_prop_name, NULL, 60) < 0) {
snprintf(errmsg, sizeof(errmsg), "%s", "Timed out waiting for DHCP to finish");
return -1;
}
@@ -355,13 +355,13 @@ int dhcp_do_request_renew(const char *interface,
property_set(result_prop_name, "");
/* Start the renew daemon and wait until it's ready */
- snprintf(daemon_cmd, sizeof(daemon_cmd), "%s_%s:%s", DAEMON_NAME_RENEW,
+ snprintf(daemon_cmd, sizeof(daemon_cmd), "%s_%s:%s -t 60", DAEMON_NAME_RENEW,
p2p_interface, interface);
memset(prop_value, '\0', PROPERTY_VALUE_MAX);
property_set(ctrl_prop, daemon_cmd);
/* Wait for the daemon to return a result */
- if (wait_for_property(result_prop_name, NULL, 30) < 0) {
+ if (wait_for_property(result_prop_name, NULL, 60) < 0) {
snprintf(errmsg, sizeof(errmsg), "%s", "Timed out waiting for DHCP Renew to finish");
return -1;
}