Skip to content

Commit

Permalink
udp: m unlikely edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
ignoramous committed Oct 23, 2024
1 parent 5ed9200 commit a0904ed
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions intra/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,6 @@ func (h *udpHandler) proxy(gconn *netstack.GUDPConn, src, dst netip.AddrPort, dm
func (h *udpHandler) Connect(gconn *netstack.GUDPConn, src, target netip.AddrPort, dmx netstack.DemuxerFn) (pc net.Conn, smm *SocketSummary, err error) {
mux := dmx != nil

if !target.IsValid() { // must call h.Bind
err = errUdpUnconnected
}

// flow is alg/nat-aware, do not change target or any addrs
res, undidAlg, realips, domains := h.onFlow(src, target)
cid, pid, uid := splitCidPidUid(res) // cid & uid may be empty
Expand All @@ -205,6 +201,10 @@ func (h *udpHandler) Connect(gconn *netstack.GUDPConn, src, target netip.AddrPor
return nil, smm, errUdpEnd // disconnect, no nat
}

if !target.IsValid() { // must call h.Bind?
return nil, smm, errUdpUnconnected
}

actualTargets := makeIPPorts(realips, target, 0)

if pid == ipn.Block {
Expand Down

0 comments on commit a0904ed

Please sign in to comment.