tcpudp.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. /* Based on ipsvd utilities written by Gerrit Pape <pape@smarden.org>
  2. * which are released into public domain by the author.
  3. * Homepage: http://smarden.sunsite.dk/ipsvd/
  4. *
  5. * Copyright (C) 2007 Denys Vlasenko.
  6. *
  7. * Licensed under GPLv2, see file LICENSE in this tarball for details.
  8. */
  9. /* Based on ipsvd ipsvd-0.12.1. This tcpsvd accepts all options
  10. * which are supported by one from ipsvd-0.12.1, but not all are
  11. * functional. See help text at the end of this file for details.
  12. *
  13. * Code inside "#ifdef SSLSVD" is for sslsvd and is currently unused.
  14. *
  15. * Busybox version exports TCPLOCALADDR instead of
  16. * TCPLOCALIP + TCPLOCALPORT pair. ADDR more closely matches reality
  17. * (which is "struct sockaddr_XXX". Port is not a separate entity,
  18. * it's just a part of (AF_INET[6]) sockaddr!).
  19. *
  20. * TCPORIGDSTADDR is Busybox-specific addition.
  21. *
  22. * udp server is hacked up by reusing TCP code. It has the following
  23. * limitation inherent in Unix DGRAM sockets implementation:
  24. * - local IP address is retrieved (using recvmsg voodoo) but
  25. * child's socket is not bound to it (bind cannot be called on
  26. * already bound socket). Thus it still can emit outgoing packets
  27. * with wrong source IP...
  28. * - don't know how to retrieve ORIGDST for udp.
  29. */
  30. #include <limits.h>
  31. #include <linux/netfilter_ipv4.h> /* wants <limits.h> */
  32. #include "libbb.h"
  33. #include "ipsvd_perhost.h"
  34. #ifdef SSLSVD
  35. #include "matrixSsl.h"
  36. #include "ssl_io.h"
  37. #endif
  38. struct globals {
  39. unsigned verbose;
  40. unsigned max_per_host;
  41. unsigned cur_per_host;
  42. unsigned cnum;
  43. unsigned cmax;
  44. char **env_cur;
  45. char *env_var[1]; /* actually bigger */
  46. };
  47. #define G (*(struct globals*)&bb_common_bufsiz1)
  48. #define verbose (G.verbose )
  49. #define max_per_host (G.max_per_host)
  50. #define cur_per_host (G.cur_per_host)
  51. #define cnum (G.cnum )
  52. #define cmax (G.cmax )
  53. #define env_cur (G.env_cur )
  54. #define env_var (G.env_var )
  55. #define INIT_G() \
  56. do { \
  57. cmax = 30; \
  58. env_cur = &env_var[0]; \
  59. } while (0)
  60. /* We have to be careful about leaking memory in repeated setenv's */
  61. static void xsetenv_plain(const char *n, const char *v)
  62. {
  63. char *var = xasprintf("%s=%s", n, v);
  64. *env_cur++ = var;
  65. putenv(var);
  66. }
  67. static void xsetenv_proto(const char *proto, const char *n, const char *v)
  68. {
  69. char *var = xasprintf("%s%s=%s", proto, n, v);
  70. *env_cur++ = var;
  71. putenv(var);
  72. }
  73. static void undo_xsetenv(void)
  74. {
  75. char **pp = env_cur = &env_var[0];
  76. while (*pp) {
  77. char *var = *pp;
  78. *strchrnul(var, '=') = '\0';
  79. unsetenv(var);
  80. free(var);
  81. *pp++ = NULL;
  82. }
  83. }
  84. static void sig_term_handler(int sig)
  85. {
  86. if (verbose)
  87. bb_error_msg("got signal %u, exit", sig);
  88. kill_myself_with_sig(sig);
  89. }
  90. /* Little bloated, but tries to give accurate info how child exited.
  91. * Makes easier to spot segfaulting children etc... */
  92. static void print_waitstat(unsigned pid, int wstat)
  93. {
  94. unsigned e = 0;
  95. const char *cause = "?exit";
  96. if (WIFEXITED(wstat)) {
  97. cause++;
  98. e = WEXITSTATUS(wstat);
  99. } else if (WIFSIGNALED(wstat)) {
  100. cause = "signal";
  101. e = WTERMSIG(wstat);
  102. }
  103. bb_error_msg("end %d %s %d", pid, cause, e);
  104. }
  105. /* Must match getopt32 in main! */
  106. enum {
  107. OPT_c = (1 << 0),
  108. OPT_C = (1 << 1),
  109. OPT_i = (1 << 2),
  110. OPT_x = (1 << 3),
  111. OPT_u = (1 << 4),
  112. OPT_l = (1 << 5),
  113. OPT_E = (1 << 6),
  114. OPT_b = (1 << 7),
  115. OPT_h = (1 << 8),
  116. OPT_p = (1 << 9),
  117. OPT_t = (1 << 10),
  118. OPT_v = (1 << 11),
  119. OPT_V = (1 << 12),
  120. OPT_U = (1 << 13), /* from here: sslsvd only */
  121. OPT_slash = (1 << 14),
  122. OPT_Z = (1 << 15),
  123. OPT_K = (1 << 16),
  124. };
  125. static void connection_status(void)
  126. {
  127. /* "only 1 client max" desn't need this */
  128. if (cmax > 1)
  129. bb_error_msg("status %u/%u", cnum, cmax);
  130. }
  131. static void sig_child_handler(int sig ATTRIBUTE_UNUSED)
  132. {
  133. int wstat;
  134. int pid;
  135. while ((pid = wait_any_nohang(&wstat)) > 0) {
  136. if (max_per_host)
  137. ipsvd_perhost_remove(pid);
  138. if (cnum)
  139. cnum--;
  140. if (verbose)
  141. print_waitstat(pid, wstat);
  142. }
  143. if (verbose)
  144. connection_status();
  145. }
  146. int tcpudpsvd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  147. int tcpudpsvd_main(int argc ATTRIBUTE_UNUSED, char **argv)
  148. {
  149. char *str_C, *str_t;
  150. char *user;
  151. struct hcc *hccp;
  152. const char *instructs;
  153. char *msg_per_host = NULL;
  154. unsigned len_per_host = len_per_host; /* gcc */
  155. #ifndef SSLSVD
  156. struct bb_uidgid_t ugid;
  157. #endif
  158. bool tcp;
  159. uint16_t local_port;
  160. char *preset_local_hostname = NULL;
  161. char *remote_hostname = remote_hostname; /* for compiler */
  162. char *remote_addr = remote_addr; /* for compiler */
  163. len_and_sockaddr *lsa;
  164. len_and_sockaddr local, remote;
  165. socklen_t sa_len;
  166. int pid;
  167. int sock;
  168. int conn;
  169. unsigned backlog = 20;
  170. INIT_G();
  171. tcp = (applet_name[0] == 't');
  172. /* 3+ args, -i at most once, -p implies -h, -v is counter, -b N, -c N */
  173. opt_complementary = "-3:i--i:ph:vv:b+:c+";
  174. #ifdef SSLSVD
  175. getopt32(argv, "+c:C:i:x:u:l:Eb:hpt:vU:/:Z:K:",
  176. &cmax, &str_C, &instructs, &instructs, &user, &preset_local_hostname,
  177. &backlog, &str_t, &ssluser, &root, &cert, &key, &verbose
  178. );
  179. #else
  180. /* "+": stop on first non-option */
  181. getopt32(argv, "+c:C:i:x:u:l:Eb:hpt:v",
  182. &cmax, &str_C, &instructs, &instructs, &user, &preset_local_hostname,
  183. &backlog, &str_t, &verbose
  184. );
  185. #endif
  186. if (option_mask32 & OPT_C) { /* -C n[:message] */
  187. max_per_host = bb_strtou(str_C, &str_C, 10);
  188. if (str_C[0]) {
  189. if (str_C[0] != ':')
  190. bb_show_usage();
  191. msg_per_host = str_C + 1;
  192. len_per_host = strlen(msg_per_host);
  193. }
  194. }
  195. if (max_per_host > cmax)
  196. max_per_host = cmax;
  197. if (option_mask32 & OPT_u) {
  198. if (!get_uidgid(&ugid, user, 1))
  199. bb_error_msg_and_die("unknown user/group: %s", user);
  200. }
  201. #ifdef SSLSVD
  202. if (option_mask32 & OPT_U) ssluser = optarg;
  203. if (option_mask32 & OPT_slash) root = optarg;
  204. if (option_mask32 & OPT_Z) cert = optarg;
  205. if (option_mask32 & OPT_K) key = optarg;
  206. #endif
  207. argv += optind;
  208. if (!argv[0][0] || LONE_CHAR(argv[0], '0'))
  209. argv[0] = (char*)"0.0.0.0";
  210. /* Per-IP flood protection is not thought-out for UDP */
  211. if (!tcp)
  212. max_per_host = 0;
  213. bb_sanitize_stdio(); /* fd# 0,1,2 must be opened */
  214. #ifdef SSLSVD
  215. sslser = user;
  216. client = 0;
  217. if ((getuid() == 0) && !(option_mask32 & OPT_u)) {
  218. xfunc_exitcode = 100;
  219. bb_error_msg_and_die("-U ssluser must be set when running as root");
  220. }
  221. if (option_mask32 & OPT_u)
  222. if (!uidgid_get(&sslugid, ssluser, 1)) {
  223. if (errno) {
  224. bb_perror_msg_and_die("fatal: cannot get user/group: %s", ssluser);
  225. }
  226. bb_error_msg_and_die("unknown user/group '%s'", ssluser);
  227. }
  228. if (!cert) cert = "./cert.pem";
  229. if (!key) key = cert;
  230. if (matrixSslOpen() < 0)
  231. fatal("cannot initialize ssl");
  232. if (matrixSslReadKeys(&keys, cert, key, 0, ca) < 0) {
  233. if (client)
  234. fatal("cannot read cert, key, or ca file");
  235. fatal("cannot read cert or key file");
  236. }
  237. if (matrixSslNewSession(&ssl, keys, 0, SSL_FLAGS_SERVER) < 0)
  238. fatal("cannot create ssl session");
  239. #endif
  240. sig_block(SIGCHLD);
  241. signal(SIGCHLD, sig_child_handler);
  242. bb_signals(BB_SIGS_FATAL, sig_term_handler);
  243. signal(SIGPIPE, SIG_IGN);
  244. if (max_per_host)
  245. ipsvd_perhost_init(cmax);
  246. local_port = bb_lookup_port(argv[1], tcp ? "tcp" : "udp", 0);
  247. lsa = xhost2sockaddr(argv[0], local_port);
  248. argv += 2;
  249. sock = xsocket(lsa->u.sa.sa_family, tcp ? SOCK_STREAM : SOCK_DGRAM, 0);
  250. setsockopt_reuseaddr(sock);
  251. sa_len = lsa->len; /* I presume sockaddr len stays the same */
  252. xbind(sock, &lsa->u.sa, sa_len);
  253. if (tcp)
  254. xlisten(sock, backlog);
  255. else /* udp: needed for recv_from_to to work: */
  256. socket_want_pktinfo(sock);
  257. /* ndelay_off(sock); - it is the default I think? */
  258. #ifndef SSLSVD
  259. if (option_mask32 & OPT_u) {
  260. /* drop permissions */
  261. xsetgid(ugid.gid);
  262. xsetuid(ugid.uid);
  263. }
  264. #endif
  265. if (verbose) {
  266. char *addr = xmalloc_sockaddr2dotted(&lsa->u.sa);
  267. bb_error_msg("listening on %s, starting", addr);
  268. free(addr);
  269. #ifndef SSLSVD
  270. if (option_mask32 & OPT_u)
  271. printf(", uid %u, gid %u",
  272. (unsigned)ugid.uid, (unsigned)ugid.gid);
  273. #endif
  274. }
  275. /* Main accept() loop */
  276. again:
  277. hccp = NULL;
  278. while (cnum >= cmax)
  279. wait_for_any_sig(); /* expecting SIGCHLD */
  280. /* Accept a connection to fd #0 */
  281. again1:
  282. close(0);
  283. again2:
  284. sig_unblock(SIGCHLD);
  285. local.len = remote.len = sa_len;
  286. if (tcp) {
  287. conn = accept(sock, &remote.u.sa, &remote.len);
  288. } else {
  289. /* In case recv_from_to won't be able to recover local addr.
  290. * Also sets port - recv_from_to is unable to do it. */
  291. local = *lsa;
  292. conn = recv_from_to(sock, NULL, 0, MSG_DONTWAIT | MSG_PEEK,
  293. &remote.u.sa, &local.u.sa, sa_len);
  294. }
  295. sig_block(SIGCHLD);
  296. if (conn < 0) {
  297. if (errno != EINTR)
  298. bb_perror_msg(tcp ? "accept" : "recv");
  299. goto again2;
  300. }
  301. xmove_fd(tcp ? conn : sock, 0);
  302. if (max_per_host) {
  303. /* Drop connection immediately if cur_per_host > max_per_host
  304. * (minimizing load under SYN flood) */
  305. remote_addr = xmalloc_sockaddr2dotted_noport(&remote.u.sa);
  306. cur_per_host = ipsvd_perhost_add(remote_addr, max_per_host, &hccp);
  307. if (cur_per_host > max_per_host) {
  308. /* ipsvd_perhost_add detected that max is exceeded
  309. * (and did not store ip in connection table) */
  310. free(remote_addr);
  311. if (msg_per_host) {
  312. /* don't block or test for errors */
  313. send(0, msg_per_host, len_per_host, MSG_DONTWAIT);
  314. }
  315. goto again1;
  316. }
  317. /* NB: remote_addr is not leaked, it is stored in conn table */
  318. }
  319. if (!tcp) {
  320. /* Voodoo magic: making udp sockets each receive its own
  321. * packets is not trivial, and I still not sure
  322. * I do it 100% right.
  323. * 1) we have to do it before fork()
  324. * 2) order is important - is it right now? */
  325. /* Open new non-connected UDP socket for further clients... */
  326. sock = xsocket(lsa->u.sa.sa_family, SOCK_DGRAM, 0);
  327. setsockopt_reuseaddr(sock);
  328. /* Make plain write/send work for old socket by supplying default
  329. * destination address. This also restricts incoming packets
  330. * to ones coming from this remote IP. */
  331. xconnect(0, &remote.u.sa, sa_len);
  332. /* hole? at this point we have no wildcard udp socket...
  333. * can this cause clients to get "port unreachable" icmp?
  334. * Yup, time window is very small, but it exists (is it?) */
  335. /* ..."open new socket", continued */
  336. xbind(sock, &lsa->u.sa, sa_len);
  337. socket_want_pktinfo(sock);
  338. /* Doesn't work:
  339. * we cannot replace fd #0 - we will lose pending packet
  340. * which is already buffered for us! And we cannot use fd #1
  341. * instead - it will "intercept" all following packets, but child
  342. * does not expect data coming *from fd #1*! */
  343. #if 0
  344. /* Make it so that local addr is fixed to localp->u.sa
  345. * and we don't accidentally accept packets to other local IPs. */
  346. /* NB: we possibly bind to the _very_ same_ address & port as the one
  347. * already bound in parent! This seems to work in Linux.
  348. * (otherwise we can move socket to fd #0 only if bind succeeds) */
  349. close(0);
  350. set_nport(localp, htons(local_port));
  351. xmove_fd(xsocket(localp->u.sa.sa_family, SOCK_DGRAM, 0), 0);
  352. setsockopt_reuseaddr(0); /* crucial */
  353. xbind(0, &localp->u.sa, localp->len);
  354. #endif
  355. }
  356. pid = vfork();
  357. if (pid == -1) {
  358. bb_perror_msg("vfork");
  359. goto again;
  360. }
  361. if (pid != 0) {
  362. /* Parent */
  363. cnum++;
  364. if (verbose)
  365. connection_status();
  366. if (hccp)
  367. hccp->pid = pid;
  368. /* clean up changes done by vforked child */
  369. undo_xsetenv();
  370. goto again;
  371. }
  372. /* Child: prepare env, log, and exec prog */
  373. /* Closing tcp listening socket */
  374. if (tcp)
  375. close(sock);
  376. { /* vfork alert! every xmalloc in this block should be freed! */
  377. char *local_hostname = local_hostname; /* for compiler */
  378. char *local_addr = NULL;
  379. char *free_me0 = NULL;
  380. char *free_me1 = NULL;
  381. char *free_me2 = NULL;
  382. if (verbose || !(option_mask32 & OPT_E)) {
  383. if (!max_per_host) /* remote_addr is not yet known */
  384. free_me0 = remote_addr = xmalloc_sockaddr2dotted(&remote.u.sa);
  385. if (option_mask32 & OPT_h) {
  386. free_me1 = remote_hostname = xmalloc_sockaddr2host_noport(&remote.u.sa);
  387. if (!remote_hostname) {
  388. bb_error_msg("cannot look up hostname for %s", remote_addr);
  389. remote_hostname = remote_addr;
  390. }
  391. }
  392. /* Find out local IP peer connected to.
  393. * Errors ignored (I'm not paranoid enough to imagine kernel
  394. * which doesn't know local IP). */
  395. if (tcp)
  396. getsockname(0, &local.u.sa, &local.len);
  397. /* else: for UDP it is done earlier by parent */
  398. local_addr = xmalloc_sockaddr2dotted(&local.u.sa);
  399. if (option_mask32 & OPT_h) {
  400. local_hostname = preset_local_hostname;
  401. if (!local_hostname) {
  402. free_me2 = local_hostname = xmalloc_sockaddr2host_noport(&local.u.sa);
  403. if (!local_hostname)
  404. bb_error_msg_and_die("cannot look up hostname for %s", local_addr);
  405. }
  406. /* else: local_hostname is not NULL, but is NOT malloced! */
  407. }
  408. }
  409. if (verbose) {
  410. pid = getpid();
  411. if (max_per_host) {
  412. bb_error_msg("concurrency %s %u/%u",
  413. remote_addr,
  414. cur_per_host, max_per_host);
  415. }
  416. bb_error_msg((option_mask32 & OPT_h)
  417. ? "start %u %s-%s (%s-%s)"
  418. : "start %u %s-%s",
  419. pid,
  420. local_addr, remote_addr,
  421. local_hostname, remote_hostname);
  422. }
  423. if (!(option_mask32 & OPT_E)) {
  424. /* setup ucspi env */
  425. const char *proto = tcp ? "TCP" : "UDP";
  426. /* Extract "original" destination addr:port
  427. * from Linux firewall. Useful when you redirect
  428. * an outbond connection to local handler, and it needs
  429. * to know where it originally tried to connect */
  430. if (tcp && getsockopt(0, SOL_IP, SO_ORIGINAL_DST, &local.u.sa, &local.len) == 0) {
  431. char *addr = xmalloc_sockaddr2dotted(&local.u.sa);
  432. xsetenv_plain("TCPORIGDSTADDR", addr);
  433. free(addr);
  434. }
  435. xsetenv_plain("PROTO", proto);
  436. xsetenv_proto(proto, "LOCALADDR", local_addr);
  437. xsetenv_proto(proto, "REMOTEADDR", remote_addr);
  438. if (option_mask32 & OPT_h) {
  439. xsetenv_proto(proto, "LOCALHOST", local_hostname);
  440. xsetenv_proto(proto, "REMOTEHOST", remote_hostname);
  441. }
  442. //compat? xsetenv_proto(proto, "REMOTEINFO", "");
  443. /* additional */
  444. if (cur_per_host > 0) /* can not be true for udp */
  445. xsetenv_plain("TCPCONCURRENCY", utoa(cur_per_host));
  446. }
  447. free(local_addr);
  448. free(free_me0);
  449. free(free_me1);
  450. free(free_me2);
  451. }
  452. xdup2(0, 1);
  453. signal(SIGTERM, SIG_DFL);
  454. signal(SIGPIPE, SIG_DFL);
  455. signal(SIGCHLD, SIG_DFL);
  456. sig_unblock(SIGCHLD);
  457. #ifdef SSLSVD
  458. strcpy(id, utoa(pid));
  459. ssl_io(0, argv);
  460. #else
  461. BB_EXECVP(argv[0], argv);
  462. #endif
  463. bb_perror_msg_and_die("exec '%s'", argv[0]);
  464. }
  465. /*
  466. tcpsvd [-hpEvv] [-c n] [-C n:msg] [-b n] [-u user] [-l name]
  467. [-i dir|-x cdb] [ -t sec] host port prog
  468. tcpsvd creates a TCP/IP socket, binds it to the address host:port,
  469. and listens on the socket for incoming connections.
  470. On each incoming connection, tcpsvd conditionally runs a program,
  471. with standard input reading from the socket, and standard output
  472. writing to the socket, to handle this connection. tcpsvd keeps
  473. listening on the socket for new connections, and can handle
  474. multiple connections simultaneously.
  475. tcpsvd optionally checks for special instructions depending
  476. on the IP address or hostname of the client that initiated
  477. the connection, see ipsvd-instruct(5).
  478. host
  479. host either is a hostname, or a dotted-decimal IP address,
  480. or 0. If host is 0, tcpsvd accepts connections to any local
  481. IP address.
  482. * busybox accepts IPv6 addresses and host:port pairs too
  483. In this case second parameter is ignored
  484. port
  485. tcpsvd accepts connections to host:port. port may be a name
  486. from /etc/services or a number.
  487. prog
  488. prog consists of one or more arguments. For each connection,
  489. tcpsvd normally runs prog, with file descriptor 0 reading from
  490. the network, and file descriptor 1 writing to the network.
  491. By default it also sets up TCP-related environment variables,
  492. see tcp-environ(5)
  493. -i dir
  494. read instructions for handling new connections from the instructions
  495. directory dir. See ipsvd-instruct(5) for details.
  496. * ignored by busyboxed version
  497. -x cdb
  498. read instructions for handling new connections from the constant database
  499. cdb. The constant database normally is created from an instructions
  500. directory by running ipsvd-cdb(8).
  501. * ignored by busyboxed version
  502. -t sec
  503. timeout. This option only takes effect if the -i option is given.
  504. While checking the instructions directory, check the time of last access
  505. of the file that matches the clients address or hostname if any, discard
  506. and remove the file if it wasn't accessed within the last sec seconds;
  507. tcpsvd does not discard or remove a file if the user's write permission
  508. is not set, for those files the timeout is disabled. Default is 0,
  509. which means that the timeout is disabled.
  510. * ignored by busyboxed version
  511. -l name
  512. local hostname. Do not look up the local hostname in DNS, but use name
  513. as hostname. This option must be set if tcpsvd listens on port 53
  514. to avoid loops.
  515. -u user[:group]
  516. drop permissions. Switch user ID to user's UID, and group ID to user's
  517. primary GID after creating and binding to the socket. If user is followed
  518. by a colon and a group name, the group ID is switched to the GID of group
  519. instead. All supplementary groups are removed.
  520. -c n
  521. concurrency. Handle up to n connections simultaneously. Default is 30.
  522. If there are n connections active, tcpsvd defers acceptance of a new
  523. connection until an active connection is closed.
  524. -C n[:msg]
  525. per host concurrency. Allow only up to n connections from the same IP
  526. address simultaneously. If there are n active connections from one IP
  527. address, new incoming connections from this IP address are closed
  528. immediately. If n is followed by :msg, the message msg is written
  529. to the client if possible, before closing the connection. By default
  530. msg is empty. See ipsvd-instruct(5) for supported escape sequences in msg.
  531. For each accepted connection, the current per host concurrency is
  532. available through the environment variable TCPCONCURRENCY. n and msg
  533. can be overwritten by ipsvd(7) instructions, see ipsvd-instruct(5).
  534. By default tcpsvd doesn't keep track of connections.
  535. -h
  536. Look up the client's hostname in DNS.
  537. -p
  538. paranoid. After looking up the client's hostname in DNS, look up the IP
  539. addresses in DNS for that hostname, and forget about the hostname
  540. if none of the addresses match the client's IP address. You should
  541. set this option if you use hostname based instructions. The -p option
  542. implies the -h option.
  543. * ignored by busyboxed version
  544. -b n
  545. backlog. Allow a backlog of approximately n TCP SYNs. On some systems n
  546. is silently limited. Default is 20.
  547. -E
  548. no special environment. Do not set up TCP-related environment variables.
  549. -v
  550. verbose. Print verbose messsages to standard output.
  551. -vv
  552. more verbose. Print more verbose messages to standard output.
  553. * no difference between -v and -vv in busyboxed version
  554. */