use uci set instead of uci add for add of a section interface

This commit is contained in:
Anis Ellouze 2015-09-04 10:10:53 +01:00 committed by MOHAMED Kallel
parent 6775878f54
commit 026576c919
2 changed files with 10 additions and 10 deletions

View file

@ -227,12 +227,12 @@ int set_layer3_enable(char *refparam, struct dmctx *ctx, int action, char *value
if (b) {
if (routeargs->type == ROUTE_STATIC)
return 0;
dmuci_set_value_by_section(routeargs->routefwdsection, NULL, "route");
dmuci_set_value_by_section(routeargs->routefwdsection, NULL, "route"); //TODO test
}
else {
if (routeargs->type == ROUTE_DISABLED)
return 0;
dmuci_set_value_by_section(routeargs->routefwdsection, NULL, "route_disabled");
dmuci_set_value_by_section(routeargs->routefwdsection, NULL, "route_disabled"); //TODO test
}
return 0;
}

View file

@ -205,10 +205,9 @@ int add_wan_wanipconnection(struct dmctx *ctx, char **instancepara)
instance = get_last_instance_lev2("network", "interface", "conpinstance", "ifname", wandcdevargs->fwan);
sprintf(sname,"wan_%s_%s_%d_%s", wan_devices[wandcdevargs->index].instance, wandcdevargs->iwan, WAN_IP_CONNECTION, instance); //TODO ADD FUNCTION TO RENAME A SECTION"wan_""$idev""_$iwan""_$iproto""_$((++iconp))"
sprintf(ifname, "%s.1", wandcdevargs->fwan);
dmuci_add_section("network", "interface", &s, &value);
dmuci_rename_section_by_section(s, sname);
dmuci_set_value_by_section(s, "ifname", ifname);
dmuci_set_value_by_section(s, "proto", "dhcp");
dmuci_set_value("network", sname, NULL, "interface");
dmuci_set_value("network", sname, "ifname", ifname);
dmuci_set_value("network", sname, "proto", "dhcp");
*instancepara = update_instance(s, instance, "conpinstance");
return 0;
}
@ -257,13 +256,14 @@ int add_wan_wanpppconnection(struct dmctx *ctx, char **instancepara)
instance = get_last_instance_lev2("network", "interface", "conpinstance", "ifname", wandcdevargs->fwan);
sprintf(sname,"wan_%s_%s_%d_%s", wan_devices[wandcdevargs->index].instance, wandcdevargs->iwan, WANPPPConnection, instance); //TODO ADD FUNCTION TO RENAME A SECTION"wan_""$idev""_$iwan""_$iproto""_$((++iconp))"
sprintf(ifname, "%s.1", wandcdevargs->fwan);
dmuci_add_section("network", "interface", &s, &value);
dmuci_rename_section_by_section(s, sname);
dmuci_set_value_by_section(s, "ifname", ifname);
dmuci_set_value_by_section(s, "proto", "pppoe");
sprintf(ifname, "%s.1", wandcdevargs->fwan);
dmuci_set_value("network", sname, NULL, "interface");
dmuci_set_value("network", sname, "ifname", ifname);
dmuci_set_value("network", sname, "proto", "pppoe");
*instancepara = update_instance(s, instance, "conpinstance");
return 0;
}
int delete_wan_wanpppconnectiondevice_all(struct dmctx *ctx)
{
int found = 0;