From b01502a1151c9110a5e811a7ec51dede639945df Mon Sep 17 00:00:00 2001 From: angt Date: Sat, 24 Oct 2015 12:12:09 +0200 Subject: [PATCH] Set AI_PASSIVE only for listener --- glorytun.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/glorytun.c b/glorytun.c index 58c935f..ae30ddd 100644 --- a/glorytun.c +++ b/glorytun.c @@ -304,9 +304,11 @@ int main (int argc, char **argv) .ai_family = AF_UNSPEC, .ai_socktype = SOCK_STREAM, .ai_protocol = IPPROTO_TCP, - .ai_flags = AI_PASSIVE, }; + if (listener) + hints.ai_flags = AI_PASSIVE; + struct addrinfo *ai = NULL; if (getaddrinfo(host, port, &hints, &ai)) {