From 282db9feda02f3f2915fe78faa2914eab1ab68b2 Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Mon, 6 Nov 2023 06:19:18 +0100 Subject: [PATCH] Added options res-retrans, res-retry --- CHANGES | 5 +++++ config.h.in | 4 ++++ configure.ac | 22 ++++++++++++++++++++ doc/socat.yo | 15 ++++++++++---- xio-ip.c | 46 +++++++++++++++++++++++++++--------------- xio-ip.h | 8 +++++--- xio-ip6.c | 2 +- xio.h | 20 +++++++++++++++--- xioopen.c | 23 +++++++++++++-------- xioopts.c | 57 +++++++++++++++++++++++++++++++++++----------------- xioopts.h | 2 ++ 11 files changed, 151 insertions(+), 53 deletions(-) diff --git a/CHANGES b/CHANGES index aeda542..287ec70 100644 --- a/CHANGES +++ b/CHANGES @@ -135,6 +135,11 @@ Features: New address SHELL invokes a shell but without the overhead of SYSTEM + Added options res-retrans and res-retry that make use of undocumented + resolver variables to set the retransmission time interval resp.the + number of times to retransmit. + Disable them and the old res-* opts with: ./configure --disable-resolve + Corrections: When a sub process (EXEC, SYSTEM) terminated with exit code other than 0, its last sent data might have been lost depending on timing of read/ diff --git a/config.h.in b/config.h.in index 15833ed..6a36b51 100644 --- a/config.h.in +++ b/config.h.in @@ -678,6 +678,9 @@ #undef HAVE_PROC_DIR_FD #undef HAVE_PROC_DIR_PATH +#undef HAVE_RES_RETRANS +#undef HAVE_RES_RETRY + #undef HAVE_SETGRENT #undef HAVE_GETGRENT #undef HAVE_ENDGRENT @@ -720,6 +723,7 @@ #undef WITH_FS #undef WITH_OPENSSL #undef WITH_OPENSSL_METHOD +#undef WITH_RESOLVE #undef WITH_RES_DEPRECATED /* AAONLY,PRIMARY */ #define WITH_STREAMS 1 #undef WITH_FIPS diff --git a/configure.ac b/configure.ac index 338f427..e2edebc 100644 --- a/configure.ac +++ b/configure.ac @@ -709,6 +709,14 @@ AC_ARG_ENABLE(openssl-method, [ --enable-openssl-method enable OpenSSL me [AC_MSG_RESULT(no)]) fi +AC_MSG_CHECKING(whether to include undocumented resolver related options) +AC_ARG_ENABLE(resolve, [ --enable-resolve enable undocumented resolver options], + [case "$enableval" in + no) AC_MSG_RESULT(no);; + *) AC_DEFINE(WITH_RESOLVE) AC_MSG_RESULT(yes);; + esac], + [AC_DEFINE(WITH_RESOLVE) AC_MSG_RESULT(yes)]) + AC_MSG_CHECKING(whether to include deprecated resolver option) AC_ARG_ENABLE(res-deprecated, [ --enable-res-deprecated enable deprecated resolver options], [case "$enableval" in @@ -2135,6 +2143,20 @@ else AC_MSG_RESULT(no) fi +# Some OSes have undocumented _res.retrans, _res.retry components +AC_MSG_CHECKING(for _res.retrans) +AC_TRY_COMPILE([#include ], +[_res.retrans == 0], +[AC_MSG_RESULT(yes); + AC_DEFINE(HAVE_RES_RETRANS, 1)], + [AC_MSG_RESULT(no)]) +AC_MSG_CHECKING(for _res.retry) +AC_TRY_COMPILE([#include ], +[_res.retry == 0], +[AC_MSG_RESULT(yes); + AC_DEFINE(HAVE_RES_RETRY, 1)], + [AC_MSG_RESULT(no)]) + dnl "tcpd" "tcpwrappers" # on some platforms, raw linking with libwrap fails because allow_severity and diff --git a/doc/socat.yo b/doc/socat.yo index fe7bffd..dcd3d13 100644 --- a/doc/socat.yo +++ b/doc/socat.yo @@ -2423,13 +2423,20 @@ label(OPTION_RES_RECURSE)dit(bf(tt(res-recurse))) label(OPTION_RES_DEFNAMES)dit(bf(tt(res-defnames))) label(OPTION_RES_STAYOPEN)dit(bf(tt(res-stayopen))) label(OPTION_RES_DNSRCH)dit(bf(tt(res-dnsrch))) - These options temporarily set the corresponding resolver (name resolution) - option flags. Append "=0" to clear a default option. See man - NOEXPAND(resolver(5)) for more information on these options. These flags are - per process, however socat() restores the old values after name resolution. + These options set the corresponding resolver (name resolution) option flags. + Append "=0" to clear a default option. See man NOEXPAND(resolver(5)) for + more information on these options. Socat() restores the old values after + finishing the open phase of the address, so these options are valid just for + the address they are applied to.nl() Please note that these flags only affect DNS resolution, but not hosts or NIS based name resolution, and they have no effect when (g)libc retrieves the results from code(nscd). +label(OPTION_RES_RETRANS)dit(bf(tt(res-retrans=))) + Sets the retransmission time interval of the DNS resolver (based on an + undocumented feature). +label(OPTION_RES_RETRY)dit(bf(tt(res-retry=))) + Sets the number of retransmits of the DNS resolver (based on an undocumented + feature). enddit() startdit()enddit()nl() diff --git a/xio-ip.c b/xio-ip.c index 53ae1af..04e796c 100644 --- a/xio-ip.c +++ b/xio-ip.c @@ -91,26 +91,33 @@ const struct optdesc opt_ai_v4mapped = { "ai-v4mapped", "v4mapped", OPT_AI const struct optdesc opt_ai_passive = { "ai-passive", "passive", OPT_AI_PASSIVE, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.ai_flags), XIO_SIZEOF(para.socket.ip.ai_flags), AI_PASSIVE }; #endif +#if WITH_RESOLVE #if WITH_RES_DEPRECATED # define WITH_RES_AAONLY 1 # define WITH_RES_PRIMARY 1 #endif /* WITH_RES_DEPRECATED */ #if HAVE_RESOLV_H -const struct optdesc opt_res_debug = { "res-debug", NULL, OPT_RES_DEBUG, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res_opts), XIO_SIZEOF(para.socket.ip.res_opts), RES_DEBUG }; +const struct optdesc opt_res_debug = { "res-debug", NULL, OPT_RES_DEBUG, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res.opts), XIO_SIZEOF(para.socket.ip.res.opts), RES_DEBUG }; #if WITH_RES_AAONLY -const struct optdesc opt_res_aaonly = { "res-aaonly", "aaonly", OPT_RES_AAONLY, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res_opts), XIO_SIZEOF(para.socket.ip.res_opts), RES_AAONLY }; +const struct optdesc opt_res_aaonly = { "res-aaonly", "aaonly", OPT_RES_AAONLY, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res.opts), XIO_SIZEOF(para.socket.ip.res.opts), RES_AAONLY }; #endif -const struct optdesc opt_res_usevc = { "res-usevc", "usevc", OPT_RES_USEVC, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res_opts), XIO_SIZEOF(para.socket.ip.res_opts), RES_USEVC }; +const struct optdesc opt_res_usevc = { "res-usevc", "usevc", OPT_RES_USEVC, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res.opts), XIO_SIZEOF(para.socket.ip.res.opts), RES_USEVC }; #if WITH_RES_PRIMARY -const struct optdesc opt_res_primary = { "res-primary", "primary", OPT_RES_PRIMARY, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res_opts), XIO_SIZEOF(para.socket.ip.res_opts), RES_PRIMARY }; +const struct optdesc opt_res_primary = { "res-primary", "primary", OPT_RES_PRIMARY, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res.opts), XIO_SIZEOF(para.socket.ip.res.opts), RES_PRIMARY }; +#endif +const struct optdesc opt_res_igntc = { "res-igntc", "igntc", OPT_RES_IGNTC, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res.opts), XIO_SIZEOF(para.socket.ip.res.opts), RES_IGNTC }; +const struct optdesc opt_res_recurse = { "res-recurse", "recurse", OPT_RES_RECURSE, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res.opts), XIO_SIZEOF(para.socket.ip.res.opts), RES_RECURSE }; +const struct optdesc opt_res_defnames = { "res-defnames", "defnames", OPT_RES_DEFNAMES, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res.opts), XIO_SIZEOF(para.socket.ip.res.opts), RES_DEFNAMES }; +const struct optdesc opt_res_stayopen = { "res-stayopen", "stayopen", OPT_RES_STAYOPEN, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res.opts), XIO_SIZEOF(para.socket.ip.res.opts), RES_STAYOPEN }; +const struct optdesc opt_res_dnsrch = { "res-dnsrch", "dnsrch", OPT_RES_DNSRCH, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res.opts), XIO_SIZEOF(para.socket.ip.res.opts), RES_DNSRCH }; +#if HAVE_RES_RETRANS +const struct optdesc opt_res_retrans = { "res-retrans", "retrans", OPT_RES_RETRANS, GROUP_SOCK_IP, PH_OFFSET, TYPE_INT, OFUNC_OFFSET, XIO_OFFSETOF(para.socket.ip.res.retrans), XIO_SIZEOF(para.socket.ip.res.retrans), RES_MAXRETRANS }; +#endif +#if HAVE_RES_RETRY +const struct optdesc opt_res_retry = { "res-retry", NULL, OPT_RES_RETRY, GROUP_SOCK_IP, PH_OFFSET, TYPE_INT, OFUNC_OFFSET, XIO_OFFSETOF(para.socket.ip.res.retry), XIO_SIZEOF(para.socket.ip.res.retry), RES_MAXRETRY }; #endif -const struct optdesc opt_res_igntc = { "res-igntc", "igntc", OPT_RES_IGNTC, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res_opts), XIO_SIZEOF(para.socket.ip.res_opts), RES_IGNTC }; -const struct optdesc opt_res_recurse = { "res-recurse", "recurse", OPT_RES_RECURSE, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res_opts), XIO_SIZEOF(para.socket.ip.res_opts), RES_RECURSE }; -const struct optdesc opt_res_defnames = { "res-defnames", "defnames", OPT_RES_DEFNAMES, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res_opts), XIO_SIZEOF(para.socket.ip.res_opts), RES_DEFNAMES }; -const struct optdesc opt_res_stayopen = { "res-stayopen", "stayopen", OPT_RES_STAYOPEN, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res_opts), XIO_SIZEOF(para.socket.ip.res_opts), RES_STAYOPEN }; -const struct optdesc opt_res_dnsrch = { "res-dnsrch", "dnsrch", OPT_RES_DNSRCH, GROUP_SOCK_IP, PH_OFFSET, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.res_opts), XIO_SIZEOF(para.socket.ip.res_opts), RES_DNSRCH }; #endif /* HAVE_RESOLV_H */ - +#endif /* WITH_RESOLVE */ #endif /* WITH_IP4 || WITH_IP6 */ @@ -241,8 +248,10 @@ int xiogetaddrinfo(const char *node, const char *service, hints.ai_flags, hints.ai_family, hints.ai_socktype, hints.ai_protocol, gai_strerror(error_num)); - if (res != NULL) freeaddrinfo(*res); - if (numnode) free(numnode); + if (*res != NULL) + freeaddrinfo(*res); + if (numnode) + free(numnode); return STAT_NORETRY; } hints.ai_protocol = 0; @@ -255,8 +264,11 @@ int xiogetaddrinfo(const char *node, const char *service, hints.ai_socktype, hints.ai_protocol, (error_num == EAI_SYSTEM)? strerror(errno):gai_strerror(error_num)); + if (*res != NULL) + freeaddrinfo(*res); if (numnode) free(numnode); + return STAT_RETRYLATER; } } while (1); @@ -988,6 +1000,7 @@ int xioapply_ip_add_source_membership(struct single *sfd, struct opt *opt) { #endif /* HAVE_STRUCT_IP_MREQ_SOURCE */ +#if WITH_RESOLVE #if HAVE_RESOLV_H /* When there are options for resolver then this function saves the current @@ -1001,8 +1014,8 @@ int xio_res_init( struct single *sfd, struct __res_state *save_res) { - if (sfd->para.socket.ip.res_opts[0] || - sfd->para.socket.ip.res_opts[1]) { + if (sfd->para.socket.ip.res.opts[0] || + sfd->para.socket.ip.res.opts[1]) { if (!(_res.options & RES_INIT)) { if (Res_init() < 0) { Error("res_init() failed"); @@ -1010,8 +1023,8 @@ int xio_res_init( } } *save_res = _res; - _res.options |= sfd->para.socket.ip.res_opts[0]; - _res.options &= ~sfd->para.socket.ip.res_opts[1]; + _res.options |= sfd->para.socket.ip.res.opts[0]; + _res.options &= ~sfd->para.socket.ip.res.opts[1]; Debug2("changed _res.options from 0x%lx to 0x%lx", save_res->options, _res.options); return 1; @@ -1026,5 +1039,6 @@ int xio_res_restore( return 0; } #endif /* HAVE_RESOLV_H */ +#endif /* WITH_RESOLVE */ #endif /* _WITH_IP4 || _WITH_IP6 */ diff --git a/xio-ip.h b/xio-ip.h index 037f36f..7c6518b 100644 --- a/xio-ip.h +++ b/xio-ip.h @@ -42,6 +42,8 @@ extern const struct optdesc opt_res_recurse; extern const struct optdesc opt_res_defnames; extern const struct optdesc opt_res_stayopen; extern const struct optdesc opt_res_dnsrch; +extern const struct optdesc opt_res_retrans; +extern const struct optdesc opt_res_retry; extern int xioinit_ip(int *pf, char ipv); @@ -54,9 +56,9 @@ extern int xioapply_ip_add_membership(xiosingle_t *xfd, struct opt *opt); extern int xiotype_ip_add_source_membership(char* token, const struct optname *ent, struct opt *opt); extern int xioapply_ip_add_source_membership(struct single *xfd, struct opt *opt); -#if HAVE_RESOLV_H +#if WITH_RESOLVE && HAVE_RESOLV_H extern int xio_res_init(struct single *sfd, struct __res_state *save_res); -extern int xio_res_restore(struct __res_state *save_red); -#endif /* HAVE_RESOLV_H */ +extern int xio_res_restore(struct __res_state *save_res); +#endif /* WITH_RESOLVE && HAVE_RESOLV_H */ #endif /* !defined(__xio_ip_h_included) */ diff --git a/xio-ip6.c b/xio-ip6.c index 51f7af3..bd94bdd 100644 --- a/xio-ip6.c +++ b/xio-ip6.c @@ -80,7 +80,7 @@ const struct optdesc opt_ipv6_recvpathmtu = { "ipv6-recvpathmtu", "recvpathmtu", #endif /* Returns canonical form of IPv6 address. - IPv6 address may bei enclose in brackets. + IPv6 address may be enclose in brackets. Returns STAT_OK on success, STAT_NORETRY on failure. */ int xioip6_pton( const char *src, diff --git a/xio.h b/xio.h index b72bf2b..5df40f0 100644 --- a/xio.h +++ b/xio.h @@ -133,10 +133,24 @@ extern xioparms_t xioparms; #define MAXARGV 8 #if _WITH_IP4 || _WITH_IP6 +#if WITH_RESOLVE && HAVE_RESOLV_H +struct para_ip_res { + unsigned int opts[2]; /* bits to be set in _res.options are in [0], + bits to be cleared are in [1] */ +#if HAVE_RES_RETRANS + int retrans; +#endif +#if HAVE_RES_RETRY + int retry; +#endif +} ; +#endif /* WITH_RESOLVE && HAVE_RESOLV_H */ + struct para_ip { - int ai_flags[2]; /* flags for getaddrinfo() ai_flags (set/unset) */ - unsigned long res_opts[2]; /* bits to be set in _res.options are - at [0], bits to be cleared are at [1] */ + int ai_flags[2]; /* flags for getaddrinfo() ai_flags (set/unset) */ +#if WITH_RESOLVE && HAVE_RESOLV_H + struct para_ip_res res; +#endif bool dosourceport; /* check the source port of incoming connection or packets */ uint16_t sourceport; /* host byte order */ bool lowport; diff --git a/xioopen.c b/xioopen.c index ca7e4d1..93dba85 100644 --- a/xioopen.c +++ b/xioopen.c @@ -397,7 +397,14 @@ static xiofile_t *xioallocfd(void) { fd->stream.escape = -1; /* fd->stream.para.exec.pid = 0; */ fd->stream.lineterm = LINETERM_RAW; - +#if WITH_RESOLVE +#if HAVE_RES_RETRANS + fd->stream.para.socket.ip.res.retrans = -1; +#endif +#if HAVE_RES_RETRY + fd->stream.para.socket.ip.res.retry = -1; +#endif +#endif /* WITH_RESOLVE */ return fd; } @@ -616,10 +623,10 @@ int xioopen_single(xiofile_t *xfd, int xioflags) { const char *modetext[4] = { "none", "read-only", "write-only", "read-write" } ; int result; /* Values to be saved until xioopen() is finished */ -#if HAVE_RESOLV_H +#if WITH_RESOLVE && HAVE_RESOLV_H int do_res; struct __res_state save_res; -#endif /* HAVE_RESOLV_H */ +#endif /* WITH_RESOLVE && HAVE_RESOLV_H */ #if WITH_NAMESPACES char *temp_netns; int save_netfd = -1; @@ -648,10 +655,10 @@ int xioopen_single(xiofile_t *xfd, int xioflags) { } #endif /* WITH_NAMESPACES */ -#if HAVE_RESOLV_H +#if WITH_RESOLVE && HAVE_RESOLV_H if ((do_res = xio_res_init(sfd, &save_res)) < 0) return STAT_NORETRY; -#endif /* HAVE_RESOLV_H */ +#endif /* WITH_RESOLVE && HAVE_RESOLV_H */ addrdesc = xfd->stream.addr; /* Check if address supports required data directions */ @@ -673,10 +680,10 @@ int xioopen_single(xiofile_t *xfd, int xioflags) { xfd->stream.opts, xioflags, xfd, addrdesc); -#if HAVE_RESOLV_H +#if WITH_RESOLVE && HAVE_RESOLV_H if (do_res) - xio_res_init(sfd, &save_res); -#endif /* HAVE_RESOLV_H */ + xio_res_restore(&save_res); +#endif /* WITH_RESOLVE && HAVE_RESOLV_H */ #if WITH_NAMESPACES if (save_netfd >= 0) { diff --git a/xioopts.c b/xioopts.c index ef8db90..d16748b 100644 --- a/xioopts.c +++ b/xioopts.c @@ -126,6 +126,12 @@ bool xioopts_ignoregroups; # define IF_OPENSSL(a,b) #endif +#if WITH_RESOLVE +# define IF_RESOLVE(a,b) {a,b}, +#else +# define IF_RESOLVE(a,b) +#endif + #if WITH_INTERFACE # define IF_INTERFACE(a,b) {a,b}, #else @@ -160,7 +166,7 @@ static int applyopt(struct single *sfd, int fd, struct opt *opt); /* NULL terminated */ const struct optname optionnames[] = { #if HAVE_RESOLV_H && WITH_RES_AAONLY - IF_IP ("aaonly", &opt_res_aaonly) + IF_RESOLVE("aaonly", &opt_res_aaonly) #endif #ifdef TCP_ABORT_THRESHOLD /* HP_UX */ IF_TCP ("abort-threshold", &opt_tcp_abort_threshold) @@ -384,7 +390,7 @@ const struct optname optionnames[] = { IF_TERMIOS("ctty", &opt_tiocsctty) IF_EXEC ("dash", &opt_dash) IF_SOCKET ("debug", &opt_so_debug) - /*IF_IP ("debug", &opt_res_debug)*/ + /*IF_RESOLVE("debug", &opt_res_debug)*/ #ifdef O_DEFER IF_OPEN ("defer", &opt_o_defer) #endif @@ -392,7 +398,7 @@ const struct optname optionnames[] = { IF_TCP ("defer-accept", &opt_tcp_defer_accept) #endif #if HAVE_RESOLV_H - IF_IP ("defnames", &opt_res_defnames) + IF_RESOLVE("defnames", &opt_res_defnames) #endif /* HAVE_RESOLV_H */ #ifdef O_DELAY IF_OPEN ("delay", &opt_o_delay) @@ -425,7 +431,7 @@ const struct optname optionnames[] = { IF_TERMIOS("discard", &opt_vdiscard) #endif #if HAVE_RESOLV_H - IF_IP ("dnsrch", &opt_res_dnsrch) + IF_RESOLVE("dnsrch", &opt_res_dnsrch) #endif /* HAVE_RESOLV_H */ #ifdef SO_DONTLINGER IF_SOCKET ("dontlinger", &opt_so_dontlinger) @@ -686,7 +692,7 @@ const struct optname optionnames[] = { IF_ANY ("ignoreof", &opt_ignoreeof) IF_TERMIOS("ignpar", &opt_ignpar) #if HAVE_RESOLV_H - IF_IP ("igntc", &opt_res_igntc) + IF_RESOLVE("igntc", &opt_res_igntc) #endif /* HAVE_RESOLV_H */ IF_TERMIOS("imaxbel", &opt_imaxbel) #if WITH_FS && defined(FS_IMMUTABLE_FL) @@ -1306,7 +1312,7 @@ const struct optname optionnames[] = { IF_ANY ("posixmq-priority", &opt_posixmq_priority) #endif #if HAVE_RESOLV_H && WITH_RES_PRIMARY - IF_IP ("primary", &opt_res_primary) + IF_RESOLVE("primary", &opt_res_primary) #endif #ifdef SO_PRIORITY IF_SOCKET ("priority", &opt_so_priority) @@ -1367,7 +1373,7 @@ const struct optname optionnames[] = { IF_OPEN ("rdwr", &opt_o_rdwr) IF_ANY ("readbytes", &opt_readbytes) #if HAVE_RESOLV_H - IF_IP ("recurse", &opt_res_recurse) + IF_RESOLVE("recurse", &opt_res_recurse) #endif /* HAVE_RESOLV_H */ #ifdef IP_RECVDSTADDR IF_IP ("recvdstaddr", &opt_ip_recvdstaddr) @@ -1408,24 +1414,39 @@ const struct optname optionnames[] = { #endif #if HAVE_RESOLV_H # if WITH_AA_ONLY - IF_IP ("res-aaonly", &opt_res_aaonly) + IF_RESOLVE("res-aaonly", &opt_res_aaonly) +# endif + IF_RESOLVE("res-debug", &opt_res_debug) + IF_RESOLVE("res-defnames", &opt_res_defnames) + IF_RESOLVE("res-dnsrch", &opt_res_dnsrch) + IF_RESOLVE("res-igntc", &opt_res_igntc) +# if HAVE_RES_RETRANS + IF_RESOLVE("res-maxretrans", &opt_res_retrans) +# endif +# if HAVE_RES_RETRY + IF_RESOLVE("res-maxretry", &opt_res_retry) # endif - IF_IP ("res-debug", &opt_res_debug) - IF_IP ("res-defnames", &opt_res_defnames) - IF_IP ("res-dnsrch", &opt_res_dnsrch) - IF_IP ("res-igntc", &opt_res_igntc) # if WITH_RES_PRIMARY - IF_IP ("res-primary", &opt_res_primary) + IF_RESOLVE("res-primary", &opt_res_primary) # endif - IF_IP ("res-recurse", &opt_res_recurse) - IF_IP ("res-stayopen", &opt_res_stayopen) - IF_IP ("res-usevc", &opt_res_usevc) + IF_RESOLVE("res-recurse", &opt_res_recurse) +# if HAVE_RES_RETRANS + IF_RESOLVE("res-retrans", &opt_res_retrans) +# endif +# if HAVE_RES_RETRY + IF_RESOLVE("res-retry", &opt_res_retry) +# endif + IF_RESOLVE("res-stayopen", &opt_res_stayopen) + IF_RESOLVE("res-usevc", &opt_res_usevc) #endif /* HAVE_RESOLV_H */ IF_PROXY ("resolv", &opt_proxy_resolve) IF_PROXY ("resolve", &opt_proxy_resolve) #ifdef IP_RETOPTS IF_IP ("retopts", &opt_ip_retopts) #endif +# if HAVE_RES_RETRANS + IF_RESOLVE("retrans", &opt_res_retrans) +# endif #if WITH_INTERFACE && defined(PACKET_AUXDATA) IF_SOCKET ("retrieve-vlan", &opt_retrieve_vlan) #endif @@ -1662,7 +1683,7 @@ const struct optname optionnames[] = { IF_IPAPP ("sp", &opt_sourceport) IF_TERMIOS("start", &opt_vstart) #if HAVE_RESOLV_H - IF_IP ("stayopen", &opt_res_stayopen) + IF_RESOLVE("stayopen", &opt_res_stayopen) #endif /* HAVE_RESOLV_H */ IF_EXEC ("stderr", &opt_stderr) #ifdef TCP_STDURG @@ -1865,7 +1886,7 @@ const struct optname optionnames[] = { IF_NAMED ("user-early", &opt_user_early) IF_ANY ("user-late", &opt_user_late) #if HAVE_RESOLV_H - IF_IP ("usevc", &opt_res_usevc) + IF_RESOLVE("usevc", &opt_res_usevc) #endif /* HAVE_RESOLV_H */ #if defined(AI_V4MAPPED) IF_IP ("v4mapped", &opt_ai_v4mapped) diff --git a/xioopts.h b/xioopts.h index 496b088..66cb5dc 100644 --- a/xioopts.h +++ b/xioopts.h @@ -630,6 +630,8 @@ enum e_optcode { OPT_RES_IGNTC, /* resolver(3) */ OPT_RES_PRIMARY, /* resolver(3) */ OPT_RES_RECURSE, /* resolver(3) */ + OPT_RES_RETRANS, /* undocumented */ + OPT_RES_RETRY, /* undocumented */ OPT_RES_STAYOPEN, /* resolver(3) */ OPT_RES_USEVC, /* resolver(3) */ OPT_RETRIEVE_VLAN, /* Linux: get VLAN info on raw sockets per auxdata */