defaults: add support for setting --hw on the xt_FLOWOFFLOAD rule
authorFelix Fietkau <nbd@nbd.name>
Thu, 5 Apr 2018 12:44:40 +0000 (14:44 +0200)
committerFelix Fietkau <nbd@nbd.name>
Thu, 5 Apr 2018 12:44:43 +0000 (14:44 +0200)
Enables hardware offload support where supported

Signed-off-by: Felix Fietkau <nbd@nbd.name>
defaults.c
options.h

index 81f439e447a5afff1c71108e7facf9d62db813dc..11fbf0dd8f74a51e4b2d95fd0bb7e742d65cd8f4 100644 (file)
@@ -58,6 +58,7 @@ const struct fw3_option fw3_flag_opts[] = {
        FW3_OPT("custom_chains",       bool,     defaults, custom_chains),
        FW3_OPT("disable_ipv6",        bool,     defaults, disable_ipv6),
        FW3_OPT("flow_offloading",     bool,     defaults, flow_offloading),
+       FW3_OPT("flow_offloading_hw",  bool,     defaults, flow_offloading_hw),
 
        FW3_OPT("__flags_v4",          int,      defaults, flags[0]),
        FW3_OPT("__flags_v6",          int,      defaults, flags[1]),
@@ -236,6 +237,8 @@ fw3_print_default_head_rules(struct fw3_ipt_handle *handle,
                        fw3_ipt_rule_comment(r, "Traffic offloading");
                        fw3_ipt_rule_extra(r, "-m conntrack --ctstate RELATED,ESTABLISHED");
                        fw3_ipt_rule_target(r, "FLOWOFFLOAD");
+                       if (defs->flow_offloading_hw)
+                               fw3_ipt_rule_addarg(r, false, "--hw", NULL);
                        fw3_ipt_rule_append(r, "FORWARD");
                }
 
index dcce64425b96ab715f2e829c59ff83f28e366e13..15cd504faef277c120a040f050912653868c7de1 100644 (file)
--- a/options.h
+++ b/options.h
@@ -290,6 +290,7 @@ struct fw3_defaults
        bool custom_chains;
        bool auto_helper;
        bool flow_offloading;
+       bool flow_offloading_hw;
 
        bool disable_ipv6;