From 523c7d91c17251e06a8a1ca99930f9e1eaffec89 Mon Sep 17 00:00:00 2001 From: Felician Nemeth Date: Tue, 2 Apr 2024 11:22:08 +0200 Subject: [PATCH] Break linkability on client-side after planned migration (See bug #1803 for the server-side case.) --- quinn-proto/src/connection/mod.rs | 2 +- quinn/src/connection.rs | 3 ++- quinn/src/endpoint.rs | 2 +- quinn/src/lib.rs | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/quinn-proto/src/connection/mod.rs b/quinn-proto/src/connection/mod.rs index b70a0abcc..ec46ffa71 100644 --- a/quinn-proto/src/connection/mod.rs +++ b/quinn-proto/src/connection/mod.rs @@ -2907,7 +2907,7 @@ impl Connection { } /// Switch to a previously unused remote connection ID, if possible - fn update_rem_cid(&mut self) { + pub fn update_rem_cid(&mut self) { let (reset_token, retired) = match self.rem_cids.next() { Some(x) => x, None => return, diff --git a/quinn/src/connection.rs b/quinn/src/connection.rs index 5bed610cb..41772d8e0 100644 --- a/quinn/src/connection.rs +++ b/quinn/src/connection.rs @@ -915,7 +915,8 @@ impl State { ) -> Result<(), ConnectionError> { loop { match self.conn_events.poll_recv(cx) { - Poll::Ready(Some(ConnectionEvent::Ping)) => { + Poll::Ready(Some(ConnectionEvent::LocalAddressChanged)) => { + self.inner.update_rem_cid(); self.inner.ping(); } Poll::Ready(Some(ConnectionEvent::Proto(event))) => { diff --git a/quinn/src/endpoint.rs b/quinn/src/endpoint.rs index dfbdee5eb..6d2822a87 100644 --- a/quinn/src/endpoint.rs +++ b/quinn/src/endpoint.rs @@ -218,7 +218,7 @@ impl Endpoint { // Generate some activity so peers notice the rebind for sender in inner.connections.senders.values() { // Ignoring errors from dropped connections - let _ = sender.send(ConnectionEvent::Ping); + let _ = sender.send(ConnectionEvent::LocalAddressChanged); } Ok(()) diff --git a/quinn/src/lib.rs b/quinn/src/lib.rs index f1d8db5cb..0e1a4c902 100644 --- a/quinn/src/lib.rs +++ b/quinn/src/lib.rs @@ -94,8 +94,8 @@ enum ConnectionEvent { error_code: VarInt, reason: bytes::Bytes, }, + LocalAddressChanged, Proto(proto::ConnectionEvent), - Ping, } #[derive(Debug)]