Skip to content

Commit

Permalink
fix(derp): restore ClientInfo mesh_key field (#2090)
Browse files Browse the repository at this point in the history
## Description

In order to preserve backwards compatibility, we should keep the
`ClientInfo` unchanged. The `mesh_key` field is ignored by the server.

## Change checklist

- [x] Self-review.
- [x] Documentation updates if relevant.
- [x] Tests if relevant.
  • Loading branch information
ramfox committed Mar 18, 2024
1 parent 484e5e8 commit 75a8590
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions iroh-net/src/derp/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ impl ClientBuilder {
version: PROTOCOL_VERSION,
can_ack_pings: self.can_ack_pings,
is_prober: self.is_prober,
mesh_key: None,
};
debug!("server_handshake: sending client_key: {:?}", &client_info);
let shared_secret = self.secret_key.shared(&server_key);
Expand Down
1 change: 1 addition & 0 deletions iroh-net/src/derp/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ mod tests {
version: PROTOCOL_VERSION,
can_ack_pings: true,
is_prober: true,
mesh_key: None,
};
println!("client_key pub {:?}", client_key.public());
let shared_secret = client_key.shared(&server_key.public());
Expand Down
1 change: 1 addition & 0 deletions iroh-net/src/derp/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ mod tests {
version: PROTOCOL_VERSION,
can_ack_pings: true,
is_prober: true,
mesh_key: None,
};
let shared_secret = client_key.shared(&got_server_key);
crate::derp::codec::send_client_key(
Expand Down
2 changes: 2 additions & 0 deletions iroh-net/src/derp/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ pub(crate) struct ClientInfo {
/// The DERP protocol version that the client was built with.
/// See [`PROTOCOL_VERSION`].
pub(crate) version: usize,
/// Unused field, ignored by the relay server.
pub(crate) mesh_key: Option<[u8; 32]>,
/// Whether the client declares it's able to ack pings
pub(crate) can_ack_pings: bool,
/// Whether this client is a prober.
Expand Down

0 comments on commit 75a8590

Please sign in to comment.