diff options
author | Ron Yorston <rmy@pobox.com> | 2015-10-31 17:13:47 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2015-10-31 17:13:47 +0000 |
commit | 4432dbba6559d3d88e18ecf2c33d9e5a39e82074 (patch) | |
tree | f6db886523a04e0b45926336223ff8c32761dc43 /networking | |
parent | bc09f29f78547856e2152dc47051aeed548f28e8 (diff) | |
parent | 6bd3fff51aa74e2ee2d87887b12182a3b09792ef (diff) | |
download | busybox-w32-4432dbba6559d3d88e18ecf2c33d9e5a39e82074.tar.gz busybox-w32-4432dbba6559d3d88e18ecf2c33d9e5a39e82074.tar.bz2 busybox-w32-4432dbba6559d3d88e18ecf2c33d9e5a39e82074.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'networking')
-rw-r--r-- | networking/Config.src | 2 | ||||
-rw-r--r-- | networking/httpd.c | 25 | ||||
-rw-r--r-- | networking/ifupdown.c | 7 | ||||
-rw-r--r-- | networking/libiproute/ll_map.c | 25 | ||||
-rw-r--r-- | networking/udhcp/dumpleases.c | 28 | ||||
-rw-r--r-- | networking/udhcp/leases.c | 11 | ||||
-rw-r--r-- | networking/wget.c | 47 | ||||
-rw-r--r-- | networking/zcip.c | 8 |
8 files changed, 91 insertions, 62 deletions
diff --git a/networking/Config.src b/networking/Config.src index 8c7417f86..27c604a31 100644 --- a/networking/Config.src +++ b/networking/Config.src | |||
@@ -497,7 +497,7 @@ config FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN | |||
497 | 497 | ||
498 | config FEATURE_INETD_RPC | 498 | config FEATURE_INETD_RPC |
499 | bool "Support RPC services" | 499 | bool "Support RPC services" |
500 | default y | 500 | default n # very rarely used, and needs Sun RPC support in libc |
501 | depends on INETD | 501 | depends on INETD |
502 | select FEATURE_HAVE_RPC | 502 | select FEATURE_HAVE_RPC |
503 | help | 503 | help |
diff --git a/networking/httpd.c b/networking/httpd.c index 00169c36d..ed15fd883 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -967,19 +967,30 @@ static void send_headers(int responseNum) | |||
967 | } | 967 | } |
968 | #endif | 968 | #endif |
969 | if (responseNum == HTTP_MOVED_TEMPORARILY) { | 969 | if (responseNum == HTTP_MOVED_TEMPORARILY) { |
970 | len += sprintf(iobuf + len, "Location: %s/%s%s\r\n", | 970 | /* Responding to "GET /dir" with |
971 | * "HTTP/1.0 302 Found" "Location: /dir/" | ||
972 | * - IOW, asking them to repeat with a slash. | ||
973 | * Here, overflow IS possible, can't use sprintf: | ||
974 | * mkdir test | ||
975 | * python -c 'print("get /test?" + ("x" * 8192))' | busybox httpd -i -h . | ||
976 | */ | ||
977 | len += snprintf(iobuf + len, IOBUF_SIZE-3 - len, | ||
978 | "Location: %s/%s%s\r\n", | ||
971 | found_moved_temporarily, | 979 | found_moved_temporarily, |
972 | (g_query ? "?" : ""), | 980 | (g_query ? "?" : ""), |
973 | (g_query ? g_query : "")); | 981 | (g_query ? g_query : "")); |
982 | if (len > IOBUF_SIZE-3) | ||
983 | len = IOBUF_SIZE-3; | ||
974 | } | 984 | } |
975 | 985 | ||
976 | #if ENABLE_FEATURE_HTTPD_ERROR_PAGES | 986 | #if ENABLE_FEATURE_HTTPD_ERROR_PAGES |
977 | if (error_page && access(error_page, R_OK) == 0) { | 987 | if (error_page && access(error_page, R_OK) == 0) { |
978 | strcat(iobuf, "\r\n"); | 988 | iobuf[len++] = '\r'; |
979 | len += 2; | 989 | iobuf[len++] = '\n'; |
980 | 990 | if (DEBUG) { | |
981 | if (DEBUG) | 991 | iobuf[len] = '\0'; |
982 | fprintf(stderr, "headers: '%s'\n", iobuf); | 992 | fprintf(stderr, "headers: '%s'\n", iobuf); |
993 | } | ||
983 | full_write(STDOUT_FILENO, iobuf, len); | 994 | full_write(STDOUT_FILENO, iobuf, len); |
984 | if (DEBUG) | 995 | if (DEBUG) |
985 | fprintf(stderr, "writing error page: '%s'\n", error_page); | 996 | fprintf(stderr, "writing error page: '%s'\n", error_page); |
@@ -1021,8 +1032,10 @@ static void send_headers(int responseNum) | |||
1021 | responseNum, responseString, | 1032 | responseNum, responseString, |
1022 | responseNum, responseString, infoString); | 1033 | responseNum, responseString, infoString); |
1023 | } | 1034 | } |
1024 | if (DEBUG) | 1035 | if (DEBUG) { |
1036 | iobuf[len] = '\0'; | ||
1025 | fprintf(stderr, "headers: '%s'\n", iobuf); | 1037 | fprintf(stderr, "headers: '%s'\n", iobuf); |
1038 | } | ||
1026 | if (full_write(STDOUT_FILENO, iobuf, len) != len) { | 1039 | if (full_write(STDOUT_FILENO, iobuf, len) != len) { |
1027 | if (verbose > 1) | 1040 | if (verbose > 1) |
1028 | bb_perror_msg("error"); | 1041 | bb_perror_msg("error"); |
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 7c45e8927..d477ff6d1 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -394,8 +394,8 @@ static int FAST_FUNC static_up6(struct interface_defn_t *ifd, execfn *exec) | |||
394 | # if ENABLE_FEATURE_IFUPDOWN_IP | 394 | # if ENABLE_FEATURE_IFUPDOWN_IP |
395 | result = execute("ip addr add %address%/%netmask% dev %iface%[[ label %label%]]", ifd, exec); | 395 | result = execute("ip addr add %address%/%netmask% dev %iface%[[ label %label%]]", ifd, exec); |
396 | result += execute("ip link set[[ mtu %mtu%]][[ addr %hwaddress%]] %iface% up", ifd, exec); | 396 | result += execute("ip link set[[ mtu %mtu%]][[ addr %hwaddress%]] %iface% up", ifd, exec); |
397 | /* Was: "[[ ip ....%gateway% ]]". Removed extra spaces w/o checking */ | 397 | /* Reportedly, IPv6 needs "dev %iface%", but IPv4 does not: */ |
398 | result += execute("[[ip route add ::/0 via %gateway%]][[ metric %metric%]]", ifd, exec); | 398 | result += execute("[[ip route add ::/0 via %gateway% dev %iface%]][[ metric %metric%]]", ifd, exec); |
399 | # else | 399 | # else |
400 | result = execute("ifconfig %iface%[[ media %media%]][[ hw %hwaddress%]][[ mtu %mtu%]] up", ifd, exec); | 400 | result = execute("ifconfig %iface%[[ media %media%]][[ hw %hwaddress%]][[ mtu %mtu%]] up", ifd, exec); |
401 | result += execute("ifconfig %iface% add %address%/%netmask%", ifd, exec); | 401 | result += execute("ifconfig %iface% add %address%/%netmask%", ifd, exec); |
@@ -421,7 +421,8 @@ static int FAST_FUNC v4tunnel_up(struct interface_defn_t *ifd, execfn *exec) | |||
421 | "%endpoint%[[ local %local%]][[ ttl %ttl%]]", ifd, exec); | 421 | "%endpoint%[[ local %local%]][[ ttl %ttl%]]", ifd, exec); |
422 | result += execute("ip link set %iface% up", ifd, exec); | 422 | result += execute("ip link set %iface% up", ifd, exec); |
423 | result += execute("ip addr add %address%/%netmask% dev %iface%", ifd, exec); | 423 | result += execute("ip addr add %address%/%netmask% dev %iface%", ifd, exec); |
424 | result += execute("[[ip route add ::/0 via %gateway%]]", ifd, exec); | 424 | /* Reportedly, IPv6 needs "dev %iface%", but IPv4 does not: */ |
425 | result += execute("[[ip route add ::/0 via %gateway% dev %iface%]]", ifd, exec); | ||
425 | return ((result == 4) ? 4 : 0); | 426 | return ((result == 4) ? 4 : 0); |
426 | } | 427 | } |
427 | 428 | ||
diff --git a/networking/libiproute/ll_map.c b/networking/libiproute/ll_map.c index e2b85fc7b..af9eb46f7 100644 --- a/networking/libiproute/ll_map.c +++ b/networking/libiproute/ll_map.c | |||
@@ -136,7 +136,6 @@ unsigned FAST_FUNC ll_index_to_flags(int idx) | |||
136 | int FAST_FUNC xll_name_to_index(const char *name) | 136 | int FAST_FUNC xll_name_to_index(const char *name) |
137 | { | 137 | { |
138 | int ret = 0; | 138 | int ret = 0; |
139 | int sock_fd; | ||
140 | 139 | ||
141 | /* caching is not warranted - no users which repeatedly call it */ | 140 | /* caching is not warranted - no users which repeatedly call it */ |
142 | #ifdef UNUSED | 141 | #ifdef UNUSED |
@@ -164,30 +163,8 @@ int FAST_FUNC xll_name_to_index(const char *name) | |||
164 | } | 163 | } |
165 | } | 164 | } |
166 | } | 165 | } |
167 | /* We have not found the interface in our cache, but the kernel | ||
168 | * may still know about it. One reason is that we may be using | ||
169 | * module on-demand loading, which means that the kernel will | ||
170 | * load the module and make the interface exist only when | ||
171 | * we explicitely request it (check for dev_load() in net/core/dev.c). | ||
172 | * I can think of other similar scenario, but they are less common... | ||
173 | * Jean II */ | ||
174 | #endif | 166 | #endif |
175 | 167 | ret = if_nametoindex(name); | |
176 | sock_fd = socket(AF_INET, SOCK_DGRAM, 0); | ||
177 | if (sock_fd >= 0) { | ||
178 | struct ifreq ifr; | ||
179 | int tmp; | ||
180 | |||
181 | strncpy_IFNAMSIZ(ifr.ifr_name, name); | ||
182 | ifr.ifr_ifindex = -1; | ||
183 | tmp = ioctl(sock_fd, SIOCGIFINDEX, &ifr); | ||
184 | close(sock_fd); | ||
185 | if (tmp >= 0) | ||
186 | /* In theory, we should redump the interface list | ||
187 | * to update our cache, this is left as an exercise | ||
188 | * to the reader... Jean II */ | ||
189 | ret = ifr.ifr_ifindex; | ||
190 | } | ||
191 | /* out:*/ | 168 | /* out:*/ |
192 | if (ret <= 0) | 169 | if (ret <= 0) |
193 | bb_error_msg_and_die("can't find device '%s'", name); | 170 | bb_error_msg_and_die("can't find device '%s'", name); |
diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c index 64cd73ec7..987cc9aff 100644 --- a/networking/udhcp/dumpleases.c +++ b/networking/udhcp/dumpleases.c | |||
@@ -4,18 +4,20 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | //usage:#define dumpleases_trivial_usage | 6 | //usage:#define dumpleases_trivial_usage |
7 | //usage: "[-r|-a] [-f LEASEFILE]" | 7 | //usage: "[-r|-a] [-d] [-f LEASEFILE]" |
8 | //usage:#define dumpleases_full_usage "\n\n" | 8 | //usage:#define dumpleases_full_usage "\n\n" |
9 | //usage: "Display DHCP leases granted by udhcpd\n" | 9 | //usage: "Display DHCP leases granted by udhcpd\n" |
10 | //usage: IF_LONG_OPTS( | 10 | //usage: IF_LONG_OPTS( |
11 | //usage: "\n -f,--file=FILE Lease file" | 11 | //usage: "\n -f,--file=FILE Lease file" |
12 | //usage: "\n -r,--remaining Show remaining time" | 12 | //usage: "\n -r,--remaining Show remaining time" |
13 | //usage: "\n -a,--absolute Show expiration time" | 13 | //usage: "\n -a,--absolute Show expiration time" |
14 | //usage: "\n -d,--decimal Show time in seconds" | ||
14 | //usage: ) | 15 | //usage: ) |
15 | //usage: IF_NOT_LONG_OPTS( | 16 | //usage: IF_NOT_LONG_OPTS( |
16 | //usage: "\n -f FILE Lease file" | 17 | //usage: "\n -f FILE Lease file" |
17 | //usage: "\n -r Show remaining time" | 18 | //usage: "\n -r Show remaining time" |
18 | //usage: "\n -a Show expiration time" | 19 | //usage: "\n -a Show expiration time" |
20 | //usage: "\n -d Show time in seconds" | ||
19 | //usage: ) | 21 | //usage: ) |
20 | 22 | ||
21 | #include "common.h" | 23 | #include "common.h" |
@@ -28,21 +30,22 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv) | |||
28 | int fd; | 30 | int fd; |
29 | int i; | 31 | int i; |
30 | unsigned opt; | 32 | unsigned opt; |
31 | int64_t written_at, curr, expires_abs; | 33 | int64_t written_at, curr; |
32 | const char *file = LEASES_FILE; | 34 | const char *file = LEASES_FILE; |
33 | struct dyn_lease lease; | 35 | struct dyn_lease lease; |
34 | struct in_addr addr; | ||
35 | 36 | ||
36 | enum { | 37 | enum { |
37 | OPT_a = 0x1, // -a | 38 | OPT_a = 0x1, // -a |
38 | OPT_r = 0x2, // -r | 39 | OPT_r = 0x2, // -r |
39 | OPT_f = 0x4, // -f | 40 | OPT_f = 0x4, // -f |
41 | OPT_d = 0x8, // -d | ||
40 | }; | 42 | }; |
41 | #if ENABLE_LONG_OPTS | 43 | #if ENABLE_LONG_OPTS |
42 | static const char dumpleases_longopts[] ALIGN1 = | 44 | static const char dumpleases_longopts[] ALIGN1 = |
43 | "absolute\0" No_argument "a" | 45 | "absolute\0" No_argument "a" |
44 | "remaining\0" No_argument "r" | 46 | "remaining\0" No_argument "r" |
45 | "file\0" Required_argument "f" | 47 | "file\0" Required_argument "f" |
48 | "decimal\0" No_argument "d" | ||
46 | ; | 49 | ; |
47 | 50 | ||
48 | applet_long_options = dumpleases_longopts; | 51 | applet_long_options = dumpleases_longopts; |
@@ -50,13 +53,16 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv) | |||
50 | init_unicode(); | 53 | init_unicode(); |
51 | 54 | ||
52 | opt_complementary = "=0:a--r:r--a"; | 55 | opt_complementary = "=0:a--r:r--a"; |
53 | opt = getopt32(argv, "arf:", &file); | 56 | opt = getopt32(argv, "arf:d", &file); |
54 | 57 | ||
55 | fd = xopen(file, O_RDONLY); | 58 | fd = xopen(file, O_RDONLY); |
56 | 59 | ||
57 | printf("Mac Address IP Address Host Name Expires %s\n", (opt & OPT_a) ? "at" : "in"); | ||
58 | /* "00:00:00:00:00:00 255.255.255.255 ABCDEFGHIJKLMNOPQRS Wed Jun 30 21:49:08 1993" */ | ||
59 | /* "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 */ | 60 | /* "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 */ |
61 | /* "00:00:00:00:00:00 255.255.255.255 ABCDEFGHIJKLMNOPQRS Wed Jun 30 21:49:08 1993" */ | ||
62 | printf("Mac %-14s" "IP %-13s" "Host %-15s" "Expires %s\n", | ||
63 | "Address", "Address", "Name", | ||
64 | (opt & OPT_a) ? "at" : "in" | ||
65 | ); | ||
60 | 66 | ||
61 | xread(fd, &written_at, sizeof(written_at)); | 67 | xread(fd, &written_at, sizeof(written_at)); |
62 | written_at = SWAP_BE64(written_at); | 68 | written_at = SWAP_BE64(written_at); |
@@ -65,6 +71,9 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv) | |||
65 | written_at = curr; /* lease file from future! :) */ | 71 | written_at = curr; /* lease file from future! :) */ |
66 | 72 | ||
67 | while (full_read(fd, &lease, sizeof(lease)) == sizeof(lease)) { | 73 | while (full_read(fd, &lease, sizeof(lease)) == sizeof(lease)) { |
74 | struct in_addr addr; | ||
75 | int64_t expires_abs; | ||
76 | |||
68 | const char *fmt = ":%02x" + 1; | 77 | const char *fmt = ":%02x" + 1; |
69 | for (i = 0; i < 6; i++) { | 78 | for (i = 0; i < 6; i++) { |
70 | printf(fmt, lease.lease_mac[i]); | 79 | printf(fmt, lease.lease_mac[i]); |
@@ -87,6 +96,13 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv) | |||
87 | puts("expired"); | 96 | puts("expired"); |
88 | continue; | 97 | continue; |
89 | } | 98 | } |
99 | if (opt & OPT_d) { | ||
100 | /* -d: decimal time */ | ||
101 | if (!(opt & OPT_a)) | ||
102 | expires_abs -= curr; | ||
103 | printf("%llu\n", (unsigned long long) expires_abs); | ||
104 | continue; | ||
105 | } | ||
90 | if (!(opt & OPT_a)) { /* no -a */ | 106 | if (!(opt & OPT_a)) { /* no -a */ |
91 | unsigned d, h, m; | 107 | unsigned d, h, m; |
92 | unsigned expires = expires_abs - curr; | 108 | unsigned expires = expires_abs - curr; |
diff --git a/networking/udhcp/leases.c b/networking/udhcp/leases.c index 745340ad3..844bb60b1 100644 --- a/networking/udhcp/leases.c +++ b/networking/udhcp/leases.c | |||
@@ -65,10 +65,15 @@ struct dyn_lease* FAST_FUNC add_lease( | |||
65 | if (hostname_len > sizeof(oldest->hostname)) | 65 | if (hostname_len > sizeof(oldest->hostname)) |
66 | hostname_len = sizeof(oldest->hostname); | 66 | hostname_len = sizeof(oldest->hostname); |
67 | p = safe_strncpy(oldest->hostname, hostname, hostname_len); | 67 | p = safe_strncpy(oldest->hostname, hostname, hostname_len); |
68 | /* sanitization (s/non-ASCII/^/g) */ | 68 | /* |
69 | * Sanitization (s/bad_char/./g). | ||
70 | * The intent is not to allow only "DNS-valid" hostnames, | ||
71 | * but merely make dumpleases output safe for shells to use. | ||
72 | * We accept "0-9A-Za-z._-", all other chars turn to dots. | ||
73 | */ | ||
69 | while (*p) { | 74 | while (*p) { |
70 | if (*p < ' ' || *p > 126) | 75 | if (!isalnum(*p) && *p != '-' && *p != '_') |
71 | *p = '^'; | 76 | *p = '.'; |
72 | p++; | 77 | p++; |
73 | } | 78 | } |
74 | } | 79 | } |
diff --git a/networking/wget.c b/networking/wget.c index 0082ced39..edf8fd8af 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -102,7 +102,8 @@ | |||
102 | //usage: "[-c|--continue] [-s|--spider] [-q|--quiet] [-O|--output-document FILE]\n" | 102 | //usage: "[-c|--continue] [-s|--spider] [-q|--quiet] [-O|--output-document FILE]\n" |
103 | //usage: " [--header 'header: value'] [-Y|--proxy on/off] [-P DIR]\n" | 103 | //usage: " [--header 'header: value'] [-Y|--proxy on/off] [-P DIR]\n" |
104 | /* Since we ignore these opts, we don't show them in --help */ | 104 | /* Since we ignore these opts, we don't show them in --help */ |
105 | /* //usage: " [--no-check-certificate] [--no-cache]" */ | 105 | /* //usage: " [--no-check-certificate] [--no-cache] [--passive-ftp] [-t TRIES]" */ |
106 | /* //usage: " [-nv] [-nc] [-nH] [-np]" */ | ||
106 | //usage: " [-U|--user-agent AGENT]" IF_FEATURE_WGET_TIMEOUT(" [-T SEC]") " URL..." | 107 | //usage: " [-U|--user-agent AGENT]" IF_FEATURE_WGET_TIMEOUT(" [-T SEC]") " URL..." |
107 | //usage: ) | 108 | //usage: ) |
108 | //usage: IF_NOT_FEATURE_WGET_LONG_OPTIONS( | 109 | //usage: IF_NOT_FEATURE_WGET_LONG_OPTIONS( |
@@ -1225,19 +1226,22 @@ int wget_main(int argc UNUSED_PARAM, char **argv) | |||
1225 | "directory-prefix\0" Required_argument "P" | 1226 | "directory-prefix\0" Required_argument "P" |
1226 | "proxy\0" Required_argument "Y" | 1227 | "proxy\0" Required_argument "Y" |
1227 | "user-agent\0" Required_argument "U" | 1228 | "user-agent\0" Required_argument "U" |
1228 | #if ENABLE_FEATURE_WGET_TIMEOUT | 1229 | IF_FEATURE_WGET_TIMEOUT( |
1229 | "timeout\0" Required_argument "T" | 1230 | "timeout\0" Required_argument "T") |
1230 | #endif | ||
1231 | /* Ignored: */ | 1231 | /* Ignored: */ |
1232 | // "tries\0" Required_argument "t" | 1232 | IF_DESKTOP( "tries\0" Required_argument "t") |
1233 | "header\0" Required_argument "\xff" | ||
1234 | "post-data\0" Required_argument "\xfe" | ||
1233 | /* Ignored (we always use PASV): */ | 1235 | /* Ignored (we always use PASV): */ |
1234 | "passive-ftp\0" No_argument "\xff" | 1236 | IF_DESKTOP( "passive-ftp\0" No_argument "\xf0") |
1235 | "header\0" Required_argument "\xfe" | ||
1236 | "post-data\0" Required_argument "\xfd" | ||
1237 | /* Ignored (we don't do ssl) */ | 1237 | /* Ignored (we don't do ssl) */ |
1238 | "no-check-certificate\0" No_argument "\xfc" | 1238 | IF_DESKTOP( "no-check-certificate\0" No_argument "\xf0") |
1239 | /* Ignored (we don't support caching) */ | 1239 | /* Ignored (we don't support caching) */ |
1240 | "no-cache\0" No_argument "\xfb" | 1240 | IF_DESKTOP( "no-cache\0" No_argument "\xf0") |
1241 | IF_DESKTOP( "no-verbose\0" No_argument "\xf0") | ||
1242 | IF_DESKTOP( "no-clobber\0" No_argument "\xf0") | ||
1243 | IF_DESKTOP( "no-host-directories\0" No_argument "\xf0") | ||
1244 | IF_DESKTOP( "no-parent\0" No_argument "\xf0") | ||
1241 | ; | 1245 | ; |
1242 | #endif | 1246 | #endif |
1243 | 1247 | ||
@@ -1257,14 +1261,25 @@ int wget_main(int argc UNUSED_PARAM, char **argv) | |||
1257 | #if ENABLE_FEATURE_WGET_LONG_OPTIONS | 1261 | #if ENABLE_FEATURE_WGET_LONG_OPTIONS |
1258 | applet_long_options = wget_longopts; | 1262 | applet_long_options = wget_longopts; |
1259 | #endif | 1263 | #endif |
1260 | opt_complementary = "-1" | 1264 | opt_complementary = "-1" /* at least one URL */ |
1261 | IF_FEATURE_WGET_TIMEOUT(":T+") | 1265 | IF_FEATURE_WGET_TIMEOUT(":T+") /* -T NUM */ |
1262 | IF_FEATURE_WGET_LONG_OPTIONS(":\xfe::"); | 1266 | IF_FEATURE_WGET_LONG_OPTIONS(":\xff::"); /* --header is a list */ |
1263 | getopt32(argv, "csqO:P:Y:U:T:" /*ignored:*/ "t:", | 1267 | getopt32(argv, "csqO:P:Y:U:T:" |
1264 | &G.fname_out, &G.dir_prefix, | 1268 | /*ignored:*/ "t:" |
1269 | /*ignored:*/ "n::" | ||
1270 | /* wget has exactly four -n<letter> opts, all of which we can ignore: | ||
1271 | * -nv --no-verbose: be moderately quiet (-q is full quiet) | ||
1272 | * -nc --no-clobber: abort if exists, neither download to FILE.n nor overwrite FILE | ||
1273 | * -nH --no-host-directories: wget -r http://host/ won't create host/ | ||
1274 | * -np --no-parent | ||
1275 | * "n::" above says that we accept -n[ARG]. | ||
1276 | * Specifying "n:" would be a bug: "-n ARG" would eat ARG! | ||
1277 | */ | ||
1278 | , &G.fname_out, &G.dir_prefix, | ||
1265 | &G.proxy_flag, &G.user_agent, | 1279 | &G.proxy_flag, &G.user_agent, |
1266 | IF_FEATURE_WGET_TIMEOUT(&G.timeout_seconds) IF_NOT_FEATURE_WGET_TIMEOUT(NULL), | 1280 | IF_FEATURE_WGET_TIMEOUT(&G.timeout_seconds) IF_NOT_FEATURE_WGET_TIMEOUT(NULL), |
1267 | NULL /* -t RETRIES */ | 1281 | NULL, /* -t RETRIES */ |
1282 | NULL /* -n[ARG] */ | ||
1268 | IF_FEATURE_WGET_LONG_OPTIONS(, &headers_llist) | 1283 | IF_FEATURE_WGET_LONG_OPTIONS(, &headers_llist) |
1269 | IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_data) | 1284 | IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_data) |
1270 | ); | 1285 | ); |
diff --git a/networking/zcip.c b/networking/zcip.c index d15c67d55..1d6910555 100644 --- a/networking/zcip.c +++ b/networking/zcip.c | |||
@@ -345,7 +345,7 @@ int zcip_main(int argc UNUSED_PARAM, char **argv) | |||
345 | state = PROBE; | 345 | state = PROBE; |
346 | while (1) { | 346 | while (1) { |
347 | struct pollfd fds[1]; | 347 | struct pollfd fds[1]; |
348 | unsigned deadline_us; | 348 | unsigned deadline_us = deadline_us; |
349 | struct arp_packet p; | 349 | struct arp_packet p; |
350 | int ip_conflict; | 350 | int ip_conflict; |
351 | int n; | 351 | int n; |
@@ -361,8 +361,10 @@ int zcip_main(int argc UNUSED_PARAM, char **argv) | |||
361 | // make the kernel filter out all packets except | 361 | // make the kernel filter out all packets except |
362 | // ones we'd care about. | 362 | // ones we'd care about. |
363 | } | 363 | } |
364 | // Set deadline_us to the point in time when we timeout | 364 | if (timeout_ms >= 0) { |
365 | deadline_us = MONOTONIC_US() + timeout_ms * 1000; | 365 | // Set deadline_us to the point in time when we timeout |
366 | deadline_us = MONOTONIC_US() + timeout_ms * 1000; | ||
367 | } | ||
366 | 368 | ||
367 | VDBG("...wait %d %s nsent=%u\n", | 369 | VDBG("...wait %d %s nsent=%u\n", |
368 | timeout_ms, argv_intf, nsent); | 370 | timeout_ms, argv_intf, nsent); |