commit 24a79c11d203eef18e389d5828393727629205a8
parent 61d8eaf684d3c7751e63e04ad37411b53af101ac
Author: Christoph Lohmann <20h@r-36.net>
Date: Sun, 11 Nov 2018 11:09:55 +0100
Allow dualstack binding again.
Diffstat:
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/main.c b/main.c
@@ -301,9 +301,7 @@ getlistenfd(struct addrinfo *hints, char *bindip, char *port)
char addstr[INET6_ADDRSTRLEN];
struct addrinfo *ai, *rp;
void *sinaddr;
- int on, reqaf, listfd, aierr, errno_save;
-
- reqaf = hints->ai_family;
+ int on, listfd, aierr, errno_save;
if ((aierr = getaddrinfo(bindip, port, hints, &ai)) || ai == NULL) {
fprintf(stderr, "getaddrinfo (%s:%s): %s\n", bindip, port,
@@ -325,14 +323,6 @@ getlistenfd(struct addrinfo *hints, char *bindip, char *port)
break;
}
- if (reqaf == AF_INET6 &&
- (setsockopt(listfd, IPPROTO_IPV6, IPV6_V6ONLY, &on,
- sizeof(on)) < 0)) {
- close(listfd);
- listfd = -1;
- break;
- }
-
sinaddr = (rp->ai_family == AF_INET) ?
(void *)&((struct sockaddr_in *)rp->ai_addr)->sin_addr :
(void *)&((struct sockaddr_in6 *)rp->ai_addr)->sin6_addr;