Skip to content

Commit

Permalink
nilaway: udp.go proxy may be nil
Browse files Browse the repository at this point in the history
  • Loading branch information
ignoramous committed Oct 25, 2024
1 parent 95a0ab9 commit 07526de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion intra/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ func (h *tcpHandler) Proxy(gconn *netstack.GTCPConn, src, target netip.AddrPort)
} // else not a dns request
} // if ipn.Exit then let it connect as-is (aka exit)

var px ipn.Proxy = nil
// pick all realips to connect to
for i, dstipp := range actualTargets {
var px ipn.Proxy = nil
if px, err = h.prox.ProxyTo(dstipp, uid, pids); err != nil || px == nil {
continue
}
Expand Down
6 changes: 3 additions & 3 deletions intra/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,14 @@ func (h *udpHandler) Connect(gconn *netstack.GUDPConn, src, target netip.AddrPor
// pc.RemoteAddr may be that of the proxy, not the actual dst
// ex: pc.RemoteAddr is 127.0.0.1 for Orbot
smm.Target = selectedTarget.Addr().String()
if px != nil {
if px != nil { // nil when all ProxyTo attempts for actualTargets fail
smm.PID = px.ID()
}

if errs != nil {
return nil, smm, errs // disconnect
} else if pc == nil || core.IsNil(pc) {
log.W("udp: connect: %s no egress conn/mux? %t for addr(%s/%s), uid %s",
} else if px == nil || pc == nil || core.IsNil(pc) {
log.W("udp: connect: %s no proxy/egress-conn (mux? %t) for addr(%s/%s), uid %s",
cid, mux, target, selectedTarget, uid)
return nil, smm, errUdpSetupConn // disconnect
}
Expand Down

0 comments on commit 07526de

Please sign in to comment.