From 7a7c01fec7c5fca2e14cb8e229bf016039cf29ce Mon Sep 17 00:00:00 2001 From: Amin Ben Ramdhane Date: Fri, 15 Jan 2021 11:42:04 +0100 Subject: [PATCH] Revert "Firewall: set SourceAllInterfaces and DestAllInterfaces => do nothing if the current value is equal to the settable value" This reverts commit ccecc9cd28aaa459921a037a1e2445ee77f4ffb9. --- dmtree/tr181/firewall.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/dmtree/tr181/firewall.c b/dmtree/tr181/firewall.c index a917433d..581a1f63 100644 --- a/dmtree/tr181/firewall.c +++ b/dmtree/tr181/firewall.c @@ -959,16 +959,12 @@ static int set_rule_source_all_interfaces(char *refparam, struct dmctx *ctx, voi return FAULT_9007; break; case VALUESET: - string_to_bool(value, &b); - - // Get the current 'src' option - dmuci_get_value_by_section_string((struct uci_section *)data, "src", &src); - - if ((b && strcmp(src, "*") == 0) || (!b && strcmp(src, "*") != 0)) - break; - get_dmmap_section_of_config_section("dmmap_firewall", "rule", section_name((struct uci_section *)data), &dmmap_section); + string_to_bool(value, &b); if (b) { + // Get the current 'src' option + dmuci_get_value_by_section_string((struct uci_section *)data, "src", &src); + // Save 'src' option in the associated dmmap rule section dmuci_set_value_by_section(dmmap_section, "src", src); @@ -1032,16 +1028,12 @@ static int set_rule_dest_all_interfaces(char *refparam, struct dmctx *ctx, void return FAULT_9007; break; case VALUESET: - string_to_bool(value, &b); - - // Get the current 'dest' option - dmuci_get_value_by_section_string((struct uci_section *)data, "dest", &dest); - - if ((b && strcmp(dest, "*") == 0) || (!b && strcmp(dest, "*") != 0)) - break; - get_dmmap_section_of_config_section("dmmap_firewall", "rule", section_name((struct uci_section *)data), &dmmap_section); + string_to_bool(value, &b); if (b) { + // Get the current 'dest' option + dmuci_get_value_by_section_string((struct uci_section *)data, "dest", &dest); + // Save 'dest' option in the associated dmmap rule section dmuci_set_value_by_section(dmmap_section, "dest", dest);