FW3_OPT("auto_helper", bool, defaults, auto_helper),
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("__flags_v4", int, defaults, flags[0]),
FW3_OPT("__flags_v6", int, defaults, flags[1]),
}
}
+static void
+check_offloading(struct uci_element *e, bool *offloading)
+{
+ FILE *f;
+
+ if (!*offloading)
+ return;
+
+ f = fopen("/sys/module/xt_FLOWOFFLOAD/refcnt", "r");
+
+ if (f)
+ {
+ fclose(f);
+ return;
+ }
+
+ warn_elem(e, "enables offloading but missing kernel support, disabling");
+ *offloading = false;
+}
+
void
fw3_load_defaults(struct fw3_state *state, struct uci_package *p)
{
check_policy(e, &defs->policy_input, "input");
check_policy(e, &defs->policy_output, "output");
check_policy(e, &defs->policy_forward, "forward");
+
+ check_offloading(e, &defs->flow_offloading);
}
}
}
}
+ if (defs->flow_offloading)
+ {
+ r = fw3_ipt_rule_new(handle);
+ fw3_ipt_rule_extra(r, "-m conntrack --ctstate RELATED,ESTABLISHED");
+ fw3_ipt_rule_target(r, "FLOWOFFLOAD");
+ fw3_ipt_rule_append(r, "FORWARD");
+ }
+
for (i = 0; i < ARRAY_SIZE(chains); i += 2)
{
r = fw3_ipt_rule_new(handle);