From 9c8d04dbec03172d6ffe4eaa38ea4b1ac2741f26 Mon Sep 17 00:00:00 2001 From: Tom Cosgrove Date: Wed, 19 Jul 2023 12:59:36 +0100 Subject: [PATCH] Fix build when configured with -DOPENSSL_USE_IPV6=0 Change-Id: I57723835b0a7d20609d8c4ed2988123f975a927d Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale Reviewed-by: Hugo Landau (Merged from https://github.com/openssl/openssl/pull/21495) --- ssl/quic/quic_channel.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c index 6b009acfde..1e6a29a706 100644 --- a/ssl/quic/quic_channel.c +++ b/ssl/quic/quic_channel.c @@ -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;