zones: apply tcp mss clamping also on ingress path
authorYousong Zhou <yszhou4tech@gmail.com>
Fri, 24 Jul 2020 04:52:59 +0000 (12:52 +0800)
committerYousong Zhou <yszhou4tech@gmail.com>
Sat, 25 Jul 2020 00:54:12 +0000 (08:54 +0800)
Fixes FS#3231

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Acked-by: Jo-Philipp Wich <jo@mein.io>
zones.c

diff --git a/zones.c b/zones.c
index 68b02abed6a96da98201f51f3935f51394a21870..d45077af615abde04781928f35e4e377e7505b13 100644 (file)
--- a/zones.c
+++ b/zones.c
@@ -580,6 +580,14 @@ print_interface_rule(struct fw3_ipt_handle *handle, struct fw3_state *state,
                        fw3_ipt_rule_target(r, "TCPMSS");
                        fw3_ipt_rule_addarg(r, false, "--clamp-mss-to-pmtu", NULL);
                        fw3_ipt_rule_replace(r, "FORWARD");
+
+                       r = fw3_ipt_rule_create(handle, &tcp, dev, NULL, sub, NULL);
+                       fw3_ipt_rule_addarg(r, false, "--tcp-flags", "SYN,RST");
+                       fw3_ipt_rule_addarg(r, false, "SYN", NULL);
+                       fw3_ipt_rule_comment(r, "Zone %s MTU fixing", zone->name);
+                       fw3_ipt_rule_target(r, "TCPMSS");
+                       fw3_ipt_rule_addarg(r, false, "--clamp-mss-to-pmtu", NULL);
+                       fw3_ipt_rule_replace(r, "FORWARD");
                }
        }
        else if (handle->table == FW3_TABLE_RAW)