From f87d0b0f607420424cfcb4ff5a376d7659fa5b6b Mon Sep 17 00:00:00 2001 From: WangYanlong Date: Fri, 13 Mar 2020 12:29:27 +0000 Subject: [PATCH] firewall3: defaults: fix uci flow_offloading option Fixes 7cc2a84 ("defaults: robustify flow table detection.") 7cc2a84 made disabling flow_offloading impossible. This is to fix the buggy behavior. Signed-off-by: Yanlong Wang [move variable declaration to the top, remove braces from conditional] Signed-off-by: Jo-Philipp Wich --- defaults.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/defaults.c b/defaults.c index c78ab51..60a4c81 100644 --- a/defaults.c +++ b/defaults.c @@ -126,6 +126,7 @@ 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; @@ -160,7 +161,10 @@ 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, &defs->flow_offloading, "FLOWOFFLOAD", false); + check_target(e, &flow_offload_avaliable, "FLOWOFFLOAD", false); + + if (!flow_offload_avaliable) + defs->flow_offloading = false; } } -- 2.25.1