mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Refs #17349: InternetGatewayDevice.UPnP.Device.Enable is broken
This commit is contained in:
parent
8ab504585c
commit
b89c48507e
1 changed files with 12 additions and 6 deletions
|
|
@ -36,8 +36,11 @@ DMLEAF tUPnPDeviceParams[] = {
|
|||
/*#Device.UPnP.Device.Enable!UCI:upnpd/upnpd,config/enabled*/
|
||||
int get_upnp_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
dmuci_get_option_value_string("upnpd","config","enabled", value);
|
||||
if ((*value)[0] == '\0') {
|
||||
pid_t pid = get_pid("miniupnpd");
|
||||
if (pid < 0) {
|
||||
*value = "0";
|
||||
}
|
||||
else {
|
||||
*value = "1";
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -54,10 +57,13 @@ int set_upnp_enable(char *refparam, struct dmctx *ctx, void *data, char *instanc
|
|||
return 0;
|
||||
case VALUESET:
|
||||
string_to_bool(value, &b);
|
||||
if(b)
|
||||
dmuci_set_value("upnpd", "config", "enabled", "");
|
||||
else
|
||||
if(b){
|
||||
dmuci_set_value("upnpd", "config", "enabled", "1");
|
||||
dmuci_set_value("upnpd", "config", "enable_natpmp", "1");
|
||||
dmuci_set_value("upnpd", "config", "enable_upnp", "1");
|
||||
} else {
|
||||
dmuci_set_value("upnpd", "config", "enabled", "0");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue