From 198cbacc3e36431687a8008aa2dfc1e422c84360 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Tue, 21 Oct 2014 13:12:57 +0200 Subject: [PATCH] Be lenient towards malformed UPnP IGD UUIDs (fixes #890) --- internal/model/puller.go | 2 +- internal/upnp/upnp.go | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/internal/model/puller.go b/internal/model/puller.go index 5f0bd8a4c..9f01644ea 100644 --- a/internal/model/puller.go +++ b/internal/model/puller.go @@ -636,7 +636,7 @@ nextBlock: continue nextBlock } - // Select the least busy device to pull the block frop.model. If we found no + // Select the least busy device to pull the block from. If we found no // feasible device at all, fail the block (and in the long run, the // file). potentialDevices := p.model.availability(p.folder, state.file.Name) diff --git a/internal/upnp/upnp.go b/internal/upnp/upnp.go index 5d2d529c1..0553960f7 100644 --- a/internal/upnp/upnp.go +++ b/internal/upnp/upnp.go @@ -236,8 +236,7 @@ func handleSearchResponse(deviceType string, knownDevices []*IGD, resp []byte, l deviceUUID := strings.TrimLeft(strings.Split(deviceUSN, "::")[0], "uuid:") matched, err := regexp.MatchString("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", deviceUUID) if !matched { - l.Infoln("Invalid IGD response: invalid device UUID " + deviceUUID) - return + l.Infoln("Invalid IGD response: invalid device UUID", deviceUUID, "(continuing anyway)") } // Don't re-add devices that are already known @@ -474,7 +473,7 @@ func soapRequest(url, device, function, message string) ([]byte, error) { // Add a port mapping to all relevant services on the specified InternetGatewayDevice. // Port mapping will fail and return an error if action is fails for _any_ of the relevant services. -// For this reason, it is generally better to configure port mapping for each individual service instead. +// For this reason, it is generally better to configure port mapping for each individual service instead. func (n *IGD) AddPortMapping(protocol Protocol, externalPort, internalPort int, description string, timeout int) error { for _, service := range n.services { err := service.AddPortMapping(n.localIPAddress, protocol, externalPort, internalPort, description, timeout) @@ -487,7 +486,7 @@ func (n *IGD) AddPortMapping(protocol Protocol, externalPort, internalPort int, // Delete a port mapping from all relevant services on the specified InternetGatewayDevice. // Port mapping will fail and return an error if action is fails for _any_ of the relevant services. -// For this reason, it is generally better to configure port mapping for each individual service instead. +// For this reason, it is generally better to configure port mapping for each individual service instead. func (n *IGD) DeletePortMapping(protocol Protocol, externalPort int) error { for _, service := range n.services { err := service.DeletePortMapping(protocol, externalPort)