net/portmapper: improve handling of UPnP parse errors

Without the continue, we might overwrite our current meta
with a zero meta.

Log the error, so that we can check for anything unexpected.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
Josh Bleecher Snyder 2021-11-30 11:43:54 -08:00 committed by Josh Bleecher Snyder
parent fddf43f3d1
commit a8cc519c70

View File

@ -770,7 +770,8 @@ func (c *Client) Probe(ctx context.Context) (res ProbeResult, err error) {
meta, err := parseUPnPDiscoResponse(buf[:n])
if err != nil {
metricUPnPParseErr.Add(1)
c.logf("unrecognized UPnP discovery response; ignoring")
c.logf("unrecognized UPnP discovery response; ignoring: %v", err)
continue
}
metricUPnPOK.Add(1)
c.logf("[v1] UPnP reply %+v, %q", meta, buf[:n])