mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2026-02-16 12:59:15 +01:00
Ticket refs #15815:InternetGatewayDevice.UPnP.Device.Enable is broken
This commit is contained in:
parent
f979d5c214
commit
69bb85bfe7
1 changed files with 17 additions and 6 deletions
|
|
@ -20,10 +20,18 @@
|
|||
|
||||
int get_upnp_enable(char *refparam, struct dmctx *ctx, char **value)
|
||||
{
|
||||
dmuci_get_option_value_string("upnpd","config","enabled", value);
|
||||
dmuci_get_option_value_string("upnpd","config","enable_upnp", value);
|
||||
if ((*value)[0] == '\0') {
|
||||
*value = "1";
|
||||
pid_t pid = get_pid("miniupnpd");
|
||||
if (pid < 0) {
|
||||
*value = "0";
|
||||
}
|
||||
else {
|
||||
*value = "1";
|
||||
}
|
||||
}
|
||||
if ((*value)[0] == '\0')
|
||||
*value = "0";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -38,10 +46,13 @@ int set_upnp_enable(char *refparam, struct dmctx *ctx, int action, char *value)
|
|||
return 0;
|
||||
case VALUESET:
|
||||
string_to_bool(value, &b);
|
||||
if(b)
|
||||
dmuci_set_value("upnpd", "config", "enabled", "");
|
||||
else
|
||||
dmuci_set_value("upnpd", "config", "enabled", "0");
|
||||
if(b){
|
||||
dmuci_set_value("upnpd", "config", "enable_upnp", "1");
|
||||
dmubus_call_set("uci", "commit", UBUS_ARGS{{"config", "upnpd", String}}, 1);
|
||||
} else {
|
||||
dmuci_set_value("upnpd", "config", "enable_upnp", "0");
|
||||
dmubus_call_set("uci", "commit", UBUS_ARGS{{"config", "upnpd", String}}, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue