mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-22 16:19:20 +02:00
Rework handling of IPv6 address failures
Skip IPv6 on any error getting the default address (::) if IPv6 is not explicitly chosen.
This commit is contained in:
parent
43a82ef6be
commit
ee623a2d84
|
@ -2599,22 +2599,21 @@ main(int argc, char **argv)
|
|||
}
|
||||
if (addrfamily == AF_UNSPEC || addrfamily == AF_INET6) {
|
||||
int addr6_res = get_addr(listen_ip6, port, AF_INET6, AI_PASSIVE, &dns6addr);
|
||||
if (
|
||||
#ifdef EAI_ADDRFAMILY
|
||||
addr6_res == EAI_ADDRFAMILY ||
|
||||
#endif
|
||||
addr6_res == EAI_FAMILY) {
|
||||
if (addrfamily == AF_INET6) {
|
||||
fprintf(stderr, "IPv6 not supported");
|
||||
exit(4);
|
||||
if (addr6_res < 0) {
|
||||
if (listen_ip6 == NULL) {
|
||||
if (addrfamily == AF_INET6) {
|
||||
fprintf(stderr, "IPv6 not supported");
|
||||
exit(3);
|
||||
} else {
|
||||
warnx("IPv6 not supported, skipping");
|
||||
addrfamily = AF_INET;
|
||||
}
|
||||
} else {
|
||||
warnx("IPv6 not supported, skipping");
|
||||
addrfamily = AF_INET;
|
||||
warnx("Failed to get IPv6 address to listen on: '%s': %s",
|
||||
listen_ip6, gai_strerror(addr6_res));
|
||||
usage();
|
||||
/* NOTREACHED */
|
||||
}
|
||||
} else if (addr6_res < 0) {
|
||||
warnx("Failed to get IPv6 address to listen on: '%s': %s",
|
||||
listen_ip6, gai_strerror(addr6_res));
|
||||
usage();
|
||||
} else {
|
||||
dns6addr_len = addr6_res;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue