diff --git a/Open.Nat/Upnp/UpnpNatDevice.cs b/Open.Nat/Upnp/UpnpNatDevice.cs index 7fb8353..8cac3d3 100644 --- a/Open.Nat/Upnp/UpnpNatDevice.cs +++ b/Open.Nat/Upnp/UpnpNatDevice.cs @@ -196,8 +196,16 @@ public override async Task GetSpecificMappingAsync (Protocol protocol, } catch (MappingException e) { - if (e.ErrorCode != UpnpConstants.NoSuchEntryInArray) throw; - return null; + if (e.ErrorCode == UpnpConstants.NoSuchEntryInArray ) return null; + + // DD-WRT Linux base router (and others probably) fails with 402-InvalidArgument + // when no mapping is found in the mappings table + if (e.ErrorCode == UpnpConstants.InvalidArguments) + { + NatDiscoverer.TraceSource.LogWarn("Router failed with 402-InvalidArgument. Mapping not found is assumed."); + return null; + } + throw; } }