diff options
author | Ron Yorston <rmy@pobox.com> | 2019-02-12 08:43:06 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-02-12 08:43:06 +0000 |
commit | 7a8bd5ae33d8c390763f0787afe6b8c495e2d978 (patch) | |
tree | 29b0abb320d73b37f4fa4d9b355b3b32db42e836 /networking | |
parent | 0eda390d68c456975289471e68b615ae096ab33b (diff) | |
parent | f81e0120f4478c58e126bcadb19b9954ed184e8f (diff) | |
download | busybox-w32-7a8bd5ae33d8c390763f0787afe6b8c495e2d978.tar.gz busybox-w32-7a8bd5ae33d8c390763f0787afe6b8c495e2d978.tar.bz2 busybox-w32-7a8bd5ae33d8c390763f0787afe6b8c495e2d978.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'networking')
-rw-r--r-- | networking/libiproute/iplink.c | 18 | ||||
-rw-r--r-- | networking/tls_fe.c | 18 | ||||
-rw-r--r-- | networking/udhcp/common.h | 4 | ||||
-rw-r--r-- | networking/wget.c | 43 |
4 files changed, 45 insertions, 38 deletions
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c index 9c164a71d..1a1064bdc 100644 --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c | |||
@@ -490,11 +490,11 @@ static void vlan_parse_opt(char **argv, struct nlmsghdr *n, unsigned int size) | |||
490 | ; | 490 | ; |
491 | enum { | 491 | enum { |
492 | ARG_id = 0, | 492 | ARG_id = 0, |
493 | ARG_protocol, | ||
493 | ARG_reorder_hdr, | 494 | ARG_reorder_hdr, |
494 | ARG_gvrp, | 495 | ARG_gvrp, |
495 | ARG_mvrp, | 496 | ARG_mvrp, |
496 | ARG_loose_binding, | 497 | ARG_loose_binding, |
497 | ARG_protocol, | ||
498 | }; | 498 | }; |
499 | enum { | 499 | enum { |
500 | PROTO_8021Q = 0, | 500 | PROTO_8021Q = 0, |
@@ -518,11 +518,11 @@ static void vlan_parse_opt(char **argv, struct nlmsghdr *n, unsigned int size) | |||
518 | id = get_u16(*argv, "id"); | 518 | id = get_u16(*argv, "id"); |
519 | addattr_l(n, size, IFLA_VLAN_ID, &id, sizeof(id)); | 519 | addattr_l(n, size, IFLA_VLAN_ID, &id, sizeof(id)); |
520 | } else if (arg == ARG_protocol) { | 520 | } else if (arg == ARG_protocol) { |
521 | arg = index_in_substrings(protocols, *argv); | 521 | arg = index_in_substrings(protocols, str_tolower(*argv)); |
522 | if (arg == PROTO_8021Q) | 522 | if (arg == PROTO_8021Q) |
523 | proto = ETH_P_8021Q; | 523 | proto = htons(ETH_P_8021Q); |
524 | else if (arg == PROTO_8021AD) | 524 | else if (arg == PROTO_8021AD) |
525 | proto = ETH_P_8021AD; | 525 | proto = htons(ETH_P_8021AD); |
526 | else | 526 | else |
527 | bb_error_msg_and_die("unknown VLAN encapsulation protocol '%s'", | 527 | bb_error_msg_and_die("unknown VLAN encapsulation protocol '%s'", |
528 | *argv); | 528 | *argv); |
@@ -673,13 +673,19 @@ static int do_add_or_delete(char **argv, const unsigned rtm) | |||
673 | 673 | ||
674 | linkinfo->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)linkinfo; | 674 | linkinfo->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)linkinfo; |
675 | } | 675 | } |
676 | /* Allow "ip link add dev" and "ip link add name" */ | ||
677 | if (!name_str) | ||
678 | name_str = dev_str; | ||
679 | else if (!dev_str) | ||
680 | dev_str = name_str; | ||
681 | /* else if (!strcmp(name_str, dev_str)) | ||
682 | name_str = dev_str; */ | ||
683 | |||
676 | if (rtm != RTM_NEWLINK) { | 684 | if (rtm != RTM_NEWLINK) { |
677 | if (!dev_str) | 685 | if (!dev_str) |
678 | return 1; /* Need a device to delete */ | 686 | return 1; /* Need a device to delete */ |
679 | req.i.ifi_index = xll_name_to_index(dev_str); | 687 | req.i.ifi_index = xll_name_to_index(dev_str); |
680 | } else { | 688 | } else { |
681 | if (!name_str) | ||
682 | name_str = dev_str; | ||
683 | if (link_str) { | 689 | if (link_str) { |
684 | int idx = xll_name_to_index(link_str); | 690 | int idx = xll_name_to_index(link_str); |
685 | addattr_l(&req.n, sizeof(req), IFLA_LINK, &idx, 4); | 691 | addattr_l(&req.n, sizeof(req), IFLA_LINK, &idx, 4); |
diff --git a/networking/tls_fe.c b/networking/tls_fe.c index f235082f5..10971bbff 100644 --- a/networking/tls_fe.c +++ b/networking/tls_fe.c | |||
@@ -43,17 +43,13 @@ typedef uint32_t word32; | |||
43 | #if 0 //UNUSED | 43 | #if 0 //UNUSED |
44 | static void fprime_copy(byte *x, const byte *a) | 44 | static void fprime_copy(byte *x, const byte *a) |
45 | { | 45 | { |
46 | int i; | 46 | memcpy(x, a, F25519_SIZE); |
47 | for (i = 0; i < F25519_SIZE; i++) | ||
48 | x[i] = a[i]; | ||
49 | } | 47 | } |
50 | #endif | 48 | #endif |
51 | 49 | ||
52 | static void lm_copy(byte* x, const byte* a) | 50 | static void lm_copy(byte* x, const byte* a) |
53 | { | 51 | { |
54 | int i; | 52 | memcpy(x, a, F25519_SIZE); |
55 | for (i = 0; i < F25519_SIZE; i++) | ||
56 | x[i] = a[i]; | ||
57 | } | 53 | } |
58 | 54 | ||
59 | #if 0 //UNUSED | 55 | #if 0 //UNUSED |
@@ -200,7 +196,7 @@ static void fe_load(byte *x, word32 c) | |||
200 | static void fe_normalize(byte *x) | 196 | static void fe_normalize(byte *x) |
201 | { | 197 | { |
202 | byte minusp[F25519_SIZE]; | 198 | byte minusp[F25519_SIZE]; |
203 | word16 c; | 199 | unsigned c; |
204 | int i; | 200 | int i; |
205 | 201 | ||
206 | /* Reduce using 2^255 = 19 mod p */ | 202 | /* Reduce using 2^255 = 19 mod p */ |
@@ -219,13 +215,13 @@ static void fe_normalize(byte *x) | |||
219 | */ | 215 | */ |
220 | c = 19; | 216 | c = 19; |
221 | 217 | ||
222 | for (i = 0; i + 1 < F25519_SIZE; i++) { | 218 | for (i = 0; i < F25519_SIZE - 1; i++) { |
223 | c += x[i]; | 219 | c += x[i]; |
224 | minusp[i] = (byte)c; | 220 | minusp[i] = (byte)c; |
225 | c >>= 8; | 221 | c >>= 8; |
226 | } | 222 | } |
227 | 223 | ||
228 | c += ((word16)x[i]) - 128; | 224 | c += ((unsigned)x[i]) - 128; |
229 | minusp[31] = (byte)c; | 225 | minusp[31] = (byte)c; |
230 | 226 | ||
231 | /* Load x-p if no underflow */ | 227 | /* Load x-p if no underflow */ |
@@ -234,13 +230,13 @@ static void fe_normalize(byte *x) | |||
234 | 230 | ||
235 | static void lm_add(byte* r, const byte* a, const byte* b) | 231 | static void lm_add(byte* r, const byte* a, const byte* b) |
236 | { | 232 | { |
237 | word16 c = 0; | 233 | unsigned c = 0; |
238 | int i; | 234 | int i; |
239 | 235 | ||
240 | /* Add */ | 236 | /* Add */ |
241 | for (i = 0; i < F25519_SIZE; i++) { | 237 | for (i = 0; i < F25519_SIZE; i++) { |
242 | c >>= 8; | 238 | c >>= 8; |
243 | c += ((word16)a[i]) + ((word16)b[i]); | 239 | c += ((unsigned)a[i]) + ((unsigned)b[i]); |
244 | r[i] = (byte)c; | 240 | r[i] = (byte)c; |
245 | } | 241 | } |
246 | 242 | ||
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h index 62f9a2a4a..b68f9394e 100644 --- a/networking/udhcp/common.h +++ b/networking/udhcp/common.h | |||
@@ -154,8 +154,8 @@ enum { | |||
154 | //#define DHCP_STATIC_ROUTES 0x79 /* 121: RFC 3442. (mask,ip,router) tuples */ | 154 | //#define DHCP_STATIC_ROUTES 0x79 /* 121: RFC 3442. (mask,ip,router) tuples */ |
155 | //#define DHCP_VLAN_ID 0x84 /* 132: 802.1P VLAN ID */ | 155 | //#define DHCP_VLAN_ID 0x84 /* 132: 802.1P VLAN ID */ |
156 | //#define DHCP_VLAN_PRIORITY 0x85 /* 133: 802.1Q VLAN priority */ | 156 | //#define DHCP_VLAN_PRIORITY 0x85 /* 133: 802.1Q VLAN priority */ |
157 | //#define DHCP_PXE_CONF_FILE 0xd1 /* 209: RFC 5071 Configuration File */ | 157 | //#define DHCP_PXE_CONF_FILE 0xd1 /* 209: RFC 5071 Configuration file */ |
158 | //#define DHCP_PXE_PATH_PREFIX 0xd2 /* 210: RFC 5071 Configuration File */ | 158 | //#define DHCP_PXE_PATH_PREFIX 0xd2 /* 210: RFC 5071 Path prefix */ |
159 | //#define DHCP_REBOOT_TIME 0xd3 /* 211: RFC 5071 Reboot time */ | 159 | //#define DHCP_REBOOT_TIME 0xd3 /* 211: RFC 5071 Reboot time */ |
160 | //#define DHCP_MS_STATIC_ROUTES 0xf9 /* 249: Microsoft's pre-RFC 3442 code for 0x79? */ | 160 | //#define DHCP_MS_STATIC_ROUTES 0xf9 /* 249: Microsoft's pre-RFC 3442 code for 0x79? */ |
161 | //#define DHCP_WPAD 0xfc /* 252: MSIE's Web Proxy Autodiscovery Protocol */ | 161 | //#define DHCP_WPAD 0xfc /* 252: MSIE's Web Proxy Autodiscovery Protocol */ |
diff --git a/networking/wget.c b/networking/wget.c index 3cae1192c..bb70039f9 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -248,7 +248,7 @@ struct globals { | |||
248 | * With 512 byte buffer, it was measured to be | 248 | * With 512 byte buffer, it was measured to be |
249 | * an order of magnitude slower than with big one. | 249 | * an order of magnitude slower than with big one. |
250 | */ | 250 | */ |
251 | char wget_buf[CONFIG_FEATURE_COPYBUF_KB*1024] ALIGNED(sizeof(long)); | 251 | char wget_buf[CONFIG_FEATURE_COPYBUF_KB*1024] ALIGNED(16); |
252 | } FIX_ALIASING; | 252 | } FIX_ALIASING; |
253 | #define G (*ptr_to_globals) | 253 | #define G (*ptr_to_globals) |
254 | #define INIT_G() do { \ | 254 | #define INIT_G() do { \ |
@@ -388,9 +388,6 @@ static void set_alarm(void) | |||
388 | * is_ip_address() attempts to verify whether or not a string | 388 | * is_ip_address() attempts to verify whether or not a string |
389 | * contains an IPv4 or IPv6 address (vs. an FQDN). The result | 389 | * contains an IPv4 or IPv6 address (vs. an FQDN). The result |
390 | * of inet_pton() can be used to determine this. | 390 | * of inet_pton() can be used to determine this. |
391 | * | ||
392 | * TODO add proper error checking when inet_pton() returns -1 | ||
393 | * (some form of system error has occurred, and errno is set) | ||
394 | */ | 391 | */ |
395 | static int is_ip_address(const char *string) | 392 | static int is_ip_address(const char *string) |
396 | { | 393 | { |
@@ -908,10 +905,12 @@ static void NOINLINE retrieve_file_data(FILE *dfp) | |||
908 | polldata.fd = fileno(dfp); | 905 | polldata.fd = fileno(dfp); |
909 | polldata.events = POLLIN | POLLPRI; | 906 | polldata.events = POLLIN | POLLPRI; |
910 | #endif | 907 | #endif |
911 | if (G.output_fd == 1) | 908 | if (!(option_mask32 & WGET_OPT_QUIET)) { |
912 | fprintf(stderr, "writing to stdout\n"); | 909 | if (G.output_fd == 1) |
913 | else | 910 | fprintf(stderr, "writing to stdout\n"); |
914 | fprintf(stderr, "saving to '%s'\n", G.fname_out); | 911 | else |
912 | fprintf(stderr, "saving to '%s'\n", G.fname_out); | ||
913 | } | ||
915 | progress_meter(PROGRESS_START); | 914 | progress_meter(PROGRESS_START); |
916 | 915 | ||
917 | if (G.chunked) | 916 | if (G.chunked) |
@@ -1042,6 +1041,15 @@ static void NOINLINE retrieve_file_data(FILE *dfp) | |||
1042 | */ | 1041 | */ |
1043 | } | 1042 | } |
1044 | 1043 | ||
1044 | /* Draw full bar and free its resources */ | ||
1045 | G.chunked = 0; /* makes it show 100% even for chunked download */ | ||
1046 | G.got_clen = 1; /* makes it show 100% even for download of (formerly) unknown size */ | ||
1047 | progress_meter(PROGRESS_END); | ||
1048 | if (G.content_len != 0) { | ||
1049 | bb_perror_msg_and_die("connection closed prematurely"); | ||
1050 | /* GNU wget says "DATE TIME (NN MB/s) - Connection closed at byte NNN. Retrying." */ | ||
1051 | } | ||
1052 | |||
1045 | /* If -c failed, we restart from the beginning, | 1053 | /* If -c failed, we restart from the beginning, |
1046 | * but we do not truncate file then, we do it only now, at the end. | 1054 | * but we do not truncate file then, we do it only now, at the end. |
1047 | * This lets user to ^C if his 99% complete 10 GB file download | 1055 | * This lets user to ^C if his 99% complete 10 GB file download |
@@ -1053,14 +1061,12 @@ static void NOINLINE retrieve_file_data(FILE *dfp) | |||
1053 | ftruncate(G.output_fd, pos); | 1061 | ftruncate(G.output_fd, pos); |
1054 | } | 1062 | } |
1055 | 1063 | ||
1056 | /* Draw full bar and free its resources */ | 1064 | if (!(option_mask32 & WGET_OPT_QUIET)) { |
1057 | G.chunked = 0; /* makes it show 100% even for chunked download */ | 1065 | if (G.output_fd == 1) |
1058 | G.got_clen = 1; /* makes it show 100% even for download of (formerly) unknown size */ | 1066 | fprintf(stderr, "written to stdout\n"); |
1059 | progress_meter(PROGRESS_END); | 1067 | else |
1060 | if (G.output_fd == 1) | 1068 | fprintf(stderr, "'%s' saved\n", G.fname_out); |
1061 | fprintf(stderr, "written to stdout\n"); | 1069 | } |
1062 | else | ||
1063 | fprintf(stderr, "'%s' saved\n", G.fname_out); | ||
1064 | } | 1070 | } |
1065 | 1071 | ||
1066 | static void download_one_url(const char *url) | 1072 | static void download_one_url(const char *url) |
@@ -1421,7 +1427,8 @@ However, in real world it was observed that some web servers | |||
1421 | G.output_fd = -1; | 1427 | G.output_fd = -1; |
1422 | } | 1428 | } |
1423 | } else { | 1429 | } else { |
1424 | fprintf(stderr, "remote file exists\n"); | 1430 | if (!(option_mask32 & WGET_OPT_QUIET)) |
1431 | fprintf(stderr, "remote file exists\n"); | ||
1425 | } | 1432 | } |
1426 | 1433 | ||
1427 | if (dfp != sfp) { | 1434 | if (dfp != sfp) { |
@@ -1492,8 +1499,6 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") | |||
1492 | G.proxy_flag = "on"; /* use proxies if env vars are set */ | 1499 | G.proxy_flag = "on"; /* use proxies if env vars are set */ |
1493 | G.user_agent = "Wget"; /* "User-Agent" header field */ | 1500 | G.user_agent = "Wget"; /* "User-Agent" header field */ |
1494 | 1501 | ||
1495 | #if ENABLE_FEATURE_WGET_LONG_OPTIONS | ||
1496 | #endif | ||
1497 | GETOPT32(argv, "^" | 1502 | GETOPT32(argv, "^" |
1498 | "cqSO:o:P:Y:U:T:+" | 1503 | "cqSO:o:P:Y:U:T:+" |
1499 | /*ignored:*/ "t:" | 1504 | /*ignored:*/ "t:" |