aboutsummaryrefslogtreecommitdiff
path: root/ipsvd
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-08-18 14:16:39 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-08-18 14:16:39 +0000
commita27a11bb2c033d3e0312dc1d62430a002314686f (patch)
tree74b32a18cb1e09c4f663a49c27ffa3725d3e4ee5 /ipsvd
parentb98c26ad684e3aed8f1480458737f1ab90477c9e (diff)
downloadbusybox-w32-a27a11bb2c033d3e0312dc1d62430a002314686f.tar.gz
busybox-w32-a27a11bb2c033d3e0312dc1d62430a002314686f.tar.bz2
busybox-w32-a27a11bb2c033d3e0312dc1d62430a002314686f.zip
introduce and use xdup2(int, int)
stop checking whether setsockopt_reuseaddr(int fd) was successful (it always is) remove second parameter (sockllen) from xmalloc_sockaddr2xxxxx functions sockaddr2str 142 156 +14 collect_blk 467 474 +7 xdup2 28 33 +5 singlemount 4456 4454 -2 print_host 214 212 -2 nslookup_main 139 137 -2 ftpgetput_main 414 412 -2 udhcpd_main 1258 1255 -3 udhcpc_main 2405 2402 -3 traceroute_main 4125 4122 -3 nc_main 1072 1069 -3 buffer_fill_and_print 76 73 -3 xmalloc_sockaddr2hostonly_noport 18 14 -4 xmalloc_sockaddr2host_noport 18 14 -4 xmalloc_sockaddr2host 15 11 -4 xmalloc_sockaddr2dotted_noport 18 14 -4 xmalloc_sockaddr2dotted 18 14 -4 wget_main 2618 2614 -4 ping_main 393 389 -4 ip_port_str 120 115 -5 dhcprelay_main 1146 1141 -5 dnsd_main 1531 1525 -6 passwd_main 1110 1102 -8 udhcp_kernel_packet 206 197 -9 udhcp_listen_socket 154 144 -10 getty_main 2576 2566 -10 setup 655 640 -15 xmove_fd 51 34 -17 dolisten 759 742 -17 tcpudpsvd_main 1866 1836 -30 startservice 339 299 -40
Diffstat (limited to 'ipsvd')
-rw-r--r--ipsvd/tcpudp.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ipsvd/tcpudp.c b/ipsvd/tcpudp.c
index 492808a6b..e46b3c60e 100644
--- a/ipsvd/tcpudp.c
+++ b/ipsvd/tcpudp.c
@@ -258,7 +258,7 @@ int tcpudpsvd_main(int argc, char **argv)
258#endif 258#endif
259 259
260 if (verbose) { 260 if (verbose) {
261 char *addr = xmalloc_sockaddr2dotted(&lsa->sa, sa_len); 261 char *addr = xmalloc_sockaddr2dotted(&lsa->sa);
262 printf("%s: info: listening on %s", applet_name, addr); 262 printf("%s: info: listening on %s", applet_name, addr);
263 free(addr); 263 free(addr);
264#ifndef SSLSVD 264#ifndef SSLSVD
@@ -302,7 +302,7 @@ int tcpudpsvd_main(int argc, char **argv)
302 if (max_per_host) { 302 if (max_per_host) {
303 /* Drop connection immediately if cur_per_host > max_per_host 303 /* Drop connection immediately if cur_per_host > max_per_host
304 * (minimizing load under SYN flood) */ 304 * (minimizing load under SYN flood) */
305 remote_ip = xmalloc_sockaddr2dotted_noport(&remote.sa, sa_len); 305 remote_ip = xmalloc_sockaddr2dotted_noport(&remote.sa);
306 cur_per_host = ipsvd_perhost_add(remote_ip, max_per_host, &hccp); 306 cur_per_host = ipsvd_perhost_add(remote_ip, max_per_host, &hccp);
307 if (cur_per_host > max_per_host) { 307 if (cur_per_host > max_per_host) {
308 /* ipsvd_perhost_add detected that max is exceeded 308 /* ipsvd_perhost_add detected that max is exceeded
@@ -380,11 +380,11 @@ int tcpudpsvd_main(int argc, char **argv)
380 close(sock); 380 close(sock);
381 381
382 if (need_remote_ip) 382 if (need_remote_ip)
383 remote_addr = xmalloc_sockaddr2dotted(&remote.sa, sa_len); 383 remote_addr = xmalloc_sockaddr2dotted(&remote.sa);
384 384
385 if (need_hostnames) { 385 if (need_hostnames) {
386 if (option_mask32 & OPT_h) { 386 if (option_mask32 & OPT_h) {
387 remote_hostname = xmalloc_sockaddr2host_noport(&remote.sa, sa_len); 387 remote_hostname = xmalloc_sockaddr2host_noport(&remote.sa);
388 if (!remote_hostname) { 388 if (!remote_hostname) {
389 bb_error_msg("warning: cannot look up hostname for %s", remote_addr); 389 bb_error_msg("warning: cannot look up hostname for %s", remote_addr);
390 remote_hostname = (char*)""; 390 remote_hostname = (char*)"";
@@ -397,9 +397,9 @@ int tcpudpsvd_main(int argc, char **argv)
397 local.len = sa_len; 397 local.len = sa_len;
398 getsockname(0, &local.sa, &local.len); 398 getsockname(0, &local.sa, &local.len);
399 } 399 }
400 local_addr = xmalloc_sockaddr2dotted(&local.sa, sa_len); 400 local_addr = xmalloc_sockaddr2dotted(&local.sa);
401 if (!local_hostname) { 401 if (!local_hostname) {
402 local_hostname = xmalloc_sockaddr2host_noport(&local.sa, sa_len); 402 local_hostname = xmalloc_sockaddr2host_noport(&local.sa);
403 if (!local_hostname) 403 if (!local_hostname)
404 bb_error_msg_and_die("warning: cannot look up hostname for %s"+9, local_addr); 404 bb_error_msg_and_die("warning: cannot look up hostname for %s"+9, local_addr);
405 } 405 }
@@ -426,7 +426,7 @@ int tcpudpsvd_main(int argc, char **argv)
426 * an outbond connection to local handler, and it needs 426 * an outbond connection to local handler, and it needs
427 * to know where it originally tried to connect */ 427 * to know where it originally tried to connect */
428 if (tcp && getsockopt(0, SOL_IP, SO_ORIGINAL_DST, &lsa->sa, &lsa->len) == 0) { 428 if (tcp && getsockopt(0, SOL_IP, SO_ORIGINAL_DST, &lsa->sa, &lsa->len) == 0) {
429 char *addr = xmalloc_sockaddr2dotted(&lsa->sa, sa_len); 429 char *addr = xmalloc_sockaddr2dotted(&lsa->sa);
430 xsetenv("TCPORIGDSTADDR", addr); 430 xsetenv("TCPORIGDSTADDR", addr);
431 free(addr); 431 free(addr);
432 } 432 }