diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-01-29 10:33:34 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-01-29 10:33:34 +0000 |
commit | 8c69afd992d7cc6c2fc7dea59c3c2bd3f3c21f15 (patch) | |
tree | 998a337ecd57b737423a3793365519213f97da72 /networking | |
parent | c882f341cec8451ee87af6746abb7208272d5b1a (diff) | |
download | busybox-w32-8c69afd992d7cc6c2fc7dea59c3c2bd3f3c21f15.tar.gz busybox-w32-8c69afd992d7cc6c2fc7dea59c3c2bd3f3c21f15.tar.bz2 busybox-w32-8c69afd992d7cc6c2fc7dea59c3c2bd3f3c21f15.zip |
- be C99 friendly. Anonymous unions are a GNU extension. This change is
size-neutral WRT -std=gnu99 and fixes several compilation errors for strict
C99 mode.
Diffstat (limited to 'networking')
-rw-r--r-- | networking/arping.c | 2 | ||||
-rw-r--r-- | networking/dnsd.c | 10 | ||||
-rw-r--r-- | networking/ftpgetput.c | 2 | ||||
-rw-r--r-- | networking/httpd.c | 22 | ||||
-rw-r--r-- | networking/ifconfig.c | 6 | ||||
-rw-r--r-- | networking/nc.c | 6 | ||||
-rw-r--r-- | networking/ping.c | 20 | ||||
-rw-r--r-- | networking/pscan.c | 4 | ||||
-rw-r--r-- | networking/tftp.c | 16 | ||||
-rw-r--r-- | networking/udhcp/files.c | 2 | ||||
-rw-r--r-- | networking/wget.c | 2 |
11 files changed, 46 insertions, 46 deletions
diff --git a/networking/arping.c b/networking/arping.c index 6383f9a88..f71a98498 100644 --- a/networking/arping.c +++ b/networking/arping.c | |||
@@ -311,7 +311,7 @@ int arping_main(int argc, char **argv) | |||
311 | /* if (!inet_aton(target, &dst)) - not needed */ { | 311 | /* if (!inet_aton(target, &dst)) - not needed */ { |
312 | len_and_sockaddr *lsa; | 312 | len_and_sockaddr *lsa; |
313 | lsa = xhost_and_af2sockaddr(target, 0, AF_INET); | 313 | lsa = xhost_and_af2sockaddr(target, 0, AF_INET); |
314 | memcpy(&dst, &lsa->sin.sin_addr.s_addr, 4); | 314 | memcpy(&dst, &lsa->u.sin.sin_addr.s_addr, 4); |
315 | if (ENABLE_FEATURE_CLEAN_UP) | 315 | if (ENABLE_FEATURE_CLEAN_UP) |
316 | free(lsa); | 316 | free(lsa); |
317 | } | 317 | } |
diff --git a/networking/dnsd.c b/networking/dnsd.c index 19720d6bc..5e7886167 100644 --- a/networking/dnsd.c +++ b/networking/dnsd.c | |||
@@ -371,11 +371,11 @@ int dnsd_main(int argc, char **argv) | |||
371 | #endif | 371 | #endif |
372 | 372 | ||
373 | lsa = xdotted2sockaddr(listen_interface, port); | 373 | lsa = xdotted2sockaddr(listen_interface, port); |
374 | udps = xsocket(lsa->sa.sa_family, SOCK_DGRAM, 0); | 374 | udps = xsocket(lsa->u.sa.sa_family, SOCK_DGRAM, 0); |
375 | xbind(udps, &lsa->sa, lsa->len); | 375 | xbind(udps, &lsa->u.sa, lsa->len); |
376 | /* xlisten(udps, 50); - ?!! DGRAM sockets are never listened on I think? */ | 376 | /* xlisten(udps, 50); - ?!! DGRAM sockets are never listened on I think? */ |
377 | bb_info_msg("Accepting UDP packets on %s", | 377 | bb_info_msg("Accepting UDP packets on %s", |
378 | xmalloc_sockaddr2dotted(&lsa->sa)); | 378 | xmalloc_sockaddr2dotted(&lsa->u.sa)); |
379 | 379 | ||
380 | while (1) { | 380 | while (1) { |
381 | int r; | 381 | int r; |
@@ -385,7 +385,7 @@ int dnsd_main(int argc, char **argv) | |||
385 | // Or else we can exhibit usual UDP ugliness: | 385 | // Or else we can exhibit usual UDP ugliness: |
386 | // [ip1.multihomed.ip2] <= query to ip1 <= peer | 386 | // [ip1.multihomed.ip2] <= query to ip1 <= peer |
387 | // [ip1.multihomed.ip2] => reply from ip2 => peer (confused) | 387 | // [ip1.multihomed.ip2] => reply from ip2 => peer (confused) |
388 | r = recvfrom(udps, buf, sizeof(buf), 0, &lsa->sa, &fromlen); | 388 | r = recvfrom(udps, buf, sizeof(buf), 0, &lsa->u.sa, &fromlen); |
389 | if (OPT_verbose) | 389 | if (OPT_verbose) |
390 | bb_info_msg("Got UDP packet"); | 390 | bb_info_msg("Got UDP packet"); |
391 | if (r < 12 || r > 512) { | 391 | if (r < 12 || r > 512) { |
@@ -395,7 +395,7 @@ int dnsd_main(int argc, char **argv) | |||
395 | r = process_packet(buf); | 395 | r = process_packet(buf); |
396 | if (r <= 0) | 396 | if (r <= 0) |
397 | continue; | 397 | continue; |
398 | sendto(udps, buf, r, 0, &lsa->sa, fromlen); | 398 | sendto(udps, buf, r, 0, &lsa->u.sa, fromlen); |
399 | } | 399 | } |
400 | return 0; | 400 | return 0; |
401 | } | 401 | } |
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index 587f000ce..de11f912e 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c | |||
@@ -348,7 +348,7 @@ int ftpgetput_main(int argc, char **argv) | |||
348 | server->lsa = xhost2sockaddr(argv[0], bb_lookup_port(port, "tcp", 21)); | 348 | server->lsa = xhost2sockaddr(argv[0], bb_lookup_port(port, "tcp", 21)); |
349 | if (verbose_flag) { | 349 | if (verbose_flag) { |
350 | printf("Connecting to %s (%s)\n", argv[0], | 350 | printf("Connecting to %s (%s)\n", argv[0], |
351 | xmalloc_sockaddr2dotted(&server->lsa->sa)); | 351 | xmalloc_sockaddr2dotted(&server->lsa->u.sa)); |
352 | } | 352 | } |
353 | 353 | ||
354 | /* Connect/Setup/Configure the FTP session */ | 354 | /* Connect/Setup/Configure the FTP session */ |
diff --git a/networking/httpd.c b/networking/httpd.c index 72949755a..0f18b0fd0 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -1781,18 +1781,18 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr) | |||
1781 | iobuf = xmalloc(IOBUF_SIZE); | 1781 | iobuf = xmalloc(IOBUF_SIZE); |
1782 | 1782 | ||
1783 | rmt_ip = 0; | 1783 | rmt_ip = 0; |
1784 | if (fromAddr->sa.sa_family == AF_INET) { | 1784 | if (fromAddr->u.sa.sa_family == AF_INET) { |
1785 | rmt_ip = ntohl(fromAddr->sin.sin_addr.s_addr); | 1785 | rmt_ip = ntohl(fromAddr->u.sin.sin_addr.s_addr); |
1786 | } | 1786 | } |
1787 | #if ENABLE_FEATURE_IPV6 | 1787 | #if ENABLE_FEATURE_IPV6 |
1788 | if (fromAddr->sa.sa_family == AF_INET6 | 1788 | if (fromAddr->u.sa.sa_family == AF_INET6 |
1789 | && fromAddr->sin6.sin6_addr.s6_addr32[0] == 0 | 1789 | && fromAddr->u.sin6.sin6_addr.s6_addr32[0] == 0 |
1790 | && fromAddr->sin6.sin6_addr.s6_addr32[1] == 0 | 1790 | && fromAddr->u.sin6.sin6_addr.s6_addr32[1] == 0 |
1791 | && ntohl(fromAddr->sin6.sin6_addr.s6_addr32[2]) == 0xffff) | 1791 | && ntohl(fromAddr->u.sin6.sin6_addr.s6_addr32[2]) == 0xffff) |
1792 | rmt_ip = ntohl(fromAddr->sin6.sin6_addr.s6_addr32[3]); | 1792 | rmt_ip = ntohl(fromAddr->u.sin6.sin6_addr.s6_addr32[3]); |
1793 | #endif | 1793 | #endif |
1794 | if (ENABLE_FEATURE_HTTPD_CGI || DEBUG || verbose) { | 1794 | if (ENABLE_FEATURE_HTTPD_CGI || DEBUG || verbose) { |
1795 | rmt_ip_str = xmalloc_sockaddr2dotted(&fromAddr->sa); | 1795 | rmt_ip_str = xmalloc_sockaddr2dotted(&fromAddr->u.sa); |
1796 | } | 1796 | } |
1797 | if (verbose) { | 1797 | if (verbose) { |
1798 | /* this trick makes -v logging much simpler */ | 1798 | /* this trick makes -v logging much simpler */ |
@@ -2047,7 +2047,7 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr) | |||
2047 | lsa = host2sockaddr(proxy_entry->host_port, 80); | 2047 | lsa = host2sockaddr(proxy_entry->host_port, 80); |
2048 | if (lsa == NULL) | 2048 | if (lsa == NULL) |
2049 | send_headers_and_exit(HTTP_INTERNAL_SERVER_ERROR); | 2049 | send_headers_and_exit(HTTP_INTERNAL_SERVER_ERROR); |
2050 | if (connect(proxy_fd, &lsa->sa, lsa->len) < 0) | 2050 | if (connect(proxy_fd, &lsa->u.sa, lsa->len) < 0) |
2051 | send_headers_and_exit(HTTP_INTERNAL_SERVER_ERROR); | 2051 | send_headers_and_exit(HTTP_INTERNAL_SERVER_ERROR); |
2052 | fdprintf(proxy_fd, "%s %s%s%s%s HTTP/%c.%c\r\n", | 2052 | fdprintf(proxy_fd, "%s %s%s%s%s HTTP/%c.%c\r\n", |
2053 | prequest, /* GET or POST */ | 2053 | prequest, /* GET or POST */ |
@@ -2140,7 +2140,7 @@ static void mini_httpd(int server_socket) | |||
2140 | 2140 | ||
2141 | /* Wait for connections... */ | 2141 | /* Wait for connections... */ |
2142 | fromAddr.len = LSA_SIZEOF_SA; | 2142 | fromAddr.len = LSA_SIZEOF_SA; |
2143 | n = accept(server_socket, &fromAddr.sa, &fromAddr.len); | 2143 | n = accept(server_socket, &fromAddr.u.sa, &fromAddr.len); |
2144 | 2144 | ||
2145 | if (n < 0) | 2145 | if (n < 0) |
2146 | continue; | 2146 | continue; |
@@ -2222,7 +2222,7 @@ static void mini_httpd_inetd(void) | |||
2222 | len_and_sockaddr fromAddr; | 2222 | len_and_sockaddr fromAddr; |
2223 | 2223 | ||
2224 | fromAddr.len = LSA_SIZEOF_SA; | 2224 | fromAddr.len = LSA_SIZEOF_SA; |
2225 | getpeername(0, &fromAddr.sa, &fromAddr.len); | 2225 | getpeername(0, &fromAddr.u.sa, &fromAddr.len); |
2226 | handle_incoming_and_exit(&fromAddr); | 2226 | handle_incoming_and_exit(&fromAddr); |
2227 | } | 2227 | } |
2228 | 2228 | ||
diff --git a/networking/ifconfig.c b/networking/ifconfig.c index fff5f5d2e..fcbeb2420 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c | |||
@@ -392,12 +392,12 @@ int ifconfig_main(int argc, char **argv) | |||
392 | continue; /* compat stuff */ | 392 | continue; /* compat stuff */ |
393 | lsa = xhost2sockaddr(host, 0); | 393 | lsa = xhost2sockaddr(host, 0); |
394 | #if ENABLE_FEATURE_IPV6 | 394 | #if ENABLE_FEATURE_IPV6 |
395 | if (lsa->sa.sa_family == AF_INET6) { | 395 | if (lsa->u.sa.sa_family == AF_INET6) { |
396 | int sockfd6; | 396 | int sockfd6; |
397 | struct in6_ifreq ifr6; | 397 | struct in6_ifreq ifr6; |
398 | 398 | ||
399 | memcpy((char *) &ifr6.ifr6_addr, | 399 | memcpy((char *) &ifr6.ifr6_addr, |
400 | (char *) &(lsa->sin6.sin6_addr), | 400 | (char *) &(lsa->u.sin6.sin6_addr), |
401 | sizeof(struct in6_addr)); | 401 | sizeof(struct in6_addr)); |
402 | 402 | ||
403 | /* Create a channel to the NET kernel. */ | 403 | /* Create a channel to the NET kernel. */ |
@@ -411,7 +411,7 @@ int ifconfig_main(int argc, char **argv) | |||
411 | continue; | 411 | continue; |
412 | } | 412 | } |
413 | #endif | 413 | #endif |
414 | sai.sin_addr = lsa->sin.sin_addr; | 414 | sai.sin_addr = lsa->u.sin.sin_addr; |
415 | if (ENABLE_FEATURE_CLEAN_UP) | 415 | if (ENABLE_FEATURE_CLEAN_UP) |
416 | free(lsa); | 416 | free(lsa); |
417 | } | 417 | } |
diff --git a/networking/nc.c b/networking/nc.c index b2f590adf..feb9c5db6 100644 --- a/networking/nc.c +++ b/networking/nc.c | |||
@@ -103,14 +103,14 @@ int nc_main(int argc, char **argv) | |||
103 | if (lport) | 103 | if (lport) |
104 | set_nport(lsa, htons(lport)); | 104 | set_nport(lsa, htons(lport)); |
105 | setsockopt_reuseaddr(sfd); | 105 | setsockopt_reuseaddr(sfd); |
106 | xbind(sfd, &lsa->sa, lsa->len); | 106 | xbind(sfd, &lsa->u.sa, lsa->len); |
107 | xlisten(sfd, do_listen); /* can be > 1 */ | 107 | xlisten(sfd, do_listen); /* can be > 1 */ |
108 | /* If we didn't specify a port number, | 108 | /* If we didn't specify a port number, |
109 | * query and print it after listen() */ | 109 | * query and print it after listen() */ |
110 | if (!lport) { | 110 | if (!lport) { |
111 | socklen_t addrlen = lsa->len; | 111 | socklen_t addrlen = lsa->len; |
112 | getsockname(sfd, &lsa->sa, &addrlen); | 112 | getsockname(sfd, &lsa->u.sa, &addrlen); |
113 | lport = get_nport(&lsa->sa); | 113 | lport = get_nport(&lsa->u.sa); |
114 | fdprintf(2, "%d\n", ntohs(lport)); | 114 | fdprintf(2, "%d\n", ntohs(lport)); |
115 | } | 115 | } |
116 | close_on_exec_on(sfd); | 116 | close_on_exec_on(sfd); |
diff --git a/networking/ping.c b/networking/ping.c index 0b33abf9a..382389dc2 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -209,7 +209,7 @@ int ping_main(int argc, char **argv) | |||
209 | alarm(5); /* give the host 5000ms to respond */ | 209 | alarm(5); /* give the host 5000ms to respond */ |
210 | 210 | ||
211 | #if ENABLE_PING6 | 211 | #if ENABLE_PING6 |
212 | if (lsa->sa.sa_family == AF_INET6) | 212 | if (lsa->u.sa.sa_family == AF_INET6) |
213 | ping6(lsa); | 213 | ping6(lsa); |
214 | else | 214 | else |
215 | #endif | 215 | #endif |
@@ -532,12 +532,12 @@ static void ping4(len_and_sockaddr *lsa) | |||
532 | int sockopt; | 532 | int sockopt; |
533 | 533 | ||
534 | pingsock = create_icmp_socket(); | 534 | pingsock = create_icmp_socket(); |
535 | pingaddr.sin = lsa->sin; | 535 | pingaddr.sin = lsa->u.sin; |
536 | if (source_lsa) { | 536 | if (source_lsa) { |
537 | if (setsockopt(pingsock, IPPROTO_IP, IP_MULTICAST_IF, | 537 | if (setsockopt(pingsock, IPPROTO_IP, IP_MULTICAST_IF, |
538 | &source_lsa->sa, source_lsa->len)) | 538 | &source_lsa->u.sa, source_lsa->len)) |
539 | bb_error_msg_and_die("can't set multicast source interface"); | 539 | bb_error_msg_and_die("can't set multicast source interface"); |
540 | xbind(pingsock, &source_lsa->sa, source_lsa->len); | 540 | xbind(pingsock, &source_lsa->u.sa, source_lsa->len); |
541 | } | 541 | } |
542 | if (opt_I) | 542 | if (opt_I) |
543 | setsockopt(pingsock, SOL_SOCKET, SO_BINDTODEVICE, opt_I, strlen(opt_I) + 1); | 543 | setsockopt(pingsock, SOL_SOCKET, SO_BINDTODEVICE, opt_I, strlen(opt_I) + 1); |
@@ -584,10 +584,10 @@ static void ping6(len_and_sockaddr *lsa) | |||
584 | char control_buf[CMSG_SPACE(36)]; | 584 | char control_buf[CMSG_SPACE(36)]; |
585 | 585 | ||
586 | pingsock = create_icmp6_socket(); | 586 | pingsock = create_icmp6_socket(); |
587 | pingaddr.sin6 = lsa->sin6; | 587 | pingaddr.sin6 = lsa->u.sin6; |
588 | /* untested whether "-I addr" really works for IPv6: */ | 588 | /* untested whether "-I addr" really works for IPv6: */ |
589 | if (source_lsa) | 589 | if (source_lsa) |
590 | xbind(pingsock, &source_lsa->sa, source_lsa->len); | 590 | xbind(pingsock, &source_lsa->u.sa, source_lsa->len); |
591 | if (opt_I) | 591 | if (opt_I) |
592 | setsockopt(pingsock, SOL_SOCKET, SO_BINDTODEVICE, opt_I, strlen(opt_I) + 1); | 592 | setsockopt(pingsock, SOL_SOCKET, SO_BINDTODEVICE, opt_I, strlen(opt_I) + 1); |
593 | 593 | ||
@@ -670,12 +670,12 @@ static void ping(len_and_sockaddr *lsa) | |||
670 | printf("PING %s (%s)", hostname, dotted); | 670 | printf("PING %s (%s)", hostname, dotted); |
671 | if (source_lsa) { | 671 | if (source_lsa) { |
672 | printf(" from %s", | 672 | printf(" from %s", |
673 | xmalloc_sockaddr2dotted_noport(&source_lsa->sa)); | 673 | xmalloc_sockaddr2dotted_noport(&source_lsa->u.sa)); |
674 | } | 674 | } |
675 | printf(": %d data bytes\n", datalen); | 675 | printf(": %d data bytes\n", datalen); |
676 | 676 | ||
677 | #if ENABLE_PING6 | 677 | #if ENABLE_PING6 |
678 | if (lsa->sa.sa_family == AF_INET6) | 678 | if (lsa->u.sa.sa_family == AF_INET6) |
679 | ping6(lsa); | 679 | ping6(lsa); |
680 | else | 680 | else |
681 | #endif | 681 | #endif |
@@ -720,11 +720,11 @@ int ping_main(int argc, char **argv) | |||
720 | lsa = xhost_and_af2sockaddr(hostname, 0, AF_INET); | 720 | lsa = xhost_and_af2sockaddr(hostname, 0, AF_INET); |
721 | #endif | 721 | #endif |
722 | 722 | ||
723 | if (source_lsa && source_lsa->sa.sa_family != lsa->sa.sa_family) | 723 | if (source_lsa && source_lsa->u.sa.sa_family != lsa->u.sa.sa_family) |
724 | /* leaking it here... */ | 724 | /* leaking it here... */ |
725 | source_lsa = NULL; | 725 | source_lsa = NULL; |
726 | 726 | ||
727 | dotted = xmalloc_sockaddr2dotted_noport(&lsa->sa); | 727 | dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa); |
728 | ping(lsa); | 728 | ping(lsa); |
729 | pingstats(0); | 729 | pingstats(0); |
730 | return EXIT_SUCCESS; | 730 | return EXIT_SUCCESS; |
diff --git a/networking/pscan.c b/networking/pscan.c index d18f8dbd9..830419371 100644 --- a/networking/pscan.c +++ b/networking/pscan.c | |||
@@ -73,14 +73,14 @@ int pscan_main(int argc, char **argv) | |||
73 | 73 | ||
74 | /* The SOCK_STREAM socket type is implemented on the TCP/IP protocol. */ | 74 | /* The SOCK_STREAM socket type is implemented on the TCP/IP protocol. */ |
75 | set_nport(lsap, htons(port)); | 75 | set_nport(lsap, htons(port)); |
76 | s = xsocket(lsap->sa.sa_family, SOCK_STREAM, 0); | 76 | s = xsocket(lsap->u.sa.sa_family, SOCK_STREAM, 0); |
77 | 77 | ||
78 | /* We need unblocking socket so we don't need to wait for ETIMEOUT. */ | 78 | /* We need unblocking socket so we don't need to wait for ETIMEOUT. */ |
79 | /* Nonblocking connect typically "fails" with errno == EINPROGRESS */ | 79 | /* Nonblocking connect typically "fails" with errno == EINPROGRESS */ |
80 | ndelay_on(s); | 80 | ndelay_on(s); |
81 | DMSG("connect to port %u", port); | 81 | DMSG("connect to port %u", port); |
82 | start = MONOTONIC_US(); | 82 | start = MONOTONIC_US(); |
83 | if (connect(s, &lsap->sa, lsap->len) == 0) { | 83 | if (connect(s, &lsap->u.sa, lsap->len) == 0) { |
84 | /* Unlikely, for me even localhost fails :) */ | 84 | /* Unlikely, for me even localhost fails :) */ |
85 | DMSG("connect succeeded"); | 85 | DMSG("connect succeeded"); |
86 | goto open; | 86 | goto open; |
diff --git a/networking/tftp.c b/networking/tftp.c index a2683971a..737ae7893 100644 --- a/networking/tftp.c +++ b/networking/tftp.c | |||
@@ -127,7 +127,7 @@ static int tftp( USE_GETPUT(const int cmd,) | |||
127 | char *cp; | 127 | char *cp; |
128 | 128 | ||
129 | unsigned org_port; | 129 | unsigned org_port; |
130 | len_and_sockaddr *const from = alloca(offsetof(len_and_sockaddr, sa) + peer_lsa->len); | 130 | len_and_sockaddr *const from = alloca(offsetof(len_and_sockaddr, u.sa) + peer_lsa->len); |
131 | 131 | ||
132 | /* Can't use RESERVE_CONFIG_BUFFER here since the allocation | 132 | /* Can't use RESERVE_CONFIG_BUFFER here since the allocation |
133 | * size varies meaning BUFFERS_GO_ON_STACK would fail */ | 133 | * size varies meaning BUFFERS_GO_ON_STACK would fail */ |
@@ -138,7 +138,7 @@ static int tftp( USE_GETPUT(const int cmd,) | |||
138 | 138 | ||
139 | port = org_port = htons(port); | 139 | port = org_port = htons(port); |
140 | 140 | ||
141 | socketfd = xsocket(peer_lsa->sa.sa_family, SOCK_DGRAM, 0); | 141 | socketfd = xsocket(peer_lsa->u.sa.sa_family, SOCK_DGRAM, 0); |
142 | 142 | ||
143 | /* build opcode */ | 143 | /* build opcode */ |
144 | opcode = TFTP_WRQ; | 144 | opcode = TFTP_WRQ; |
@@ -216,7 +216,7 @@ static int tftp( USE_GETPUT(const int cmd,) | |||
216 | fprintf(stderr, "%02x ", (unsigned char) *cp); | 216 | fprintf(stderr, "%02x ", (unsigned char) *cp); |
217 | fprintf(stderr, "\n"); | 217 | fprintf(stderr, "\n"); |
218 | #endif | 218 | #endif |
219 | xsendto(socketfd, xbuf, send_len, &peer_lsa->sa, peer_lsa->len); | 219 | xsendto(socketfd, xbuf, send_len, &peer_lsa->u.sa, peer_lsa->len); |
220 | /* Was it final ACK? then exit */ | 220 | /* Was it final ACK? then exit */ |
221 | if (finished && (opcode == TFTP_ACK)) | 221 | if (finished && (opcode == TFTP_ACK)) |
222 | goto ret; | 222 | goto ret; |
@@ -229,14 +229,14 @@ static int tftp( USE_GETPUT(const int cmd,) | |||
229 | unsigned from_port; | 229 | unsigned from_port; |
230 | case 1: | 230 | case 1: |
231 | from->len = peer_lsa->len; | 231 | from->len = peer_lsa->len; |
232 | memset(&from->sa, 0, peer_lsa->len); | 232 | memset(&from->u.sa, 0, peer_lsa->len); |
233 | len = recvfrom(socketfd, rbuf, tftp_bufsize, 0, | 233 | len = recvfrom(socketfd, rbuf, tftp_bufsize, 0, |
234 | &from->sa, &from->len); | 234 | &from->u.sa, &from->len); |
235 | if (len < 0) { | 235 | if (len < 0) { |
236 | bb_perror_msg("recvfrom"); | 236 | bb_perror_msg("recvfrom"); |
237 | goto ret; | 237 | goto ret; |
238 | } | 238 | } |
239 | from_port = get_nport(&from->sa); | 239 | from_port = get_nport(&from->u.sa); |
240 | if (port == org_port) { | 240 | if (port == org_port) { |
241 | /* Our first query went to port 69 | 241 | /* Our first query went to port 69 |
242 | * but reply will come from different one. | 242 | * but reply will come from different one. |
@@ -316,7 +316,7 @@ static int tftp( USE_GETPUT(const int cmd,) | |||
316 | /*static const uint16_t error_8[2] = { htons(TFTP_ERROR), htons(8) };*/ | 316 | /*static const uint16_t error_8[2] = { htons(TFTP_ERROR), htons(8) };*/ |
317 | /* thus we open-code big-endian layout */ | 317 | /* thus we open-code big-endian layout */ |
318 | static const uint8_t error_8[4] = { 0,TFTP_ERROR, 0,8 }; | 318 | static const uint8_t error_8[4] = { 0,TFTP_ERROR, 0,8 }; |
319 | xsendto(socketfd, error_8, 4, &peer_lsa->sa, peer_lsa->len); | 319 | xsendto(socketfd, error_8, 4, &peer_lsa->u.sa, peer_lsa->len); |
320 | bb_error_msg("server proposes bad blksize %d, exiting", blksize); | 320 | bb_error_msg("server proposes bad blksize %d, exiting", blksize); |
321 | goto ret; | 321 | goto ret; |
322 | } | 322 | } |
@@ -449,7 +449,7 @@ int tftp_main(int argc, char **argv) | |||
449 | 449 | ||
450 | #if ENABLE_DEBUG_TFTP | 450 | #if ENABLE_DEBUG_TFTP |
451 | fprintf(stderr, "using server '%s', remotefile '%s', localfile '%s'\n", | 451 | fprintf(stderr, "using server '%s', remotefile '%s', localfile '%s'\n", |
452 | xmalloc_sockaddr2dotted(&peer_lsa->sa), | 452 | xmalloc_sockaddr2dotted(&peer_lsa->u.sa), |
453 | remotefile, localfile); | 453 | remotefile, localfile); |
454 | #endif | 454 | #endif |
455 | 455 | ||
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c index 491b8871e..5bf1a491c 100644 --- a/networking/udhcp/files.c +++ b/networking/udhcp/files.c | |||
@@ -19,7 +19,7 @@ static int read_ip(const char *line, void *arg) | |||
19 | lsa = host_and_af2sockaddr(line, 0, AF_INET); | 19 | lsa = host_and_af2sockaddr(line, 0, AF_INET); |
20 | if (!lsa) | 20 | if (!lsa) |
21 | return 0; | 21 | return 0; |
22 | *(uint32_t*)arg = lsa->sin.sin_addr.s_addr; | 22 | *(uint32_t*)arg = lsa->u.sin.sin_addr.s_addr; |
23 | free(lsa); | 23 | free(lsa); |
24 | return 1; | 24 | return 1; |
25 | } | 25 | } |
diff --git a/networking/wget.c b/networking/wget.c index 1147077e0..6c1c385b7 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -535,7 +535,7 @@ int wget_main(int argc, char **argv) | |||
535 | lsa = xhost2sockaddr(server.host, server.port); | 535 | lsa = xhost2sockaddr(server.host, server.port); |
536 | if (!(opt & WGET_OPT_QUIET)) { | 536 | if (!(opt & WGET_OPT_QUIET)) { |
537 | fprintf(stderr, "Connecting to %s (%s)\n", server.host, | 537 | fprintf(stderr, "Connecting to %s (%s)\n", server.host, |
538 | xmalloc_sockaddr2dotted(&lsa->sa)); | 538 | xmalloc_sockaddr2dotted(&lsa->u.sa)); |
539 | /* We leak result of xmalloc_sockaddr2dotted */ | 539 | /* We leak result of xmalloc_sockaddr2dotted */ |
540 | } | 540 | } |
541 | 541 | ||