firewall3: add UBUS support for redirect sections
[project/firewall3.git] / forwards.c
index c610247..9b369f3 100644 (file)
@@ -38,7 +38,6 @@ fw3_load_forwards(struct fw3_state *state, struct uci_package *p)
        struct uci_section *s;
        struct uci_element *e;
        struct fw3_forward *forward;
-       bool changed;
 
        INIT_LIST_HEAD(&state->forwards);
 
@@ -55,7 +54,8 @@ fw3_load_forwards(struct fw3_state *state, struct uci_package *p)
 
                forward->enabled = true;
 
-               fw3_parse_options(forward, fw3_forward_opts, s);
+               if (!fw3_parse_options(forward, fw3_forward_opts, s))
+                       warn_elem(e, "has invalid options");
 
                if (!forward->enabled)
                {
@@ -88,30 +88,15 @@ fw3_load_forwards(struct fw3_state *state, struct uci_package *p)
                continue;
        }
 
-       /* Propagate conntrack requirement flag into all zones connected through
-          forwarding entries and repeat until all zones are normalized */
-       do {
-               changed = false;
-
-               list_for_each_entry(forward, &state->forwards, list)
+       list_for_each_entry(forward, &state->forwards, list)
+       {
+               /* NB: forward family... */
+               if (forward->_dest)
                {
-                       /* NB: forward family... */
-                       if (forward->_dest)
-                       {
-                               fw3_setbit(forward->_dest->flags[0], FW3_FLAG_ACCEPT);
-                               fw3_setbit(forward->_dest->flags[1], FW3_FLAG_ACCEPT);
-
-                               if (forward->_src &&
-                                   (forward->_src->conntrack != forward->_dest->conntrack))
-                               {
-                                       forward->_src->conntrack = true;
-                                       forward->_dest->conntrack = true;
-                                       changed = true;
-                               }
-                       }
+                       fw3_setbit(forward->_dest->flags[0], FW3_FLAG_ACCEPT);
+                       fw3_setbit(forward->_dest->flags[1], FW3_FLAG_ACCEPT);
                }
        }
-       while (changed);
 }