diff mbox series

[v2,firewall3] zones: apply tcp mss clamping also on ingress path

Message ID 20200724045259.80377-1-yszhou4tech@gmail.com
State Accepted
Headers show
Series [v2,firewall3] zones: apply tcp mss clamping also on ingress path | expand

Commit Message

Yousong Zhou July 24, 2020, 4:52 a.m. UTC
Fixes FS#3231

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
 zones.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Jo-Philipp Wich July 24, 2020, 7:59 a.m. UTC | #1
Hi,

> Fixes FS#3231
> 
> Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>

Acked-by: Jo-Philipp Wich <jo@mein.io>
Baptiste Jonglez July 24, 2020, 3:41 p.m. UTC | #2
Hi,

On 24-07-20, Yousong Zhou wrote:
> Fixes FS#3231

It looks like this bug also affects 18.06 and 19.07, so the fix should
probably be backported.

Baptiste

> Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
> ---
>  zones.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/zones.c b/zones.c
> index 68b02ab..d45077a 100644
> --- 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)
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Yousong Zhou July 27, 2020, 2:27 a.m. UTC | #3
On Fri, 24 Jul 2020 at 23:41, Baptiste Jonglez
<baptiste@bitsofnetworks.org> wrote:
>
> Hi,
>
> On 24-07-20, Yousong Zhou wrote:
> > Fixes FS#3231
>
> It looks like this bug also affects 18.06 and 19.07, so the fix should
> probably be backported.
>

Done.  For the record, i backported it as patch file and bumping
PKG_RELEASE, instead of e.g. bumping PKG_SOURCE_VERSION.

Regards,
                yousong

> Baptiste
>
> > Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
> > ---
> >  zones.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/zones.c b/zones.c
> > index 68b02ab..d45077a 100644
> > --- 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)
> >
> > _______________________________________________
> > openwrt-devel mailing list
> > openwrt-devel@lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
diff mbox series

Patch

diff --git a/zones.c b/zones.c
index 68b02ab..d45077a 100644
--- 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)