Daiki Ueno 09c1db3399 apps: Use the first detected address family if IPv6 is not available
This is a follow up of 15729bef385211bc2a0497e2d53a45c45d677d2c.  Even
when the host does not support IPv6 at all, BIO_lookup_ex may now
return IN6ADDR_ANY in addition to INADDR_ANY, as the second element of
the ai_next field.

After eee8a40aa5e06841eed6fa8eb4f6109238d59aea, the do_server function
prefers the IPv6 address and fails on the BIO_socket call.  This adds
a fallback code to retry with the IPv4 address returned as the first
element to avoid the error.

The failure had been partially avoided in the previous code with
AI_ADDRCONFIG, because getaddrinfo returns only IPv4 address if no
IPv6 address is associated with external interface.  However, it would
be still a problem if the external interface has an IPv6 address
assigned, while the loopback interface doesn't.

Signed-off-by: Daiki Ueno <dueno@redhat.com>

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16074)
2021-07-16 08:58:06 +02:00
..
2021-06-11 12:39:46 +02:00
2021-06-02 16:30:15 +10:00
2021-05-06 13:03:23 +01:00
2020-12-15 11:47:17 +01:00
2021-05-06 13:03:23 +01:00
2021-05-12 11:11:53 +10:00
2021-05-06 13:03:23 +01:00
2021-05-29 07:47:03 +02:00
2021-05-06 13:03:23 +01:00
2020-05-13 06:28:36 +02:00
2021-07-09 10:45:36 +10:00
2021-05-06 13:03:23 +01:00
2021-05-06 13:03:23 +01:00
2021-06-26 11:40:34 +10:00