From patchwork Thu Nov 24 11:24:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: LiXiong Liu X-Patchwork-Id: 1708652 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=yeGA0v86; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NHwjS6pQrz23nR for ; Thu, 24 Nov 2022 22:28:28 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:To: From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=U6soAWpNDi55rTeFtGO1CZpp1EhyBDWqGxjf8WGNM5c=; b=yeGA0v86/YnZJg Ol0rRGXeKw1KaJg+zhS9JjVbA75iG7FZhnySx2E7MySD9B94tycxHCBWdMnZXzGA+xOZKcVMb6wkA 4cbPpN5V5XaFcoM3rC4k7foaKLhp8NxNnA58UfJfiYfB4ZRJxlbqIWuZFhTXXadhEJsLgjdz4jzY5 u7knmlvFqaXTXLmxTaMVVd9eOxWN43jZMRr9SVl5tgBGIJDXvcPAeS1kF+PBlmSDdV0zCnkyldwrJ JDUA2dAwh6SgQwNJ2amLXI/+HVW06sxEt9Jai5+2LBwA5Wtu06SU1JRnhBrF/CrURKEIQvxeES/XG CkkDavPgW8Xm9886jSWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyALf-0082hF-Se; Thu, 24 Nov 2022 11:24:57 +0000 Received: from smtpbgsg1.qq.com ([54.254.200.92]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyALV-0082Qo-JU for openwrt-devel@lists.openwrt.org; Thu, 24 Nov 2022 11:24:47 +0000 X-QQ-mid: bizesmtp62t1669289058tgvax8ks Received: from ikuai8.com ( [114.241.221.187]) by bizesmtp.qq.com (ESMTP) with SMTP id 0 for ; Thu, 24 Nov 2022 19:24:17 +0800 (CST) X-QQ-SSF: 01400000002000W0Z000B00A0000000 X-QQ-FEAT: hP8KuKYkBUtaLsfUPlz3DVQseZQ1Sw6szpiE8qgSGPuaVn9B+6Ls72ewEOV64 SzPqFZ+WZrTcuJk8Iv7K8L+aYDSs4EQwCz/pApXEjSD2zSVqRzUWwNEO6jurv66jPa/+IC2 yf4NYt35WRU/KZhSU+Bc1Y+ujDBfT6OWtfSk2dMm3H4EOHDpSh+6x1TFLHkJzlmeVrVNaQ4 WDVX7jTZ5DlY+Jp9etoj/Te4pI+hB/Z79vN4En+0fwcpT6mtUQCSfXaHjActfMCSgCFewDo OsSg+m+0XuMqzlcQ5N+oiKHJQRlyvIl9KrFhpj5ytbD5E97hor+YBzflqgEOkmzr9Q7+DAk bqmj6VmfiujgW96ufSohqYpLo5+dJ7pzIguuvlb6mijHi+IpEMivWKrCgMyVqd3T1ib/vF1 X-QQ-GoodBg: 2 From: LiXiong Liu To: openwrt-devel@lists.openwrt.org Subject: [PATCH-22.03 1/4] kernel: fix flowtable pppoe header offset bug Date: Thu, 24 Nov 2022 19:24:05 +0800 Message-Id: <1669289048-51420-1-git-send-email-lxliu@ikuai8.com> X-Mailer: git-send-email 2.7.4 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:ikuai8.com:qybglogicsvr:qybglogicsvr7 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221124_032446_049410_91095399 X-CRM114-Status: UNSURE ( 7.46 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Signed-off-by: LiXiong Liu --- .../706-01-netfilter-flowtable-fix-pppoe-header-offset.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 target/linux/generic [...] Content analysis details: (-0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [54.254.200.92 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [54.254.200.92 listed in wl.mailspike.net] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Signed-off-by: LiXiong Liu --- .../706-01-netfilter-flowtable-fix-pppoe-header-offset.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 target/linux/generic/pending-5.10/706-01-netfilter-flowtable-fix-pppoe-header-offset.patch diff --git a/target/linux/generic/pending-5.10/706-01-netfilter-flowtable-fix-pppoe-header-offset.patch b/target/linux/generic/pending-5.10/706-01-netfilter-flowtable-fix-pppoe-header-offset.patch new file mode 100644 index 0000000..97767d7 --- /dev/null +++ b/target/linux/generic/pending-5.10/706-01-netfilter-flowtable-fix-pppoe-header-offset.patch @@ -0,0 +1,11 @@ +--- a/netfilter/nf_flow_table_ip.c ++++ b/netfilter/nf_flow_table_ip.c +@@ -158,7 +158,7 @@ static void nf_flow_tuple_encap(struct s + tuple->encap[i].proto = skb->protocol; + break; + case htons(ETH_P_PPP_SES): +- phdr = (struct pppoe_hdr *)skb_mac_header(skb); ++ phdr = (struct pppoe_hdr *)(skb_mac_header(skb) + ETH_HLEN); + tuple->encap[i].id = ntohs(phdr->sid); + tuple->encap[i].proto = skb->protocol; + break; From patchwork Thu Nov 24 11:24:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: LiXiong Liu X-Patchwork-Id: 1708651 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=pi8tgx1i; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NHwjS75JHz23nT for ; Thu, 24 Nov 2022 22:28:28 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MHLT9+XH7NeFzKmVFsfpzUcrb8DKAPukMSRjMU2ER8Y=; b=pi8tgx1igXVGZt lHStbxi3V+Thaw87Q7owMR+ldHsViXYqj4O9fz+4G9/BUg4YUO18CT/hJsqIwAI8pwzrCd+jnx9Zi vrmO37ge2ackTOL11JKknUQvOZo36o99i8QBj4u8UYdr39dEGa+vUc3hU8hIYS3a1OvoXkhbdBUTZ o1CZLZqkAjTs2hyYa2T6MRET4+a5/nqXQytp2tP1UGL0iF1sFpPhBgc68rZTaX2WVpoeaoeC41rJY WzhT/r4egNbHRfb9EWRIG9WUyzArXlYJPD2zeRFUAG/HaW4kvTlOmDfcTYAKtCVJnJnWiqscMBPUE /vHglsc/HvfDQtfDnwPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyALz-0082qz-Uz; Thu, 24 Nov 2022 11:25:20 +0000 Received: from smtpbguseast2.qq.com ([54.204.34.130]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyALX-0082Rg-VM for openwrt-devel@lists.openwrt.org; Thu, 24 Nov 2022 11:24:50 +0000 X-QQ-mid: bizesmtp62t1669289060tzliipny Received: from ikuai8.com ( [114.241.221.187]) by bizesmtp.qq.com (ESMTP) with SMTP id 0 for ; Thu, 24 Nov 2022 19:24:20 +0800 (CST) X-QQ-SSF: 01400000002000W0Z000B00A0000000 X-QQ-FEAT: FFYcggotwZFACoWeKWCNbL4fb04pB5CDshT6LWu0DrwRy5yQHyr0wOhZKUUMY g3wdnhT5qgezYmdNYcN89r8YZov8m8Rf+ZopsAt90Wa5zxKp4eMQ9iDclANLaTdlsSP39eK S+CDFubiLel89GWrbc/4KlGZp3kRp1ACORMq/sbzOBzygw3/RyXxDzRH+HEKgQQaMl5CnrO u8hXAAbCDPm/wpOOqOXjGFmoGI2ojTRw10lxy1rCnlcz2ZQ67/NYw3u5xnwWPlE820Rqw7U RzBuR8shGJaqJouBCf95WS9iMu2WNWq7eWlIA8RUww0+NRAZtXjBeCzh/O9SfQ04usDN5d3 HTXx1YIy9sqE06vylDxAcYgXlfeB7zLVizS7nRTfuFafFPMpmat6yUAwgE5ETrLR7NzCmiy L+KmoMnlzqgDKAdjXem94w== X-QQ-GoodBg: 2 From: LiXiong Liu To: openwrt-devel@lists.openwrt.org Subject: [PATCH-22.03 2/4] kernel: support more encap for flowtable Date: Thu, 24 Nov 2022 19:24:06 +0800 Message-Id: <1669289048-51420-2-git-send-email-lxliu@ikuai8.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1669289048-51420-1-git-send-email-lxliu@ikuai8.com> References: <1669289048-51420-1-git-send-email-lxliu@ikuai8.com> X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:ikuai8.com:qybglogicsvr:qybglogicsvr7 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221124_032448_568756_1FB84461 X-CRM114-Status: UNSURE ( 8.89 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Some need use 8021q + 8021q + pppoe, The current encap number cannot meet the demand. Signed-off-by: LiXiong Liu --- ...02-netfilter-flowtable-support-more-encap.patch | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 target/linux/generi [...] Content analysis details: (-0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [54.204.34.130 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [54.204.34.130 listed in wl.mailspike.net] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Some need use 8021q + 8021q + pppoe, The current encap number cannot meet the demand. Signed-off-by: LiXiong Liu --- ...02-netfilter-flowtable-support-more-encap.patch | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 target/linux/generic/pending-5.10/706-02-netfilter-flowtable-support-more-encap.patch diff --git a/target/linux/generic/pending-5.10/706-02-netfilter-flowtable-support-more-encap.patch b/target/linux/generic/pending-5.10/706-02-netfilter-flowtable-support-more-encap.patch new file mode 100644 index 0000000..2216a2b --- /dev/null +++ b/target/linux/generic/pending-5.10/706-02-netfilter-flowtable-support-more-encap.patch @@ -0,0 +1,24 @@ +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -882,8 +882,8 @@ struct net_device_path { + }; + }; + +-#define NET_DEVICE_PATH_STACK_MAX 5 +-#define NET_DEVICE_PATH_VLAN_MAX 2 ++#define NET_DEVICE_PATH_STACK_MAX 8 ++#define NET_DEVICE_PATH_VLAN_MAX 3 + + struct net_device_path_stack { + int num_paths; +--- a/include/net/netfilter/nf_flow_table.h ++++ b/include/net/netfilter/nf_flow_table.h +@@ -96,7 +96,7 @@ enum flow_offload_xmit_type { + FLOW_OFFLOAD_XMIT_DIRECT, + }; + +-#define NF_FLOW_TABLE_ENCAP_MAX 2 ++#define NF_FLOW_TABLE_ENCAP_MAX 3 + + struct flow_offload_tuple { + union { From patchwork Thu Nov 24 11:24:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: LiXiong Liu X-Patchwork-Id: 1708654 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=cd4Q2WUm; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NHwjf487kz23nR for ; Thu, 24 Nov 2022 22:28:38 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WZ/LsYQRyt2juGrwtMEi0vl6zPvKcpNsjKr8e6r4FCE=; b=cd4Q2WUmZfahCy Vd0ChDfim6qgmC5fFE0MUtE2UutfbKu3EdGO6ghaSbHkpkrZmY0ozU4Kw7PKwz9LUIlq7fSw+Aq1c RKp+XOeFKwjzW5E/mjcjYpECwLe3ik00d9AnCX2grGvxRVLqZCJoRaTvyLls0uzK0nigu8q/0D0Hi ARIVGL1LRouvgamd2ZymPatfx3FCmrGwU9BYIiCMPHQLU1RSFGZ7w8qnccffU8I7MxRESs4/pvXLG Ty/GqSqH41mhlwVRHFL6Peb6/VvnkW6gY3ywKHeO4N0LvfLaesUJqJFtYutzVR6DRWDuuVZQfCR6q xJ2Ah638xL60O64xvKEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyAMm-0083A3-3y; Thu, 24 Nov 2022 11:26:04 +0000 Received: from smtpbgau2.qq.com ([54.206.34.216]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyALc-0082TI-E2 for openwrt-devel@lists.openwrt.org; Thu, 24 Nov 2022 11:24:56 +0000 X-QQ-mid: bizesmtp62t1669289062tozr2sgs Received: from ikuai8.com ( [114.241.221.187]) by bizesmtp.qq.com (ESMTP) with SMTP id 0 for ; Thu, 24 Nov 2022 19:24:22 +0800 (CST) X-QQ-SSF: 01400000002000W0Z000B00A0000000 X-QQ-FEAT: CR3LFp2JE4kOhbLTvHvBu+NukQaBOtNPX/UmtpUJpZDbuXISMv1HnVAFB7r8L jJAVVnZ+v4PzK9gRJtopEuJaLck0Emu/lpXc5BjJeUHXjpT0ytvK0SpMncZ2FgxHMy00Mw5 VRAyz1PvISV4VXvpX9Wbc/Fmg+LLSd5iL59uZsVUMoHz3iZxyRZOm80AAvnDNPfdpeWpblb Pz489lxjEKZogsESbUz9YSv1/7JG8eEgMyPFq9wMpe6qxoh7dayRmFtKx5s7j2KO53AQPKP k4zrjTGUttXL0+Z8QAxj9YeeYh4dGankn4DicMCCT2NgUqVPogE6hTcsQ46nowJVmG6d+Nh TjrLaVwX3esBzmqWg2B9E9BQN9Z74kqBAk8RwCgtSTM16+KJEfw1I1ytp/1Ti4oMGiNXrxu jHK98E3g3a+CU1BZwAooXQ== X-QQ-GoodBg: 2 From: LiXiong Liu To: openwrt-devel@lists.openwrt.org Subject: [PATCH-22.03 3/4] kernel: support nf_flow_encap_put and more encap Date: Thu, 24 Nov 2022 19:24:07 +0800 Message-Id: <1669289048-51420-3-git-send-email-lxliu@ikuai8.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1669289048-51420-1-git-send-email-lxliu@ikuai8.com> References: <1669289048-51420-1-git-send-email-lxliu@ikuai8.com> X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:ikuai8.com:qybglogicsvr:qybglogicsvr7 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221124_032453_147627_130F2F29 X-CRM114-Status: GOOD ( 12.53 ) X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Support (8021q + 8021q + pppoe) encap tuple. We need encap put to skb Before dev_hard_header(). Signed-off-by: LiXiong Liu --- ...ilter-flowtable-support-nf_flow_encap_put.patch | 157 +++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 target/linux/gener [...] Content analysis details: (-0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [54.206.34.216 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [54.206.34.216 listed in wl.mailspike.net] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Support (8021q + 8021q + pppoe) encap tuple. We need encap put to skb Before dev_hard_header(). Signed-off-by: LiXiong Liu --- ...ilter-flowtable-support-nf_flow_encap_put.patch | 157 +++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 target/linux/generic/pending-5.10/706-03-netfilter-flowtable-support-nf_flow_encap_put.patch diff --git a/target/linux/generic/pending-5.10/706-03-netfilter-flowtable-support-nf_flow_encap_put.patch b/target/linux/generic/pending-5.10/706-03-netfilter-flowtable-support-nf_flow_encap_put.patch new file mode 100644 index 0000000..545a956 --- /dev/null +++ b/target/linux/generic/pending-5.10/706-03-netfilter-flowtable-support-nf_flow_encap_put.patch @@ -0,0 +1,157 @@ +--- a/net/netfilter/nf_flow_table_ip.c ++++ b/net/netfilter/nf_flow_table_ip.c +@@ -145,6 +145,7 @@ static void nf_flow_tuple_encap(struct s + struct vlan_ethhdr *veth; + struct pppoe_hdr *phdr; + int i = 0; ++ __be16 *proto_ptr; + + if (skb_vlan_tag_present(skb)) { + tuple->encap[i].id = skb_vlan_tag_get(skb); +@@ -156,6 +157,17 @@ static void nf_flow_tuple_encap(struct s + veth = (struct vlan_ethhdr *)skb_mac_header(skb); + tuple->encap[i].id = ntohs(veth->h_vlan_TCI); + tuple->encap[i].proto = skb->protocol; ++ i++; ++ ++ proto_ptr = &veth->h_vlan_encapsulated_proto; ++ if (*proto_ptr == htons(ETH_P_8021Q)) { ++ tuple->encap[i].id = ntohs(*(proto_ptr + 1)); ++ tuple->encap[i].proto = htons(ETH_P_8021Q); ++ } else if (*proto_ptr == htons(ETH_P_PPP_SES)) { ++ phdr = (struct pppoe_hdr *)(skb_mac_header(skb) + ETH_HLEN + VLAN_HLEN); ++ tuple->encap[i].id = ntohs(phdr->sid); ++ tuple->encap[i].proto = htons(ETH_P_PPP_SES); ++ } + break; + case htons(ETH_P_PPP_SES): + phdr = (struct pppoe_hdr *)(skb_mac_header(skb) + ETH_HLEN); +@@ -248,11 +260,11 @@ static unsigned int nf_flow_xmit_xfrm(st + return NF_STOLEN; + } + +-static inline __be16 nf_flow_pppoe_proto(const struct sk_buff *skb) ++static inline __be16 nf_flow_pppoe_proto(const struct sk_buff *skb, u32 offset) + { + __be16 proto; + +- proto = *((__be16 *)(skb_mac_header(skb) + ETH_HLEN + ++ proto = *((__be16 *)(skb_mac_header(skb) + ETH_HLEN + offset + + sizeof(struct pppoe_hdr))); + switch (proto) { + case htons(PPP_IP): +@@ -268,17 +280,29 @@ static bool nf_flow_skb_encap_protocol(c + u32 *offset) + { + struct vlan_ethhdr *veth; ++ __be16 *proto_ptr; + + switch (skb->protocol) { + case htons(ETH_P_8021Q): + veth = (struct vlan_ethhdr *)skb_mac_header(skb); +- if (veth->h_vlan_encapsulated_proto == proto) { ++ proto_ptr = &veth->h_vlan_encapsulated_proto; ++ *offset += VLAN_HLEN; ++ ++ if (*proto_ptr == htons(ETH_P_PPP_SES)) ++ goto pppoe; ++ ++ if (*proto_ptr == htons(ETH_P_8021Q)) { + *offset += VLAN_HLEN; +- return true; ++ proto_ptr += 2; + } ++ ++ if (*proto_ptr == proto) ++ return true; ++ + break; + case htons(ETH_P_PPP_SES): +- if (nf_flow_pppoe_proto(skb) == proto) { ++pppoe: ++ if (nf_flow_pppoe_proto(skb, *offset) == proto) { + *offset += PPPOE_SES_HLEN; + return true; + } +@@ -307,7 +331,7 @@ static void nf_flow_encap_pop(struct sk_ + skb_reset_network_header(skb); + break; + case htons(ETH_P_PPP_SES): +- skb->protocol = nf_flow_pppoe_proto(skb); ++ skb->protocol = nf_flow_pppoe_proto(skb, 0); + skb_pull(skb, PPPOE_SES_HLEN); + skb_reset_network_header(skb); + break; +@@ -315,6 +339,62 @@ static void nf_flow_encap_pop(struct sk_ + } + } + ++static int nf_flow_encap_put(struct sk_buff *skb, unsigned short *type, ++ struct flow_offload_tuple_rhash *tuplehash) ++{ ++ struct vlan_hdr *vlan_hdr = NULL; ++ struct pppoe_hdr *ph; ++ struct pppoe_tag *pt; ++ u16 data_len = skb->len; ++ int i; ++ ++ if ((skb->data - PPPOE_SES_HLEN - VLAN_HLEN * 2) < skb->head) ++ if (skb_cow_head(skb, LL_RESERVED_SPACE(skb->dev) + ++ PPPOE_SES_HLEN + VLAN_HLEN * 2)) ++ return -1; ++ ++ /* Offset the pointer in the reverse direction */ ++ tuplehash = (tuplehash->tuple.dir) ? (tuplehash - 1) : (tuplehash + 1); ++ for (i = tuplehash->tuple.encap_num - 1; i >= 0; i--) { ++ switch (tuplehash->tuple.encap[i].proto) { ++ case htons(ETH_P_8021Q): ++ vlan_hdr = __skb_push(skb, VLAN_HLEN); ++ vlan_hdr->h_vlan_TCI = htons(tuplehash->tuple.encap[i].id); ++ vlan_hdr->h_vlan_encapsulated_proto = htons(*type); ++ ++ skb->protocol = htons(ETH_P_8021Q); ++ *type = ETH_P_8021Q; ++ break; ++ case htons(ETH_P_PPP_SES): ++ __skb_push(skb, PPPOE_SES_HLEN); ++ skb_reset_network_header(skb); ++ ++ ph = pppoe_hdr(skb); ++ pt = ph->tag; ++ ph->ver = 1; ++ ph->type = 1; ++ ph->code = 0; ++ ph->sid = htons(tuplehash->tuple.encap[i].id); ++ ph->length = htons(data_len+2); ++ ++ switch (*type) { ++ case ETH_P_IP: ++ pt->tag_type = htons(PPP_IP); ++ break; ++ case ETH_P_IPV6: ++ pt->tag_type = htons(PPP_IPV6); ++ break; ++ } ++ ++ skb->protocol = htons(ETH_P_PPP_SES); ++ *type = ETH_P_PPP_SES; ++ break; ++ } ++ } ++ ++ return 0; ++} ++ + static unsigned int nf_flow_queue_xmit(struct net *net, struct sk_buff *skb, + const struct flow_offload_tuple_rhash *tuplehash, + unsigned short type) +@@ -326,6 +406,9 @@ static unsigned int nf_flow_queue_xmit(s + return NF_DROP; + + skb->dev = outdev; ++ if (nf_flow_encap_put(skb, &type, (void *)tuplehash)) ++ return NF_DROP; ++ + dev_hard_header(skb, skb->dev, type, tuplehash->tuple.out.h_dest, + tuplehash->tuple.out.h_source, skb->len); + dev_queue_xmit(skb); From patchwork Thu Nov 24 11:24:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: LiXiong Liu X-Patchwork-Id: 1708653 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=WcaXzH2P; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NHwjd2lfwz23nR for ; Thu, 24 Nov 2022 22:28:37 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uNdQHmT1MKVXGkM4TX03VLNbMKADrRB8ogYyu0dxESE=; b=WcaXzH2Pgm/H05 9ifevpEoHp9XNg+2Kc4PoEFTS10zHWYaFuAtFFnFwgnBemPjHDYPChK5KVjMVwplfSTZLwHaVMun0 JU/MNtDeg+v6aCbkGc1RioOWslfMmdFBROy5x5a8sqcr9SUt9prAT06JgKNBwCMC4O1XISut3dx5A RxfV5ze7Jv9sV/bSQKELB8iqtCp3o1I7pKkSQYcYW0VhuZQKbg5kHVEoJ3U6GtItbyx50R5sGIFzN en7Jr9JzWsTPkMLWQJxBfQ+28EFYjl+yChjh4Bj/0sY+90U9TAGVwLBnNJZ6Nb8K+MwIy6P2VRJGG 3F2upW2h1nnS332/2SGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyAMU-00834W-Sl; Thu, 24 Nov 2022 11:25:47 +0000 Received: from smtpbguseast2.qq.com ([54.204.34.130]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyALX-0082VG-VM for openwrt-devel@lists.openwrt.org; Thu, 24 Nov 2022 11:24:51 +0000 X-QQ-mid: bizesmtp62t1669289065t5a4rpim Received: from ikuai8.com ( [114.241.221.187]) by bizesmtp.qq.com (ESMTP) with SMTP id 0 for ; Thu, 24 Nov 2022 19:24:24 +0800 (CST) X-QQ-SSF: 01400000002000W0Z000B00A0000000 X-QQ-FEAT: l33WW9uhHd3LjnSwPzKuF5+b6A/SPGW000Fn6vPD3Oo92Hl4wT75sTSpW003U 2NyvqJe6AkeRv8Kq8JcfYtpgVtx70rHlE6GBpJt9UdJsGVJg8mKcmpLJNCE6AqPx03kLp42 9FCn0mKh6LUjKhgrepdDxVKY+MXOTuhmfSux7gJ3h8oqIRt3nE8gdM3bD5S9bUMMaVwsMAZ ANgIwjd50vzPjML1qRc/fuGI2fEsXtZGIc02q+2zNFjdEF/J58kJzFo+LF4FvSnjxmvM8s3 3jCTVZemlpH1FtNFRQrxJw7JW/bwsa4JQtHtoss57nAvBJ9qnUQwny4gtFt/+2blvHOW1Ki I+d7D7c+Z2AcXSt2UUhokEKwGeP2hcS946lqdaGEANRVBVbEDxfp8cnxsgClVdefJ+TocV+ JBHlNIBEIr6EssugwSNU9A== X-QQ-GoodBg: 2 From: LiXiong Liu To: openwrt-devel@lists.openwrt.org Subject: [PATCH-22.03 4/4] kernel: xt_FLOWOFFLOAD: support more complete flowtable Date: Thu, 24 Nov 2022 19:24:08 +0800 Message-Id: <1669289048-51420-4-git-send-email-lxliu@ikuai8.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1669289048-51420-1-git-send-email-lxliu@ikuai8.com> References: <1669289048-51420-1-git-send-email-lxliu@ikuai8.com> X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:ikuai8.com:qybglogicsvr:qybglogicsvr7 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221124_032448_546287_54E2BC0D X-CRM114-Status: GOOD ( 14.68 ) X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 1. fix an crash bug at 'devs[dir] = xt_out(par)'. dir = CTINFO2DIR(ctinfo), it must before 'devs[dir] = xt_out(par)'. 2. not recommended use hardware offload if encaps >= 2 hardware cannot dispose (80 [...] Content analysis details: (-0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [54.204.34.130 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [54.204.34.130 listed in wl.mailspike.net] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org 1. fix an crash bug at 'devs[dir] = xt_out(par)'. dir = CTINFO2DIR(ctinfo), it must before 'devs[dir] = xt_out(par)'. 2. not recommended use hardware offload if encaps >= 2 hardware cannot dispose (8021q+8021q+pppoe) L2 head. 3. already solved PPPoE header offset issue, so need remove 704-03-netfilter-nft_flow_offload-fix-offload-with-pppoe-vl.patch Signed-off-by: LiXiong Liu --- ...ft_flow_offload-fix-offload-with-pppoe-vl.patch | 24 ----- ...tfilter-xt_FLOWOFFLOAD-support-qinq-pppoe.patch | 107 +++++++++++++++++++++ 2 files changed, 107 insertions(+), 24 deletions(-) delete mode 100644 target/linux/generic/pending-5.10/704-03-netfilter-nft_flow_offload-fix-offload-with-pppoe-vl.patch create mode 100644 target/linux/generic/pending-5.10/706-04-netfilter-xt_FLOWOFFLOAD-support-qinq-pppoe.patch diff --git a/target/linux/generic/pending-5.10/704-03-netfilter-nft_flow_offload-fix-offload-with-pppoe-vl.patch b/target/linux/generic/pending-5.10/704-03-netfilter-nft_flow_offload-fix-offload-with-pppoe-vl.patch deleted file mode 100644 index 1e0dc99..0000000 --- a/target/linux/generic/pending-5.10/704-03-netfilter-nft_flow_offload-fix-offload-with-pppoe-vl.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Felix Fietkau -Date: Fri, 6 May 2022 15:15:06 +0200 -Subject: [PATCH] netfilter: nft_flow_offload: fix offload with pppoe + - vlan - -When running a combination of PPPoE on top of a VLAN, we need to set -info->outdev to the PPPoE device, otherwise PPPoE encap is skipped -during software offload. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/netfilter/nft_flow_offload.c -+++ b/net/netfilter/nft_flow_offload.c -@@ -123,7 +123,8 @@ static void nft_dev_path_info(const stru - info->indev = NULL; - break; - } -- info->outdev = path->dev; -+ if (!info->outdev) -+ info->outdev = path->dev; - info->encap[info->num_encaps].id = path->encap.id; - info->encap[info->num_encaps].proto = path->encap.proto; - info->num_encaps++; diff --git a/target/linux/generic/pending-5.10/706-04-netfilter-xt_FLOWOFFLOAD-support-qinq-pppoe.patch b/target/linux/generic/pending-5.10/706-04-netfilter-xt_FLOWOFFLOAD-support-qinq-pppoe.patch new file mode 100644 index 0000000..e9289b5 --- /dev/null +++ b/target/linux/generic/pending-5.10/706-04-netfilter-xt_FLOWOFFLOAD-support-qinq-pppoe.patch @@ -0,0 +1,107 @@ +--- a/net/netfilter/xt_FLOWOFFLOAD.c ++++ b/net/netfilter/xt_FLOWOFFLOAD.c +@@ -51,11 +51,11 @@ static DEFINE_SPINLOCK(hooks_lock); + + struct xt_flowoffload_table flowtable[2]; + +-static inline __be16 nf_flow_pppoe_proto(const struct sk_buff *skb) ++static inline __be16 nf_flow_pppoe_proto(const struct sk_buff *skb, u16 offset) + { + __be16 proto; + +- proto = *((__be16 *)(skb_mac_header(skb) + ETH_HLEN + ++ proto = *((__be16 *)(skb_mac_header(skb) + ETH_HLEN + offset + + sizeof(struct pppoe_hdr))); + switch (proto) { + case htons(PPP_IP): +@@ -72,26 +72,33 @@ xt_flowoffload_net_hook(void *priv, stru + const struct nf_hook_state *state) + { + struct vlan_ethhdr *veth; +- __be16 proto; ++ __be16 proto, offset = 0; + + switch (skb->protocol) { + case htons(ETH_P_8021Q): + veth = (struct vlan_ethhdr *)skb_mac_header(skb); + proto = veth->h_vlan_encapsulated_proto; ++ offset += VLAN_HLEN; + break; + case htons(ETH_P_PPP_SES): +- proto = nf_flow_pppoe_proto(skb); ++ proto = nf_flow_pppoe_proto(skb, offset); + break; + default: + proto = skb->protocol; + break; + } + ++check_ip: + switch (proto) { + case htons(ETH_P_IP): + return nf_flow_offload_ip_hook(priv, skb, state); + case htons(ETH_P_IPV6): + return nf_flow_offload_ipv6_hook(priv, skb, state); ++ case htons(ETH_P_PPP_SES): ++ proto = nf_flow_pppoe_proto(skb, offset); ++ offset += PPPOE_SES_HLEN; ++ goto check_ip; ++ break; + } + + return NF_ACCEPT; +@@ -311,7 +318,8 @@ static void nf_dev_path_info(const struc + case DEV_PATH_DSA: + case DEV_PATH_VLAN: + case DEV_PATH_PPPOE: +- info->indev = path->dev; ++ info->indev = path->dev; ++ info->outdev = path->dev; + if (is_zero_ether_addr(info->h_source)) + memcpy(info->h_source, path->dev->dev_addr, ETH_ALEN); + +@@ -324,11 +332,11 @@ static void nf_dev_path_info(const struc + + /* DEV_PATH_VLAN and DEV_PATH_PPPOE */ + if (info->num_encaps >= NF_FLOW_TABLE_ENCAP_MAX) { +- info->indev = NULL; ++ info->indev = NULL; ++ info->outdev = NULL; + break; + } +- if (!info->outdev) +- info->outdev = path->dev; ++ + info->encap[info->num_encaps].id = path->encap.id; + info->encap[info->num_encaps].proto = path->encap.proto; + info->num_encaps++; +@@ -518,6 +526,7 @@ flowoffload_tg(struct sk_buff *skb, cons + if (!nf_ct_is_confirmed(ct)) + return XT_CONTINUE; + ++ dir = CTINFO2DIR(ctinfo); + devs[dir] = xt_out(par); + devs[!dir] = xt_in(par); + +@@ -527,8 +536,6 @@ flowoffload_tg(struct sk_buff *skb, cons + if (test_and_set_bit(IPS_OFFLOAD_BIT, &ct->status)) + return XT_CONTINUE; + +- dir = CTINFO2DIR(ctinfo); +- + if (xt_flowoffload_route(skb, ct, par, &route, dir, devs) < 0) + goto err_flow_route; + +@@ -544,7 +551,11 @@ flowoffload_tg(struct sk_buff *skb, cons + ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL; + } + +- table = &flowtable[!!(info->flags & XT_FLOWOFFLOAD_HW)]; ++ /* not recommended use hardware offload if encaps >= 2 */ ++ if(route.tuple[0].in.num_encaps >= 2 || route.tuple[1].in.num_encaps >= 2) ++ table = &flowtable[0]; ++ else ++ table = &flowtable[!!(info->flags & XT_FLOWOFFLOAD_HW)]; + + net = read_pnet(&table->ft.net); + if (!net)