Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3565385pxb; Mon, 24 Jan 2022 12:20:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJzuVmlW8hnGIR/+pLfxviON80MpJh4QSic8UWbaYYRkIPpY1UnYofrQuW48tAbFGsMkXcRV X-Received: by 2002:a17:902:7143:b0:14a:62ed:c2a7 with SMTP id u3-20020a170902714300b0014a62edc2a7mr16042979plm.80.1643055640578; Mon, 24 Jan 2022 12:20:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055640; cv=none; d=google.com; s=arc-20160816; b=Supg87Qo6W67Ohhuqq6V+rxAz8+7seasVbqCPz+LkSOD7qvM4b63pgsFsUj8TsugZn HUERVLzlsL+bHRyded4QD6sTiYYh9ffVo19Ja2ldttyGsq9y+tyE4/6bwh7vqM1/khRz 5WlxNTwNHJPBR1cUCSYJXGa2ricsbWO3xex4VtG06T4TwUX+IRMuOnXO9todbr+9y3V0 e1uTpvaL07rcRfTzP62R4OG2dEVBsvrTDP0Exp4uigtWszKVD4V03Ourj9OnHzXcPsqL YcxcyNt5Hxz7ZFyZoDsB5cgHju1ED6fnQlGIcwtVHbn9HR+y8/C1yxMiKe2FTzTqWwy/ XNpQ== 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=WjC6q8NAdWK4Zzsk5w1qHMISuPU7/urICQTw4uZZs5o=; b=zOiEr47vEQVlKyB5DNkC1rKJAbHBG8bqoT0l6UTFNF7T1bJUS8ijH8FXgBlWFaT0Fd F+PRDXDfOpYDbjV8bN+hR/2aYfdxgZcdLH4zVz+53T07Axm42RIL8FyaXdb/YEU11PPf xBA9+Pe4YsQ7ythTLKhmpYiYDGQtniRh+N5Ss2viRvrup3c4ILJkmKuXtymKiZ08iFdn p+d3e0AFwmzcga1PdAkMcjTP/8DPfLR15SZO8HAq9uze3bovqFYhlmy3TRGUZw6rx89h 4r34TulxDouXeTmky8eHq0FBt2eYhe++D0OKDPFroDMBaY40kuUEOuNz6A6+iPXFstVQ Dn6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tdsmJFVf; 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 ls3si295627pjb.177.2022.01.24.12.20.27; Mon, 24 Jan 2022 12:20:40 -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=tdsmJFVf; 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 S1347424AbiAXTXx (ORCPT + 99 others); Mon, 24 Jan 2022 14:23:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348163AbiAXTO5 (ORCPT ); Mon, 24 Jan 2022 14:14:57 -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 0357BC0612F3; Mon, 24 Jan 2022 11:06:12 -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 7611DB8122C; Mon, 24 Jan 2022 19:06:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A966BC340E7; Mon, 24 Jan 2022 19:06:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051169; bh=Fg6qWsA/2CLDHs+vPCi/HXNiBqMhMXgbsP60Z+tFIFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tdsmJFVfsmDB0BaXNdSByFVZEs4tej5YZR6A5NVQmeH2qas03gEFlqiY6hd3cooCG Z1W/3YeJV/pMNsrr4hzEmJthMsREt/G7m0r+1gtqv5aRkU53UBhzEqEf9YWtdHbOoT 96+ADwY6PG0KNM0xvzrDbBhnEuXXzElEOz2QwpXk= 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 4.14 044/186] netfilter: bridge: add support for pppoe filtering Date: Mon, 24 Jan 2022 19:41:59 +0100 Message-Id: <20220124183938.552224017@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183937.101330125@linuxfoundation.org> References: <20220124183937.101330125@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 8155c3d811a14..7e50bd9f36112 100644 --- a/net/bridge/br_netfilter_hooks.c +++ b/net/bridge/br_netfilter_hooks.c @@ -724,6 +724,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); @@ -741,8 +744,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); data->vlan_tci = skb->vlan_tci; @@ -765,8 +766,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