firewall3: clean up the flow table detection logic
authorRui Salvaterra <rsalvaterra@gmail.com>
Mon, 19 Oct 2020 16:11:10 +0000 (17:11 +0100)
committerRui Salvaterra <rsalvaterra@gmail.com>
Tue, 23 Mar 2021 09:18:33 +0000 (09:18 +0000)
We don't need an extra boolean.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
defaults.c

index bd4895861961bcdd1f948988747746916cb5a65d..7ad4fbae8439177f9b04f637ff9fa8c22f70e635 100644 (file)
@@ -91,8 +91,8 @@ check_target(struct uci_element *e, bool *available, const char *target, const b
        if (!b)
        {
                warn_elem(e, "requires unavailable target extension %s, disabling", target);
+               *available = false;
        }
-       *available = b;
 }
 
 static void
@@ -126,7 +126,6 @@ fw3_load_defaults(struct fw3_state *state, struct uci_package *p)
        struct uci_element *e;
        struct fw3_defaults *defs = &state->defaults;
 
-       bool flow_offload_avaliable = false;
        bool seen = false;
 
        defs->tcp_reject_code      = FW3_REJECT_CODE_TCP_RESET;
@@ -163,10 +162,7 @@ fw3_load_defaults(struct fw3_state *state, struct uci_package *p)
                check_any_reject_code(e, &defs->any_reject_code);
 
                /* exists in both ipv4 and ipv6, if at all, so only check ipv4 */
-               check_target(e, &flow_offload_avaliable, "FLOWOFFLOAD", false);
-
-               if (!flow_offload_avaliable)
-                       defs->flow_offloading = false;
+               check_target(e, &defs->flow_offloading, "FLOWOFFLOAD", false);
        }
 }