3
0

tcpudp.c 18 KB

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