net/portmapper: don't treat 0.0.0.0 as a valid IP

Updates tailscale/corp#23538

Change-Id: I58b8c30abe43f1d1829f01eb9fb2c1e6e8db9476
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2024-10-01 11:51:24 -07:00 committed by Brad Fitzpatrick
parent 16ef88754d
commit 262c526c4e

View File

@ -781,6 +781,10 @@ func parsePMPResponse(pkt []byte) (res pmpResponse, ok bool) {
return res, false return res, false
} }
res.PublicAddr = netaddr.IPv4(pkt[8], pkt[9], pkt[10], pkt[11]) res.PublicAddr = netaddr.IPv4(pkt[8], pkt[9], pkt[10], pkt[11])
if res.PublicAddr.IsUnspecified() {
// Zero it out so it's not Valid and used accidentally elsewhere.
res.PublicAddr = netip.Addr{}
}
} }
return res, true return res, true