Fix build when configured with -DOPENSSL_USE_IPV6=0

Change-Id: I57723835b0a7d20609d8c4ed2988123f975a927d

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21495)
This commit is contained in:
Tom Cosgrove 2023-07-19 12:59:36 +01:00 committed by Hugo Landau
parent 1e2e683aa2
commit 9c8d04dbec

View File

@ -1826,11 +1826,13 @@ static int bio_addr_eq(const BIO_ADDR *a, const BIO_ADDR *b)
&b->s_in.sin_addr,
sizeof(a->s_in.sin_addr))
&& a->s_in.sin_port == b->s_in.sin_port;
#if OPENSSL_USE_IPV6
case AF_INET6:
return !memcmp(&a->s_in6.sin6_addr,
&b->s_in6.sin6_addr,
sizeof(a->s_in6.sin6_addr))
&& a->s_in6.sin6_port == b->s_in6.sin6_port;
#endif
default:
return 0; /* not supported */
}
@ -1879,8 +1881,12 @@ static void ch_rx_handle_packet(QUIC_CHANNEL *ch)
*/
if (!ch->is_server
&& ch->qrx_pkt->peer != NULL
&& (BIO_ADDR_family(&ch->cur_peer_addr) == AF_INET
|| BIO_ADDR_family(&ch->cur_peer_addr) == AF_INET6)
&& (
BIO_ADDR_family(&ch->cur_peer_addr) == AF_INET
#if OPENSSL_USE_IPV6
|| BIO_ADDR_family(&ch->cur_peer_addr) == AF_INET6
#endif
)
&& !bio_addr_eq(ch->qrx_pkt->peer, &ch->cur_peer_addr))
return;