ignore some errors from socket(2)

There's no much we can do if we resolv an IPv6 address but its
support is disabled in the current kernel, so ignore and go ahead.
Spotted while testing gmid i n a FreeBSD jail without IPv6.
This commit is contained in:
Omar Polo 2023-08-25 09:40:09 +00:00
parent 39204b7e48
commit 3cb7e8d7ac
1 changed files with 5 additions and 1 deletions

View File

@ -18,6 +18,7 @@
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <string.h>
@ -244,8 +245,11 @@ config_send_socks(struct conf *conf)
TAILQ_FOREACH(addr, &conf->addrs, addrs) {
sock = socket(addr->ai_family, addr->ai_socktype,
addr->ai_protocol);
if (sock == -1)
if (sock == -1) {
if (errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT)
continue;
fatal("socket");
}
v = 1;
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &v, sizeof(v))