From patchwork Fri Jul 24 04:52:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1335319 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=Vw/r7O6Y; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=GqHwZAXJ; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BCcMt5mBcz9sRK for ; Fri, 24 Jul 2020 14:55:38 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=kIAQGAiHmyGvrgrFh0xWv8MS97OAntG2iu6eD53rXMs=; b=Vw/r7O6YtRRfKBwm8T9jXuI+Be oxguH42WMD+nrxHwBB6+8vC6TsJSowiiIH3dopk+YboJN9yGk7TrjT4Hd/BWYcBxCkhE+YZy3ZUUd suQjx0EJMllxDZMxzttMShUtsGRxZeAL7dWbTzxpCdTezQ6wVFFOGeQZpaKg47/NSxEgY4bX4DrCB yQQI8s5ByqOm4tPfVXnD6mEXAfHXPtl0JcdSwl6PNJweV/a3K3RjYr1CjmFbAUQ9qYw3iQSN/GVuI d33Q3H+a4hocJd9eoCHTQcEfSzWx/hWCQRXvpRha8uaw+LzchH+wpLOgHs8gKwzdxZ6IvifjoWnsF O/JTXJWw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyphz-0005FT-QW; Fri, 24 Jul 2020 04:53:23 +0000 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyphx-0005F7-5H for openwrt-devel@lists.openwrt.org; Fri, 24 Jul 2020 04:53:21 +0000 Received: by mail-pj1-x1041.google.com with SMTP id a9so4585044pjd.3 for ; Thu, 23 Jul 2020 21:53:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qD43BePOjBa49P3JBdoGqNyQjDipfOA0DM4Z/bKTlZA=; b=GqHwZAXJqZmU4BHLg83LlBH4By3OTTu3UYiGSWH1QKSK5AVSVaWsVL5g6Oc3WGMC+2 wiixgraBUGShcNY8LpZlzjU+eSs7/cRoMyCr1B45dL3GuNNNOcYhjaMzf6V1vd413Z3X cYSsBPtFDuOF/qbCs5Mf1zdvKo0bPeCXWlFserZD7ygTW+xH76bgOatjxXqM77Vpwi1E vHc+NdVGmrbKr4UCvBu1if41Ao0U3Vy2hYUXo4dD+zsXJKbVzb8+EDygWJBsL8UJWt00 8YmUg05fbZBmQQpsejncfQUcBtqGCyaTAZ8Ay6gO5RvtJEBioNlUO3uaPc+IogO1oH9T tq4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qD43BePOjBa49P3JBdoGqNyQjDipfOA0DM4Z/bKTlZA=; b=pC9J/AmOPdOAsAV9SuBzTEJ8Vyjd2gb4xQ+km021l1FJtk2MXjV8Nmd05SHK7VUieW yU1D6OTwUchSDm2czgg0ZrA0FPbFqhOKbW1wDrxNBKj/le85ttV/e0LZ3EuFOZ3zjtDN 7INUWtcjm7jcM8q+gLD9JEauCVM//KpWCQpAg/bGmkS8XkgILCw4LrfTLpptYx5XnWjA TmJrZr3ANagxniIthJ5TAdgJQ6So+xKz4e/5Qrq5+BjXAEZUka36uGJNBVmLbSWdpTMm erc9obUn1HnWetCXgoKS1GCjQz3gVGGkSqWxqURq5yqBszXiOpj/moIEjxuKqz60iZNN bzcw== X-Gm-Message-State: AOAM533GKefNW1Kggta/zT+M8c0aWsFE/J2XG5aGG3Z/iYYxl3u5vkf9 X64YA2zGFKU3j0AFwJRvgC4= X-Google-Smtp-Source: ABdhPJwSqPLjVGUifZKD9CK0ThcRs9QxaQC/Rr18aBVK09dSMCp1vv5oJFPax7mXYX6PEOsLk4st0A== X-Received: by 2002:a17:902:7149:: with SMTP id u9mr6929531plm.84.1595566397435; Thu, 23 Jul 2020 21:53:17 -0700 (PDT) Received: from titan.office.yunion.io ([47.244.19.249]) by smtp.gmail.com with ESMTPSA id f3sm4212169pju.54.2020.07.23.21.53.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jul 2020 21:53:16 -0700 (PDT) From: Yousong Zhou To: jo@mein.io Subject: [PATCH v2 firewall3] zones: apply tcp mss clamping also on ingress path Date: Fri, 24 Jul 2020 12:52:59 +0800 Message-Id: <20200724045259.80377-1-yszhou4tech@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200724_005321_231325_92E7ABA0 X-CRM114-Status: UNSURE ( 6.15 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1041 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [yszhou4tech[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yousong Zhou , openwrt-devel@lists.openwrt.org Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Fixes FS#3231 Signed-off-by: Yousong Zhou Acked-by: Jo-Philipp Wich --- 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)