From 35fba29f5feac239c12aa5bcd3a7e8b4d57c7fca Mon Sep 17 00:00:00 2001 From: Tim Froidcoeur Date: Wed, 3 Apr 2024 10:02:05 +0200 Subject: [PATCH] fix: connected udp socket performance fix https://github.com/cloudflare/boringtun/issues/395 connected sock needs to be DGRAM Signed-off-by: Tim Froidcoeur --- boringtun/src/device/peer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boringtun/src/device/peer.rs b/boringtun/src/device/peer.rs index d7f2c22e..3bf3655b 100644 --- a/boringtun/src/device/peer.rs +++ b/boringtun/src/device/peer.rs @@ -117,7 +117,7 @@ impl Peer { .expect("Attempt to connect to undefined endpoint"); let udp_conn = - socket2::Socket::new(Domain::for_address(addr), Type::STREAM, Some(Protocol::UDP))?; + socket2::Socket::new(Domain::for_address(addr), Type::DGRAM, Some(Protocol::UDP))?; udp_conn.set_reuse_address(true)?; let bind_addr = if addr.is_ipv4() { SocketAddrV4::new(Ipv4Addr::UNSPECIFIED, port).into()