diff --git a/libbbfdm/dmtree/tr181/firewall.c b/libbbfdm/dmtree/tr181/firewall.c index e6e81146..c71aeb1d 100644 --- a/libbbfdm/dmtree/tr181/firewall.c +++ b/libbbfdm/dmtree/tr181/firewall.c @@ -180,30 +180,24 @@ static void update_rule_order(const char *start_order, const char *stop_order, b dmuci_get_value_by_section_string(s, "order", &order); - if (DM_STRTOUL(order) >= DM_STRTOUL(start_order)) { + if ((DM_STRTOUL(order) >= DM_STRTOUL(start_order)) && (DM_STRTOUL(order) <= DM_STRTOUL(stop_order))) { char buf[8] = {0}; snprintf(buf, sizeof(buf), "%lu", incr ? (DM_STRTOUL(order) + 1) : (DM_STRTOUL(order) - 1)); dmuci_set_value_by_section(s, "order", buf); } - - if (DM_STRTOUL(order) == DM_STRTOUL(stop_order)) - return; } uci_path_foreach_sections(bbfdm, "dmmap_firewall", "rule", s) { dmuci_get_value_by_section_string(s, "order", &order); - if (DM_STRTOUL(order) >= DM_STRTOUL(start_order)) { + if ((DM_STRTOUL(order) >= DM_STRTOUL(start_order)) && (DM_STRTOUL(order) <= DM_STRTOUL(stop_order))) { char buf[8] = {0}; snprintf(buf, sizeof(buf), "%lu", incr ? (DM_STRTOUL(order) + 1) : (DM_STRTOUL(order) - 1)); dmuci_set_value_by_section(s, "order", buf); } - - if (DM_STRTOUL(order) == DM_STRTOUL(stop_order)) - return; } }