diff options
author | Vladimir Panteleev <git@cy.md> | 2022-01-22 21:54:33 +0300 |
---|---|---|
committer | rofl0r <rofl0r@users.noreply.github.com> | 2022-01-22 23:05:47 +0300 |
commit | 6abeb53e69193966329df3beeae857051cd329b6 (patch) | |
tree | 96f8fdf3b98d5101483890afa10e051037b18a15 | |
parent | 70629aaf2548b4ca49cf0508628d07337fc7b989 (diff) |
proxy_getaddrinfo(): Fill in ai_socktype if requested
If the application specifies a protocol but not a socket type,
normally getaddrinfo will select a corresponding protocol.
Mimic this behavior in our implementation of the function as well.
We only care about the case we're actually able to proxify
(SOCK_STREAM / IPPROTO_TCP).
Fixes proxifying pssh.
-rw-r--r-- | src/core.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -1018,6 +1018,8 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin p->ai_socktype = hints->ai_socktype; p->ai_flags = hints->ai_flags; p->ai_protocol = hints->ai_protocol; + if(!p->ai_socktype && p->ai_protocol == IPPROTO_TCP) + p->ai_socktype = SOCK_STREAM; } else { #ifndef AI_V4MAPPED #define AI_V4MAPPED 0 |