Fix IPv6 UDP TX: enlarge socket buffers to 4MB
All checks were successful
CI / test (push) Successful in 1m25s
All checks were successful
CI / test (push) Successful in 1m25s
macOS IPv6 UDP sockets have tiny default send buffers, causing immediate ENOBUFS on every send_to(). Set SO_SNDBUF and SO_RCVBUF to 4MB using socket2, matching what works for high-throughput IPv4. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -644,6 +644,14 @@ async fn run_udp_test_server(
|
|||||||
format!("0.0.0.0:{}", server_udp_port).parse().unwrap()
|
format!("0.0.0.0:{}", server_udp_port).parse().unwrap()
|
||||||
};
|
};
|
||||||
let udp = UdpSocket::bind(bind_addr).await?;
|
let udp = UdpSocket::bind(bind_addr).await?;
|
||||||
|
|
||||||
|
// Enlarge send/receive buffers — IPv6 on macOS has small defaults
|
||||||
|
let std_sock = udp.into_std()?;
|
||||||
|
let sock2 = socket2::Socket::from(std_sock);
|
||||||
|
let _ = sock2.set_send_buffer_size(4 * 1024 * 1024); // 4MB
|
||||||
|
let _ = sock2.set_recv_buffer_size(4 * 1024 * 1024);
|
||||||
|
let udp = UdpSocket::from_std(sock2.into())?;
|
||||||
|
|
||||||
let client_udp_addr = SocketAddr::new(peer.ip(), client_udp_port);
|
let client_udp_addr = SocketAddr::new(peer.ip(), client_udp_port);
|
||||||
|
|
||||||
// When connection_count > 1, MikroTik sends UDP from MULTIPLE source ports
|
// When connection_count > 1, MikroTik sends UDP from MULTIPLE source ports
|
||||||
|
|||||||
Reference in New Issue
Block a user