diff options
author | Ron Yorston <rmy@pobox.com> | 2012-04-23 10:57:02 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-04-23 10:57:02 +0100 |
commit | 2903c15333636ae51db14cab009533bac68c8a30 (patch) | |
tree | 11a49598f98c505c021202564348c5639e2fb0b1 /networking | |
parent | 5fc2c035953f71992197f6025918a8fe79ade1d3 (diff) | |
parent | f5234398ef3010b68468cafe3e2ea89b2bb08a17 (diff) | |
download | busybox-w32-2903c15333636ae51db14cab009533bac68c8a30.tar.gz busybox-w32-2903c15333636ae51db14cab009533bac68c8a30.tar.bz2 busybox-w32-2903c15333636ae51db14cab009533bac68c8a30.zip |
Merge commit '1_20_0' into merge
Diffstat (limited to 'networking')
-rw-r--r-- | networking/hostname.c | 2 | ||||
-rw-r--r-- | networking/httpd.c | 6 | ||||
-rw-r--r-- | networking/ntpd.c | 23 | ||||
-rw-r--r-- | networking/udhcp/arpping.c | 9 | ||||
-rw-r--r-- | networking/udhcp/d6_common.h | 4 | ||||
-rw-r--r-- | networking/udhcp/d6_dhcpc.c | 2 | ||||
-rw-r--r-- | networking/udhcp/dhcpc.c | 1 |
7 files changed, 31 insertions, 16 deletions
diff --git a/networking/hostname.c b/networking/hostname.c index 5f663908c..d2516b5fb 100644 --- a/networking/hostname.c +++ b/networking/hostname.c | |||
@@ -153,7 +153,7 @@ int hostname_main(int argc UNUSED_PARAM, char **argv) | |||
153 | if (hp->h_length == sizeof(struct in_addr)) { | 153 | if (hp->h_length == sizeof(struct in_addr)) { |
154 | struct in_addr **h_addr_list = (struct in_addr **)hp->h_addr_list; | 154 | struct in_addr **h_addr_list = (struct in_addr **)hp->h_addr_list; |
155 | while (*h_addr_list) { | 155 | while (*h_addr_list) { |
156 | printf("%s ", inet_ntoa(**h_addr_list)); | 156 | printf(h_addr_list[1] ? "%s " : "%s", inet_ntoa(**h_addr_list)); |
157 | h_addr_list++; | 157 | h_addr_list++; |
158 | } | 158 | } |
159 | bb_putchar('\n'); | 159 | bb_putchar('\n'); |
diff --git a/networking/httpd.c b/networking/httpd.c index f233cb0ba..12218a0a3 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -1594,7 +1594,7 @@ static NOINLINE void send_file_and_exit(const char *url, int what) | |||
1594 | } | 1594 | } |
1595 | range_len = MAXINT(off_t); | 1595 | range_len = MAXINT(off_t); |
1596 | if (range_start >= 0) { | 1596 | if (range_start >= 0) { |
1597 | if (!range_end) { | 1597 | if (!range_end || range_end > file_size - 1) { |
1598 | range_end = file_size - 1; | 1598 | range_end = file_size - 1; |
1599 | } | 1599 | } |
1600 | if (range_end < range_start | 1600 | if (range_end < range_start |
@@ -1676,7 +1676,7 @@ static int checkPermIP(void) | |||
1676 | 1676 | ||
1677 | #if ENABLE_FEATURE_HTTPD_BASIC_AUTH | 1677 | #if ENABLE_FEATURE_HTTPD_BASIC_AUTH |
1678 | 1678 | ||
1679 | # if ENABLE_FEATURE_HTTPD_AUTH_MD5 && ENABLE_PAM | 1679 | # if ENABLE_PAM |
1680 | struct pam_userinfo { | 1680 | struct pam_userinfo { |
1681 | const char *name; | 1681 | const char *name; |
1682 | const char *pw; | 1682 | const char *pw; |
@@ -1842,7 +1842,9 @@ static int check_user_passwd(const char *path, char *user_and_passwd) | |||
1842 | 1842 | ||
1843 | if (passwd[0] == '$' && isdigit(passwd[1])) { | 1843 | if (passwd[0] == '$' && isdigit(passwd[1])) { |
1844 | char *encrypted; | 1844 | char *encrypted; |
1845 | # if !ENABLE_PAM | ||
1845 | check_encrypted: | 1846 | check_encrypted: |
1847 | # endif | ||
1846 | /* encrypt pwd from peer and check match with local one */ | 1848 | /* encrypt pwd from peer and check match with local one */ |
1847 | encrypted = pw_encrypt( | 1849 | encrypted = pw_encrypt( |
1848 | /* pwd (from peer): */ colon_after_user + 1, | 1850 | /* pwd (from peer): */ colon_after_user + 1, |
diff --git a/networking/ntpd.c b/networking/ntpd.c index 4d939458c..603801ec6 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c | |||
@@ -276,6 +276,9 @@ struct globals { | |||
276 | llist_t *ntp_peers; | 276 | llist_t *ntp_peers; |
277 | #if ENABLE_FEATURE_NTPD_SERVER | 277 | #if ENABLE_FEATURE_NTPD_SERVER |
278 | int listen_fd; | 278 | int listen_fd; |
279 | # define G_listen_fd (G.listen_fd) | ||
280 | #else | ||
281 | # define G_listen_fd (-1) | ||
279 | #endif | 282 | #endif |
280 | unsigned verbose; | 283 | unsigned verbose; |
281 | unsigned peer_cnt; | 284 | unsigned peer_cnt; |
@@ -1815,10 +1818,10 @@ recv_and_process_client_pkt(void /*int fd*/) | |||
1815 | uint8_t query_status; | 1818 | uint8_t query_status; |
1816 | l_fixedpt_t query_xmttime; | 1819 | l_fixedpt_t query_xmttime; |
1817 | 1820 | ||
1818 | to = get_sock_lsa(G.listen_fd); | 1821 | to = get_sock_lsa(G_listen_fd); |
1819 | from = xzalloc(to->len); | 1822 | from = xzalloc(to->len); |
1820 | 1823 | ||
1821 | size = recv_from_to(G.listen_fd, &msg, sizeof(msg), MSG_DONTWAIT, from, &to->u.sa, to->len); | 1824 | size = recv_from_to(G_listen_fd, &msg, sizeof(msg), MSG_DONTWAIT, from, &to->u.sa, to->len); |
1822 | if (size != NTP_MSGSIZE_NOAUTH && size != NTP_MSGSIZE) { | 1825 | if (size != NTP_MSGSIZE_NOAUTH && size != NTP_MSGSIZE) { |
1823 | char *addr; | 1826 | char *addr; |
1824 | if (size < 0) { | 1827 | if (size < 0) { |
@@ -1861,7 +1864,7 @@ recv_and_process_client_pkt(void /*int fd*/) | |||
1861 | 1864 | ||
1862 | /* We reply from the local address packet was sent to, | 1865 | /* We reply from the local address packet was sent to, |
1863 | * this makes to/from look swapped here: */ | 1866 | * this makes to/from look swapped here: */ |
1864 | do_sendto(G.listen_fd, | 1867 | do_sendto(G_listen_fd, |
1865 | /*from:*/ &to->u.sa, /*to:*/ from, /*addrlen:*/ to->len, | 1868 | /*from:*/ &to->u.sa, /*to:*/ from, /*addrlen:*/ to->len, |
1866 | &msg, size); | 1869 | &msg, size); |
1867 | 1870 | ||
@@ -2000,11 +2003,11 @@ static NOINLINE void ntp_init(char **argv) | |||
2000 | logmode = LOGMODE_NONE; | 2003 | logmode = LOGMODE_NONE; |
2001 | } | 2004 | } |
2002 | #if ENABLE_FEATURE_NTPD_SERVER | 2005 | #if ENABLE_FEATURE_NTPD_SERVER |
2003 | G.listen_fd = -1; | 2006 | G_listen_fd = -1; |
2004 | if (opts & OPT_l) { | 2007 | if (opts & OPT_l) { |
2005 | G.listen_fd = create_and_bind_dgram_or_die(NULL, 123); | 2008 | G_listen_fd = create_and_bind_dgram_or_die(NULL, 123); |
2006 | socket_want_pktinfo(G.listen_fd); | 2009 | socket_want_pktinfo(G_listen_fd); |
2007 | setsockopt(G.listen_fd, IPPROTO_IP, IP_TOS, &const_IPTOS_LOWDELAY, sizeof(const_IPTOS_LOWDELAY)); | 2010 | setsockopt(G_listen_fd, IPPROTO_IP, IP_TOS, &const_IPTOS_LOWDELAY, sizeof(const_IPTOS_LOWDELAY)); |
2008 | } | 2011 | } |
2009 | #endif | 2012 | #endif |
2010 | /* I hesitate to set -20 prio. -15 should be high enough for timekeeping */ | 2013 | /* I hesitate to set -20 prio. -15 should be high enough for timekeeping */ |
@@ -2078,8 +2081,8 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv) | |||
2078 | 2081 | ||
2079 | i = 0; | 2082 | i = 0; |
2080 | #if ENABLE_FEATURE_NTPD_SERVER | 2083 | #if ENABLE_FEATURE_NTPD_SERVER |
2081 | if (G.listen_fd != -1) { | 2084 | if (G_listen_fd != -1) { |
2082 | pfd[0].fd = G.listen_fd; | 2085 | pfd[0].fd = G_listen_fd; |
2083 | pfd[0].events = POLLIN; | 2086 | pfd[0].events = POLLIN; |
2084 | i++; | 2087 | i++; |
2085 | } | 2088 | } |
@@ -2125,7 +2128,7 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv) | |||
2125 | 2128 | ||
2126 | /* Here we may block */ | 2129 | /* Here we may block */ |
2127 | VERB2 { | 2130 | VERB2 { |
2128 | if (i > (ENABLE_FEATURE_NTPD_SERVER && G.listen_fd != -1)) { | 2131 | if (i > (ENABLE_FEATURE_NTPD_SERVER && G_listen_fd != -1)) { |
2129 | /* We wait for at least one reply. | 2132 | /* We wait for at least one reply. |
2130 | * Poll for it, without wasting time for message. | 2133 | * Poll for it, without wasting time for message. |
2131 | * Since replies often come under 1 second, this also | 2134 | * Since replies often come under 1 second, this also |
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c index ff6347847..b43e52e96 100644 --- a/networking/udhcp/arpping.c +++ b/networking/udhcp/arpping.c | |||
@@ -118,8 +118,13 @@ int FAST_FUNC arpping(uint32_t test_nip, | |||
118 | break; | 118 | break; |
119 | } | 119 | } |
120 | } | 120 | } |
121 | timeout_ms -= (unsigned)monotonic_ms() - prevTime; | 121 | timeout_ms -= (unsigned)monotonic_ms() - prevTime + 1; |
122 | } while (timeout_ms > 0); | 122 | |
123 | /* We used to check "timeout_ms > 0", but | ||
124 | * this is more under/overflow-resistant | ||
125 | * (people did see overflows here when system time jumps): | ||
126 | */ | ||
127 | } while ((unsigned)timeout_ms <= 2000); | ||
123 | 128 | ||
124 | ret: | 129 | ret: |
125 | close(s); | 130 | close(s); |
diff --git a/networking/udhcp/d6_common.h b/networking/udhcp/d6_common.h index 4dd7e621e..eb211ea0f 100644 --- a/networking/udhcp/d6_common.h +++ b/networking/udhcp/d6_common.h | |||
@@ -115,7 +115,11 @@ int FAST_FUNC d6_send_kernel_packet( | |||
115 | struct in6_addr *dst_ipv6, int dest_port | 115 | struct in6_addr *dst_ipv6, int dest_port |
116 | ); | 116 | ); |
117 | 117 | ||
118 | #if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 2 | ||
118 | void FAST_FUNC d6_dump_packet(struct d6_packet *packet); | 119 | void FAST_FUNC d6_dump_packet(struct d6_packet *packet); |
120 | #else | ||
121 | # define d6_dump_packet(packet) ((void)0) | ||
122 | #endif | ||
119 | 123 | ||
120 | 124 | ||
121 | POP_SAVED_FUNCTION_VISIBILITY | 125 | POP_SAVED_FUNCTION_VISIBILITY |
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c index 23e6862dc..a792a9dca 100644 --- a/networking/udhcp/d6_dhcpc.c +++ b/networking/udhcp/d6_dhcpc.c | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | //applet:IF_UDHCPC6(APPLET(udhcpc6, BB_DIR_USR_BIN, BB_SUID_DROP)) | 20 | //applet:IF_UDHCPC6(APPLET(udhcpc6, BB_DIR_USR_BIN, BB_SUID_DROP)) |
21 | 21 | ||
22 | //kbuild:lib-$(CONFIG_UDHCPC6) += d6_dhcpc.o d6_packet.o d6_socket.o common.o | 22 | //kbuild:lib-$(CONFIG_UDHCPC6) += d6_dhcpc.o d6_packet.o d6_socket.o common.o socket.o signalpipe.o |
23 | 23 | ||
24 | 24 | ||
25 | #include <syslog.h> | 25 | #include <syslog.h> |
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 2f2016cd5..ddb328dd5 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c | |||
@@ -101,6 +101,7 @@ static const uint8_t len_of_option_as_string[] = { | |||
101 | [OPTION_STATIC_ROUTES ] = sizeof("255.255.255.255/32 255.255.255.255 "), | 101 | [OPTION_STATIC_ROUTES ] = sizeof("255.255.255.255/32 255.255.255.255 "), |
102 | [OPTION_6RD ] = sizeof("32 128 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 255.255.255.255 "), | 102 | [OPTION_6RD ] = sizeof("32 128 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 255.255.255.255 "), |
103 | [OPTION_STRING ] = 1, | 103 | [OPTION_STRING ] = 1, |
104 | [OPTION_STRING_HOST ] = 1, | ||
104 | #if ENABLE_FEATURE_UDHCP_RFC3397 | 105 | #if ENABLE_FEATURE_UDHCP_RFC3397 |
105 | [OPTION_DNS_STRING ] = 1, /* unused */ | 106 | [OPTION_DNS_STRING ] = 1, /* unused */ |
106 | /* Hmmm, this severely overestimates size if SIP_SERVERS option | 107 | /* Hmmm, this severely overestimates size if SIP_SERVERS option |