diff --git a/CHANGES b/CHANGES index 2f66737..f3c0d4e 100644 --- a/CHANGES +++ b/CHANGES @@ -29,6 +29,8 @@ Features: socat-mux.sh and socat-broker.sh, when run as root, now internally use low (512..1023) UDP ports to increase security. + Added option ai-all (sets AI_ALL flag of getaddrinfo() resolver) + Porting: Changes for building and testing on NetBSD diff --git a/doc/socat.yo b/doc/socat.yo index bf60b42..c71088b 100644 --- a/doc/socat.yo +++ b/doc/socat.yo @@ -2566,8 +2566,11 @@ label(OPTION_AI_V4MAPPED) dit(bf(tt(ai-v4mapped[=0|1]))) dit(bf(tt(v4mapped[=0|1]))) Sets or unsets the AI_V4MAPPED flag for code(getaddrinfo()). With socat() addresses requiring IPv6 addresses, this resolves IPv4 addresses to the - approriate IPv6 address [::ffff:*:*]. For IPv6 Socat addresses, the default - is 1. + appropriate IPv6 address [::ffff:*:*]. For IPv6 socat() addresses, the + default is 1. +label(OPTION_AI_ALL) +dit(bf(tt(ai-all[=0|1]))) + Sets or unsets the AI_ALL flag for code(getaddrinfo()). label(OPTION_RES_DEBUG)dit(bf(tt(res-debug))) label(OPTION_RES_AAONLY)dit(bf(tt(res-aaonly))) diff --git a/xio-ip.c b/xio-ip.c index 283b15d..dfccbbd 100644 --- a/xio-ip.c +++ b/xio-ip.c @@ -84,6 +84,9 @@ const struct optdesc opt_ip_recvif = { "ip-recvif", "recvdstaddrif",OPT_IP_RECVI #ifdef AI_ADDRCONFIG const struct optdesc opt_ai_addrconfig = { "ai-addrconfig", "addrconfig", OPT_AI_ADDRCONFIG, 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_ADDRCONFIG }; #endif +#ifdef AI_ALL +const struct optdesc opt_ai_all = { "ai-all", NULL, OPT_AI_ALL, 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_ALL }; +#endif #ifdef AI_V4MAPPED const struct optdesc opt_ai_v4mapped = { "ai-v4mapped", "v4mapped", OPT_AI_V4MAPPED, 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_V4MAPPED }; #endif diff --git a/xio-ip.h b/xio-ip.h index aa2112d..80b10bd 100644 --- a/xio-ip.h +++ b/xio-ip.h @@ -30,6 +30,7 @@ extern const struct optdesc opt_ip_recvif; extern const struct optdesc opt_ip_transparent; extern const struct optdesc opt_ai_addrconfig; +extern const struct optdesc opt_ai_all; extern const struct optdesc opt_ai_passive; extern const struct optdesc opt_ai_v4mapped; diff --git a/xioopts.c b/xioopts.c index e957ba3..c87e89d 100644 --- a/xioopts.c +++ b/xioopts.c @@ -199,6 +199,9 @@ const struct optname optionnames[] = { #if defined(AI_ADDRCONFIG) IF_IP ("ai-addrconfig", &opt_ai_addrconfig) #endif +#if defined(AI_ALL) + IF_IP ("ai-all", &opt_ai_all) +#endif #if defined(AI_PASSIVE ) IF_IP ("ai-passive", &opt_ai_passive) #endif diff --git a/xioopts.h b/xioopts.h index 4fd2287..06fc250 100644 --- a/xioopts.h +++ b/xioopts.h @@ -216,6 +216,7 @@ enum e_func { enum e_optcode { OPT_ADDRESS_FAMILY = 1, OPT_AI_ADDRCONFIG, /* getaddrinfo() */ + OPT_AI_ALL, /* getaddrinfo() */ OPT_AI_PASSIVE, /* getaddrinfo() */ OPT_AI_V4MAPPED, /* getaddrinfo() */ /* these are not alphabetically, I know... */