mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 23:42:34 +00:00
New option ai-v4mapped
This commit is contained in:
parent
277f0d755d
commit
b14e65c42a
11 changed files with 27 additions and 18 deletions
4
CHANGES
4
CHANGES
|
@ -100,6 +100,10 @@ Features:
|
||||||
confirm option ipv6-v6only).
|
confirm option ipv6-v6only).
|
||||||
Added option ai-passive to control this flag explicitely.
|
Added option ai-passive to control this flag explicitely.
|
||||||
|
|
||||||
|
New option ai-v4mapped (v4mapped) sets or unsets the AI_V4MAPPED flag
|
||||||
|
of the resolver. For Socat addresses requiring IPv6 addresses, this
|
||||||
|
resolves IPv4 addresses to the approriate IPv6 address [::ffff:*:*].
|
||||||
|
|
||||||
Corrections:
|
Corrections:
|
||||||
When a sub process (EXEC, SYSTEM) terminated with exit code other than
|
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/
|
0, its last sent data might have been lost depending on timing of read/
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
"1.7.4.5+conn-over"
|
"1.7.4.5+"
|
||||||
|
|
16
doc/socat.yo
16
doc/socat.yo
|
@ -2243,12 +2243,20 @@ dit(bf(tt(ip-transparent)))
|
||||||
label(OPTION_AI_ADDRCONFIG)
|
label(OPTION_AI_ADDRCONFIG)
|
||||||
dit(bf(tt(ai-addrconfig[=0|1]))), dit(bf(tt(addrconfig[=0|1])))
|
dit(bf(tt(ai-addrconfig[=0|1]))), dit(bf(tt(addrconfig[=0|1])))
|
||||||
Sets or unsets the AI_ADDRCONFIG flag to prevent name resolution to address
|
Sets or unsets the AI_ADDRCONFIG flag to prevent name resolution to address
|
||||||
families that are not configured (e.g. IPv6). Default value is 1 in case the
|
families that are not available on the computer (e.g. IPv6). Default value
|
||||||
resolver does not get an address family hint from Socat address or defaults.
|
is 1 in case the resolver does not get an address family hint from Socat
|
||||||
|
address or defaults.
|
||||||
|
label(OPTION_AI_PASSIVE)
|
||||||
dit(bf(tt(ai-passive[=0|1]))), dit(bf(tt(passive[=0|1])))
|
dit(bf(tt(ai-passive[=0|1]))), dit(bf(tt(passive[=0|1])))
|
||||||
Sets of unsets the AI_ADDRCONFIG flag for code(getaddrinfo)) calls. Default
|
Sets of unsets the AI_ADDRCONFIG flag for code(getaddrinfo()) calls.
|
||||||
is 1 for LISTEN, RECV, and RECVFROM type addresses, and with
|
Default is 1 for LISTEN, RECV, and RECVFROM type addresses, and with
|
||||||
link(bind)(OPTION_BIND) option.
|
link(bind)(OPTION_BIND) option.
|
||||||
|
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.
|
||||||
label(OPTION_RES_DEBUG)dit(bf(tt(res-debug)))
|
label(OPTION_RES_DEBUG)dit(bf(tt(res-debug)))
|
||||||
label(OPTION_RES_AAONLY)dit(bf(tt(res-aaonly)))
|
label(OPTION_RES_AAONLY)dit(bf(tt(res-aaonly)))
|
||||||
label(OPTION_RES_USEVC)dit(bf(tt(res-usevc)))
|
label(OPTION_RES_USEVC)dit(bf(tt(res-usevc)))
|
||||||
|
|
3
xio-ip.c
3
xio-ip.c
|
@ -83,6 +83,7 @@ const struct optdesc opt_ip_recvif = { "ip-recvif", "recvdstaddrif",OPT_IP_RECVI
|
||||||
|
|
||||||
#ifdef AI_ADDRCONFIG
|
#ifdef AI_ADDRCONFIG
|
||||||
const struct optdesc opt_ai_addrconfig = { "ai-addrconfig", "addrconfig", OPT_AI_ADDRCONFIG, GROUP_SOCK_IP, PH_INIT, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.ai_flags), XIO_SIZEOF(para.socket.ip.ai_flags), AI_ADDRCONFIG };
|
const struct optdesc opt_ai_addrconfig = { "ai-addrconfig", "addrconfig", OPT_AI_ADDRCONFIG, GROUP_SOCK_IP, PH_INIT, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.ai_flags), XIO_SIZEOF(para.socket.ip.ai_flags), AI_ADDRCONFIG };
|
||||||
|
const struct optdesc opt_ai_v4mapped = { "ai-v4mapped", "v4mapped", OPT_AI_V4MAPPED, GROUP_SOCK_IP, PH_INIT, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.ai_flags), XIO_SIZEOF(para.socket.ip.ai_flags), AI_V4MAPPED };
|
||||||
#endif
|
#endif
|
||||||
#ifdef AI_PASSIVE
|
#ifdef AI_PASSIVE
|
||||||
const struct optdesc opt_ai_passive = { "ai-passive", "passive", OPT_AI_PASSIVE, GROUP_SOCK_IP, PH_INIT, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.ai_flags), XIO_SIZEOF(para.socket.ip.ai_flags), AI_PASSIVE };
|
const struct optdesc opt_ai_passive = { "ai-passive", "passive", OPT_AI_PASSIVE, GROUP_SOCK_IP, PH_INIT, TYPE_BOOL, OFUNC_OFFSET_MASKS, XIO_OFFSETOF(para.socket.ip.ai_flags), XIO_SIZEOF(para.socket.ip.ai_flags), AI_PASSIVE };
|
||||||
|
@ -227,7 +228,6 @@ int xiogetaddrinfo(const char *node, const char *service,
|
||||||
}
|
}
|
||||||
if (family == 0)
|
if (family == 0)
|
||||||
hints.ai_flags |= AI_ADDRCONFIG;
|
hints.ai_flags |= AI_ADDRCONFIG;
|
||||||
hints.ai_flags |= AI_PASSIVE /* important for IPv4+IPv6 listen */;
|
|
||||||
#if HAVE_GETADDRINFO
|
#if HAVE_GETADDRINFO
|
||||||
if (node != NULL || service != NULL) {
|
if (node != NULL || service != NULL) {
|
||||||
struct addrinfo *record;
|
struct addrinfo *record;
|
||||||
|
@ -461,7 +461,6 @@ int xioresolve(const char *node, const char *service,
|
||||||
if (ai_flags[0] & AI_PASSIVE && family == PF_UNSPEC) {
|
if (ai_flags[0] & AI_PASSIVE && family == PF_UNSPEC) {
|
||||||
/* We select the first IPv6 address, if available,
|
/* We select the first IPv6 address, if available,
|
||||||
because this might accept IPv4 connections too */
|
because this might accept IPv4 connections too */
|
||||||
struct addrinfo *aip = res;
|
|
||||||
while (aip != NULL) {
|
while (aip != NULL) {
|
||||||
if (aip->ai_family == PF_INET6)
|
if (aip->ai_family == PF_INET6)
|
||||||
break;
|
break;
|
||||||
|
|
1
xio-ip.h
1
xio-ip.h
|
@ -31,6 +31,7 @@ extern const struct optdesc opt_ip_transparent;
|
||||||
|
|
||||||
extern const struct optdesc opt_ai_addrconfig;
|
extern const struct optdesc opt_ai_addrconfig;
|
||||||
extern const struct optdesc opt_ai_passive;
|
extern const struct optdesc opt_ai_passive;
|
||||||
|
extern const struct optdesc opt_ai_v4mapped;
|
||||||
|
|
||||||
extern const struct optdesc opt_res_debug;
|
extern const struct optdesc opt_res_debug;
|
||||||
extern const struct optdesc opt_res_aaonly;
|
extern const struct optdesc opt_res_aaonly;
|
||||||
|
|
|
@ -36,10 +36,9 @@ int xioopen_ipapp_connect(int argc, const char *argv[], struct opt *opts,
|
||||||
bool needbind = false;
|
bool needbind = false;
|
||||||
bool lowport = false;
|
bool lowport = false;
|
||||||
int level;
|
int level;
|
||||||
int result;
|
|
||||||
|
|
||||||
struct addrinfo **ai_sorted;
|
struct addrinfo **ai_sorted;
|
||||||
int i;
|
int i;
|
||||||
|
int result;
|
||||||
|
|
||||||
if (argc != 3) {
|
if (argc != 3) {
|
||||||
Error2("%s: wrong number of parameters (%d instead of 2)", argv[0], argc-1);
|
Error2("%s: wrong number of parameters (%d instead of 2)", argv[0], argc-1);
|
||||||
|
|
|
@ -354,7 +354,6 @@ int xioopen_udp_sendto(int argc, const char *argv[], struct opt *opts,
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
//xioinit_ip(&pf, xioparms.preferred_ip);
|
|
||||||
retropt_socket_pf(opts, &pf);
|
retropt_socket_pf(opts, &pf);
|
||||||
if ((result = _xioopen_udp_sendto(argv[1], argv[2], opts, xioflags, xfd,
|
if ((result = _xioopen_udp_sendto(argv[1], argv[2], opts, xioflags, xfd,
|
||||||
groups, pf, socktype, ipproto))
|
groups, pf, socktype, ipproto))
|
||||||
|
@ -451,7 +450,6 @@ int xioopen_udp_datagram(int argc, const char *argv[], struct opt *opts,
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
//xioinit_ip(&pf, xioparms.preferred_ip);
|
|
||||||
if ((hostname = strdup(argv[1])) == NULL) {
|
if ((hostname = strdup(argv[1])) == NULL) {
|
||||||
Error1("strdup(\"%s\"): out of memory", argv[1]);
|
Error1("strdup(\"%s\"): out of memory", argv[1]);
|
||||||
return STAT_RETRYLATER;
|
return STAT_RETRYLATER;
|
||||||
|
@ -601,7 +599,6 @@ int xioopen_udp_recv(int argc, const char *argv[], struct opt *opts,
|
||||||
return STAT_NORETRY;
|
return STAT_NORETRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
//xioinit_ip(&pf, xioparms.default_ip);
|
|
||||||
retropt_socket_pf(opts, &pf);
|
retropt_socket_pf(opts, &pf);
|
||||||
if (pf == PF_UNSPEC) {
|
if (pf == PF_UNSPEC) {
|
||||||
#if WITH_IP4 && WITH_IP6
|
#if WITH_IP4 && WITH_IP6
|
||||||
|
|
|
@ -72,7 +72,6 @@ int xioinitialize(void) {
|
||||||
{
|
{
|
||||||
const char *default_ip;
|
const char *default_ip;
|
||||||
|
|
||||||
// xioparms.default_ip = WITH_DEFAULT_IPV;
|
|
||||||
default_ip = getenv("SOCAT_DEFAULT_LISTEN_IP");
|
default_ip = getenv("SOCAT_DEFAULT_LISTEN_IP");
|
||||||
if (default_ip != NULL) {
|
if (default_ip != NULL) {
|
||||||
switch (default_ip[0]) {
|
switch (default_ip[0]) {
|
||||||
|
@ -89,7 +88,6 @@ int xioinitialize(void) {
|
||||||
{
|
{
|
||||||
const char *preferred_ip;
|
const char *preferred_ip;
|
||||||
|
|
||||||
// xioparms.preferred_ip = WITH_DEFAULT_IPV;
|
|
||||||
preferred_ip = getenv("SOCAT_PREFERRED_RESOLVE_IP");
|
preferred_ip = getenv("SOCAT_PREFERRED_RESOLVE_IP");
|
||||||
if (preferred_ip != NULL) {
|
if (preferred_ip != NULL) {
|
||||||
switch (preferred_ip[0]) {
|
switch (preferred_ip[0]) {
|
||||||
|
|
|
@ -386,10 +386,6 @@ xiofile_t *xioopen(const char *addr, /* address specification */
|
||||||
int xioflags) {
|
int xioflags) {
|
||||||
xiofile_t *xfd;
|
xiofile_t *xfd;
|
||||||
|
|
||||||
//if (xioinitialize() < 0) {
|
|
||||||
// return NULL;
|
|
||||||
//}
|
|
||||||
|
|
||||||
Debug1("xioopen(\"%s\")", addr);
|
Debug1("xioopen(\"%s\")", addr);
|
||||||
|
|
||||||
if ((xfd = xioparse_dual(&addr)) == NULL) {
|
if ((xfd = xioparse_dual(&addr)) == NULL) {
|
||||||
|
|
|
@ -181,6 +181,9 @@ const struct optname optionnames[] = {
|
||||||
#endif
|
#endif
|
||||||
#if defined(AI_PASSIVE )
|
#if defined(AI_PASSIVE )
|
||||||
IF_IP ("ai-passive", &opt_ai_passive)
|
IF_IP ("ai-passive", &opt_ai_passive)
|
||||||
|
#endif
|
||||||
|
#if defined(AI_V4MAPPED)
|
||||||
|
IF_IP ("ai-v4mapped", &opt_ai_v4mapped)
|
||||||
#endif
|
#endif
|
||||||
IF_INTERFACE("allmulti", &opt_iff_allmulti)
|
IF_INTERFACE("allmulti", &opt_iff_allmulti)
|
||||||
#if WITH_LIBWRAP && defined(HAVE_HOSTS_ALLOW_TABLE)
|
#if WITH_LIBWRAP && defined(HAVE_HOSTS_ALLOW_TABLE)
|
||||||
|
@ -1848,6 +1851,9 @@ const struct optname optionnames[] = {
|
||||||
#if HAVE_RESOLV_H
|
#if HAVE_RESOLV_H
|
||||||
IF_IP ("usevc", &opt_res_usevc)
|
IF_IP ("usevc", &opt_res_usevc)
|
||||||
#endif /* HAVE_RESOLV_H */
|
#endif /* HAVE_RESOLV_H */
|
||||||
|
#if defined(AI_V4MAPPED)
|
||||||
|
IF_IP ("v4mapped", &opt_ai_v4mapped)
|
||||||
|
#endif
|
||||||
#ifdef IPV6_V6ONLY
|
#ifdef IPV6_V6ONLY
|
||||||
IF_IP6 ("v6only", &opt_ipv6_v6only)
|
IF_IP6 ("v6only", &opt_ipv6_v6only)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -204,6 +204,7 @@ enum e_optcode {
|
||||||
OPT_ADDRESS_FAMILY = 1,
|
OPT_ADDRESS_FAMILY = 1,
|
||||||
OPT_AI_ADDRCONFIG, /* getaddrinfo() */
|
OPT_AI_ADDRCONFIG, /* getaddrinfo() */
|
||||||
OPT_AI_PASSIVE, /* getaddrinfo() */
|
OPT_AI_PASSIVE, /* getaddrinfo() */
|
||||||
|
OPT_AI_V4MAPPED, /* getaddrinfo() */
|
||||||
/* these are not alphabetically, I know... */
|
/* these are not alphabetically, I know... */
|
||||||
OPT_B0, /* termios.c_cflag */
|
OPT_B0, /* termios.c_cflag */
|
||||||
OPT_B50, /* termios.c_cflag */
|
OPT_B50, /* termios.c_cflag */
|
||||||
|
|
Loading…
Reference in a new issue