miniupnpd: When ExternalIPAddress is unknown returns empty string in GetExternalIPAddress

IGD v2.0 specification for WANIPConnection:2 says:

  When the external IP address could not be retrieved by the gateway (for
  example, because the interface is down or because there was a failure in
  the last connection setup attempt), then the ExternalIPAddress MUST be
  equal to the empty string.

So instead of Error 501 "Action Failed" returns empty string to be
compliant with IGD v2.0 specification.
This commit is contained in:
Pali Rohár 2021-03-28 17:20:34 +02:00
parent 2254e8928e
commit 79ca440f73
1 changed files with 1 additions and 4 deletions

View File

@ -365,10 +365,7 @@ GetExternalIPAddress(struct upnphttp * h, const char * action, const char * ns)
}
#endif
if (strcmp(ext_ip_addr, "0.0.0.0") == 0)
{
SoapError(h, 501, "Action Failed");
return;
}
ext_ip_addr[0] = '\0';
bodylen = snprintf(body, sizeof(body), resp,
action, ns, /*SERVICE_TYPE_WANIPC,*/
ext_ip_addr, action);