From 50c0ba528d12ca8fd43b7130fdc12c54cfe13e8c Mon Sep 17 00:00:00 2001 From: Siavash Sameni Date: Tue, 31 Mar 2026 19:06:41 +0400 Subject: [PATCH] Fix IPv6 UDP: send NDP probe before data to populate neighbor cache macOS returns ENOBUFS on IPv6 send_to() until NDP neighbor resolution completes. Send a 1-byte probe packet and wait 200ms for NDP to resolve before starting the data blast. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/server.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/server.rs b/src/server.rs index 70e7201..746cc80 100644 --- a/src/server.rs +++ b/src/server.rs @@ -666,6 +666,14 @@ async fn run_udp_test_server( let client_udp_addr = SocketAddr::new(peer.ip(), client_udp_port); + // On IPv6, send a probe packet to trigger NDP neighbor resolution before blasting. + // macOS returns ENOBUFS on send_to() until the neighbor cache is populated. + if peer.is_ipv6() { + let _ = udp.send_to(&[0u8; 1], client_udp_addr).await; + tokio::time::sleep(Duration::from_millis(200)).await; + tracing::debug!("IPv6 NDP probe sent to {}", client_udp_addr); + } + // When connection_count > 1, MikroTik sends UDP from MULTIPLE source ports // (base_port, base_port+1, ..., base_port+N-1) all to our single server port. // A connect()'d UDP socket only accepts from the one connected address,