Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3646318pxb; Mon, 24 Jan 2022 14:19:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxmjamreErYV27fkQ8N3r7mi3zyOgePtNHT4+sXmISSmhwolIc0dStRwbQVpNvsorg4LKJG X-Received: by 2002:a63:ad42:: with SMTP id y2mr13175758pgo.386.1643062766137; Mon, 24 Jan 2022 14:19:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643062766; cv=none; d=google.com; s=arc-20160816; b=ykKJi1zNkSFbEulB2+nBuNPjYkOrMHDikNLhgYsZhJC/3/WAKCgbTrb8yxzZGZgMbj h9r4xNsK5JusxEh/3A+2LVi7r3lczee8We5SEolORUPvEJHgC8TKL3rP5r8Ky74cjwN7 gZA/0BdXZjQdPMYSRjstoc0EmGvZcay50+nxxvJoFvVyLv5fJhJWTLOqCFBnnR9s4umV qo6WRBwkjKmaNZsal1tA1WLDxTwwuITSY3ooYQsJL8ARfWYusD3VGsJVEn4Y/1tG9ySx bsIhGGAmyy3vr10yaWXkMaF4rtt9t/FTWRXLbO7DGcRlV2GXU4CmZkfVn8i+44GB7V/6 IniQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xcC2wkKnAIDCXiddj4UvHbaEuEh3kYDEUEx140/NMLE=; b=WHvWgPlCfEMN/4ZIylf3iizAd2kPCfON/1EzlSRnqkdsOSMz9fCOImEx8NxFPPTK+n mQch2QN091voyWt6QuL/vquFqP/YSgq5CPjcQe27ChtQJAIUoyRzCxtE5ABxkFZDTlsx CWlMwZDWLBD7Q84Xc9mfL5VO23o9W4DBd/VicYfLTpptPtyXFpMQgHzOZJCPds/GME3E O1ChpHm59A+By1ysayJz7iRugCqLbh7Jwb7ymgPAADryThunJOkOMBbRfaBE1QV0/RSI OG0m/gaxJ0J3263HboesOAV0yTq0VYPo7WUtoHgRujo2c34KE0Bh42fRIlBsAd0uNh8f 9xdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NHblJ2R3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m2si500468pjo.34.2022.01.24.14.19.13; Mon, 24 Jan 2022 14:19:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NHblJ2R3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581616AbiAXWMF (ORCPT + 99 others); Mon, 24 Jan 2022 17:12:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452869AbiAXV1O (ORCPT ); Mon, 24 Jan 2022 16:27:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5864C073231; Mon, 24 Jan 2022 12:18:34 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 93468B8122A; Mon, 24 Jan 2022 20:18:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5069C340EA; Mon, 24 Jan 2022 20:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055512; bh=HQ6B0uKdxL/T2Pekmm6f9Rm+C360B4Crjd3KMEbBmYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NHblJ2R3m7pMsa53/4bzNDb2Oija7HkIlWO//NeSHw/W4SYH6JfvPb5+6+kWiADhE DOF3/SdLqGZd7z2kdLHESyFPoVYdCZy63sbDbwYB3kvVjWX4B7XFR5TPfMx4SoWwKo LinsKi7Sn/Uw01ij1de2DL+8lC8OowD/wQOqogGc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso , Sasha Levin , Amish Chana Subject: [PATCH 5.15 175/846] netfilter: bridge: add support for pppoe filtering Date: Mon, 24 Jan 2022 19:34:52 +0100 Message-Id: <20220124184107.013149632@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Florian Westphal [ Upstream commit 28b78ecffea8078d81466b2e01bb5a154509f1ba ] This makes 'bridge-nf-filter-pppoe-tagged' sysctl work for bridged traffic. Looking at the original commit it doesn't appear this ever worked: static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb, [..] if (skb->protocol == htons(ETH_P_8021Q)) { skb_pull(skb, VLAN_HLEN); skb->network_header += VLAN_HLEN; + } else if (skb->protocol == htons(ETH_P_PPP_SES)) { + skb_pull(skb, PPPOE_SES_HLEN); + skb->network_header += PPPOE_SES_HLEN; } [..] NF_HOOK(... POST_ROUTING, ...) ... but the adjusted offsets are never restored. The alternative would be to rip this code out for good, but otoh we'd have to keep this anyway for the vlan handling (which works because vlan tag info is in the skb, not the packet payload). Reported-and-tested-by: Amish Chana Fixes: 516299d2f5b6f97 ("[NETFILTER]: bridge-nf: filter bridged IPv4/IPv6 encapsulated in pppoe traffic") Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/bridge/br_netfilter_hooks.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c index 8edfb98ae1d58..68c0d0f928908 100644 --- a/net/bridge/br_netfilter_hooks.c +++ b/net/bridge/br_netfilter_hooks.c @@ -743,6 +743,9 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu) mtu = nf_bridge->frag_max_size; + nf_bridge_update_protocol(skb); + nf_bridge_push_encap_header(skb); + if (skb_is_gso(skb) || skb->len + mtu_reserved <= mtu) { nf_bridge_info_free(skb); return br_dev_queue_push_xmit(net, sk, skb); @@ -760,8 +763,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff IPCB(skb)->frag_max_size = nf_bridge->frag_max_size; - nf_bridge_update_protocol(skb); - data = this_cpu_ptr(&brnf_frag_data_storage); if (skb_vlan_tag_present(skb)) { @@ -789,8 +790,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff IP6CB(skb)->frag_max_size = nf_bridge->frag_max_size; - nf_bridge_update_protocol(skb); - data = this_cpu_ptr(&brnf_frag_data_storage); data->encap_size = nf_bridge_encap_header_len(skb); data->size = ETH_HLEN + data->encap_size; -- 2.34.1