IEEE1905: create ieee1905->forwarding_table section if it doesn't exist

This commit is contained in:
Amin Ben Ramdhane 2022-02-22 17:49:50 +01:00
parent c7ffc5afd4
commit be6a8fc69f

View file

@ -660,6 +660,7 @@ static int get_IEEE1905ALForwardingTable_SetForwardingEnabled(char *refparam, st
static int set_IEEE1905ALForwardingTable_SetForwardingEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) static int set_IEEE1905ALForwardingTable_SetForwardingEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{ {
int res = 0;
bool b; bool b;
switch (action) { switch (action) {
@ -669,7 +670,14 @@ static int set_IEEE1905ALForwardingTable_SetForwardingEnabled(char *refparam, st
break; break;
case VALUESET: case VALUESET:
string_to_bool(value, &b); string_to_bool(value, &b);
dmuci_set_value("ieee1905", "forwarding_table", "forwarding_enabled", b ? "1" : "0"); res = dmuci_set_value("ieee1905", "forwarding_table", "forwarding_enabled", b ? "1" : "0");
if (res) {
struct uci_section *s = NULL;
dmuci_add_section("ieee1905", "forwarding_table", &s);
dmuci_rename_section_by_section(s, "forwarding_table");
dmuci_set_value("ieee1905", "forwarding_table", "forwarding_enabled", b ? "1" : "0");
}
break; break;
} }
return 0; return 0;