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.
@@ -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);
