Return 730 error where appropriate, and output helpful debug

This commit is contained in:
Arran Cudbard-Bell 2014-05-13 21:29:49 +01:00
parent 20f1e070a1
commit f27dd45973
1 changed files with 12 additions and 1 deletions

View File

@ -772,12 +772,23 @@ DeletePortMappingRange(struct upnphttp * h, const char * action)
return;
}
syslog(LOG_INFO, "%s: deleting external ports: %hu-%hu, protocol: %s",
action, startport, endport, protocol);
port_list = upnp_get_portmappings_in_range(startport, endport,
protocol, &number);
if(number == 0)
{
SoapError(h, 730, "PortMappingNotFound");
ClearNameValueList(&data);
return;
}
for(i = 0; i < number; i++)
{
r = upnp_delete_redirection(port_list[i], protocol);
/* TODO : check return value for errors */
syslog(LOG_INFO, "%s: deleting external port: %hu, protocol: %s: %s",
action, port_list[i], protocol, r < 0 ? "failed" : "ok");
}
free(port_list);
BuildSendAndCloseSoapResp(h, resp, sizeof(resp)-1);