Added fix for Device.Firewall.Chain.{i}.Rule.{i}.Order re-ordering issue

This commit is contained in:
Ratish 2023-07-07 14:28:17 +00:00 committed by Amin Ben Romdhane
parent 8dbbaa8f3c
commit 5b43e378e7

View file

@ -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;
}
}