miniupnpd: GetExternalIPAddress(): Instead of invalid IP address 0.0.0.0 returns error 501

IP address 0.0.0.0 is filled when it is not possible to retrieve IP address. According to specification, GetExternalIPAddress() can return error 501 when action failed.
This commit is contained in:
Pali Rohár 2018-05-19 17:28:43 +02:00
parent 8c97654d70
commit c1472ffe4e
1 changed files with 5 additions and 0 deletions

View File

@ -359,6 +359,11 @@ 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;
}
bodylen = snprintf(body, sizeof(body), resp,
action, ns, /*SERVICE_TYPE_WANIPC,*/
ext_ip_addr, action);