diff options
author | Hugo Landau <hlandau@openssl.org> | 2023-08-09 17:46:32 +0100 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2023-09-01 10:45:34 +0100 |
commit | 617b459ddfabe5c2fbfc28808126999d936218fe (patch) | |
tree | 5803ed62c8266371a841ccd5edaf7a60891664ba /ssl | |
parent | 51e671e204ede3a56c3e1c38d834240020800dfa (diff) |
QUIC CHANNEL: Introduce concept of (non-)addressed mode
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21715)
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/quic/quic_channel.c | 15 | ||||
-rw-r--r-- | ssl/quic/quic_channel_local.h | 3 | ||||
-rw-r--r-- | ssl/quic/quic_txp.c | 4 |
3 files changed, 19 insertions, 3 deletions
diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c index 275d5f576b..efbe1c1660 100644 --- a/ssl/quic/quic_channel.c +++ b/ssl/quic/quic_channel.c @@ -584,13 +584,26 @@ int ossl_quic_channel_set_mutator(QUIC_CHANNEL *ch, int ossl_quic_channel_get_peer_addr(QUIC_CHANNEL *ch, BIO_ADDR *peer_addr) { + if (!ch->addressed_mode) + return 0; + *peer_addr = ch->cur_peer_addr; return 1; } int ossl_quic_channel_set_peer_addr(QUIC_CHANNEL *ch, const BIO_ADDR *peer_addr) { - ch->cur_peer_addr = *peer_addr; + if (ch->state != QUIC_CHANNEL_STATE_IDLE) + return 0; + + if (peer_addr == NULL || BIO_ADDR_family(peer_addr) == AF_UNSPEC) { + BIO_ADDR_clear(&ch->cur_peer_addr); + ch->addressed_mode = 0; + return 1; + } + + ch->cur_peer_addr = *peer_addr; + ch->addressed_mode = 1; return 1; } diff --git a/ssl/quic/quic_channel_local.h b/ssl/quic/quic_channel_local.h index a60a539f9b..8b2edc647a 100644 --- a/ssl/quic/quic_channel_local.h +++ b/ssl/quic/quic_channel_local.h @@ -456,6 +456,9 @@ struct quic_channel_st { /* Inhibit tick for testing purposes? */ unsigned int inhibit_tick : 1; + /* Are we using addressed mode? */ + unsigned int addressed_mode : 1; + /* Saved error stack in case permanent error was encountered */ ERR_STATE *err_state; }; diff --git a/ssl/quic/quic_txp.c b/ssl/quic/quic_txp.c index 51802ba7b6..97cba812e7 100644 --- a/ssl/quic/quic_txp.c +++ b/ssl/quic/quic_txp.c @@ -555,8 +555,8 @@ int ossl_quic_tx_packetiser_set_peer(OSSL_QUIC_TX_PACKETISER *txp, const BIO_ADDR *peer) { if (peer == NULL) { - ERR_raise(ERR_LIB_SSL, ERR_R_PASSED_NULL_PARAMETER); - return 0; + BIO_ADDR_clear(&txp->args.peer); + return 1; } txp->args.peer = *peer; |