From 71be839f0360e040542193d6f53fc84584a2f96c Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Tue, 30 Nov 2021 11:43:54 -0800 Subject: [PATCH] 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. Change-Id: Ia0124e19b7df1191a7685aee949fd19336e41a76 Signed-off-by: Josh Bleecher Snyder (cherry picked from commit a8cc519c708cb8a81fcb146130e0f9e7ac7e8a35) --- net/portmapper/portmapper.go | 1 + 1 file changed, 1 insertion(+) diff --git a/net/portmapper/portmapper.go b/net/portmapper/portmapper.go index fdbb9ba32..9163076ca 100644 --- a/net/portmapper/portmapper.go +++ b/net/portmapper/portmapper.go @@ -763,6 +763,7 @@ func (c *Client) Probe(ctx context.Context) (res ProbeResult, err error) { meta, err := parseUPnPDiscoResponse(buf[:n]) if err != nil { c.logf("unrecognized UPnP discovery response; ignoring") + continue } c.logf("[v1] UPnP reply %+v, %q", meta, buf[:n]) res.UPnP = true