Skip to content

Commit 27a1aad

Browse files
fix(udp): skip session insert when udp_open returns eof
1 parent 39e8c53 commit 27a1aad

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎src/proxy_server.rs‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,20 @@ async fn handle_socks5_udp_associate(
872872
};
873873
send_udp_response_packets(&udp, peer, &target, &resp).await;
874874

875+
// Tunnel-node may report eof on the open response if the
876+
// upstream socket died between bind and the first drain
877+
// (e.g., immediate ICMP unreachable). The session has
878+
// already been reaped on that side — skip insert/spawn
879+
// and let the next datagram from the client retry.
880+
if resp.eof.unwrap_or(false) {
881+
tracing::debug!(
882+
"udp open {}:{} returned eof; not tracking session",
883+
target.host,
884+
target.port,
885+
);
886+
continue;
887+
}
888+
875889
let (uplink_tx, uplink_rx) = mpsc::channel::<Vec<u8>>(UDP_UPLINK_QUEUE);
876890
let task_mux = mux.clone();
877891
let task_udp = udp.clone();

0 commit comments

Comments
 (0)