1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-15 15:43:24 +00:00

Added the optional DEVTESTS feature for developer tests with controlled name resolution to both IPv4 and IPV6 addresses

This commit is contained in:
Gerhard Rieger 2024-08-20 12:02:25 +02:00
parent a86376cd1e
commit 602a54420e
7 changed files with 350 additions and 8 deletions

View file

@ -3338,7 +3338,7 @@ int retropt_bind(struct opt *opts,
return STAT_NORETRY;
}
break;
#endif /* WITH_IP4 || WITH_IP6 */
#endif /* WITH_IP4 || WITH_IP6 || WITH_VSOCK */
#if WITH_UNIX
case AF_UNIX:
@ -3367,6 +3367,52 @@ int retropt_bind(struct opt *opts,
}
return STAT_OK;
}
#if 0
#if _WITH_IP4 || _WITH_IP6
/* Looks for a bind option and, if found, calls xiogetaddrinfo and provides the
results list in bindlist.
returns STAT_OK if option exists and could be resolved,
STAT_NORETRY if option exists but had error,
or STAT_NOACTION if it does not exist */
int retropt_bind_gai(struct opt *opts,
int af,
int socktype,
int ipproto,
struct addrinfo **bindlist,
int feats, /* TCP etc: 1..address allowed,
3..address and port allowed
*/
const int ai_flags[2])
{
if (retropt_string(opts, OPT_BIND, &bindname) < 0) {
return STAT_NOACTION;
}
bindp = bindname;
switch (af) {
#if WITH_IP4 || WITH_IP6
case AF_UNSPEC:
#if WITH_IP4
case AF_INET:
#endif
#if WITH_IP6
case AF_INET6:
#endif /*WITH_IP6 */
break;
#endif /* WITH_IP4 || WITH_IP6 */
default:
Error1("bind: unknown address family %d", af);
return STAT_NORETRY;
}
return STAT_OK;
}
#endif /* _WITH_IP4 || _WITH_IP6 */
#endif /* 0 */
#endif /* _WITH_SOCKET */
@ -4196,7 +4242,8 @@ int applyopts_fchown(int fd, struct opt *opts) {
return 0;
}
/* caller must make sure that option is not yet consumed */
/* Offset means a position in the sfd record where value is written.
Caller must make sure that option is not yet consumed */
static int applyopt_offset(struct single *sfd, struct opt *opt) {
unsigned char *ptr;