mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-16 11:41:39 +00:00
wgengine/magicsock: fix a naked return bug/crash where we returned (nil, true)
The 'ok' from 'ipp, ok :=' above was the result parameter ok. Whoops.
This commit is contained in:
parent
51bd1feae4
commit
edce91a8a6
@ -1535,21 +1535,21 @@ func (c *Conn) ReceiveIPv4(b []byte) (n int, ep conn.Endpoint, err error) {
|
|||||||
func (c *Conn) receiveIP(b []byte, ua *net.UDPAddr, cache *ippEndpointCache) (ep conn.Endpoint, ok bool) {
|
func (c *Conn) receiveIP(b []byte, ua *net.UDPAddr, cache *ippEndpointCache) (ep conn.Endpoint, ok bool) {
|
||||||
ipp, ok := netaddr.FromStdAddr(ua.IP, ua.Port, ua.Zone)
|
ipp, ok := netaddr.FromStdAddr(ua.IP, ua.Port, ua.Zone)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return nil, false
|
||||||
}
|
}
|
||||||
if stun.Is(b) {
|
if stun.Is(b) {
|
||||||
c.stunReceiveFunc.Load().(func([]byte, netaddr.IPPort))(b, ipp)
|
c.stunReceiveFunc.Load().(func([]byte, netaddr.IPPort))(b, ipp)
|
||||||
return
|
return nil, false
|
||||||
}
|
}
|
||||||
if c.handleDiscoMessage(b, ipp) {
|
if c.handleDiscoMessage(b, ipp) {
|
||||||
return
|
return nil, false
|
||||||
}
|
}
|
||||||
if cache.ipp == ipp && cache.de != nil && cache.gen == cache.de.numStopAndReset() {
|
if cache.ipp == ipp && cache.de != nil && cache.gen == cache.de.numStopAndReset() {
|
||||||
ep = cache.de
|
ep = cache.de
|
||||||
} else {
|
} else {
|
||||||
ep = c.findEndpoint(ipp, ua, b)
|
ep = c.findEndpoint(ipp, ua, b)
|
||||||
if ep == nil {
|
if ep == nil {
|
||||||
return
|
return nil, false
|
||||||
}
|
}
|
||||||
if de, ok := ep.(*discoEndpoint); ok {
|
if de, ok := ep.(*discoEndpoint); ok {
|
||||||
cache.ipp = ipp
|
cache.ipp = ipp
|
||||||
|
Loading…
x
Reference in New Issue
Block a user