Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3577050pxb; Mon, 24 Jan 2022 12:38:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJyc9pf0qlxlyg6knfKhUjg8bRJJSbErHn9OV1g9DefAsxm/SGlONv8J9fka3lORCwu5mdXd X-Received: by 2002:a63:8649:: with SMTP id x70mr8553135pgd.530.1643056709776; Mon, 24 Jan 2022 12:38:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056709; cv=none; d=google.com; s=arc-20160816; b=AxbO+ze2ji7Zi8a0mzjdPYYt0P+nCOnNRVF3QhOH5DkR0vIw7EZG8VjjU/UkWk9Xf0 NVoRfwYzEIuVm3obw4+SwWV3EzOrwP0CcVV/bZZsnMH+DU8v7EuMwHGiz4OQhBmR0HBx R0TsVSjgcxoMv0R6vK0nr6Leihk+fsiz9nwPCLQUJS97YGXa1f8mkFlz7z7yROkIaIwD gzWjmUtxGUCsVa0XxmGnSHqeMl7tzbd1Ku8wGC24NB46SmxMI4lGrAYBnifdQAeneBBq oAe1B/7gEGWuwut0zSnQwy/PGZlMaxjU2jvHwj08pzBowrNXmaSzGDxGe6Ax3reqS4G1 GgWQ== 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=qBuyH8FtSoto2VTIfmpNiJP+xrozPWSzqPye1q5O1LI=; b=jq30jJLE+sVnaP5X5kG6i7tE3Csimx7ijQgWS2bgcF9dUX8tDn2UN3DITdAZGzL6d7 /t4TVUyqQNe7QgNkq8lHF0mOSV0FGBPuNGfHKdr2apCNtgKtoPwqgyCjCV/1z8+l58Fy JtVebAUSKzxfjnnbLrt2eI9fz0Wh/YbJcQ0De7JNA+BUV5gH7aBiGm7U0TZEAn6hYm7i Oiw7POZSqhygKn8Vo8CTvj3uDJzcDv1OK3HzEIuMNkwEG+wGMVbHxZumrF5r5uAzQnkm fdv9jJG1Sb5Tm++tuXKAodIeKXuaVPWQeFVAUTmLywmF5dWIo+v6dGycOyynrLzbpy5V 4dDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="1Rt6/596"; 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 r66si3722822pgr.160.2022.01.24.12.38.10; Mon, 24 Jan 2022 12:38:29 -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="1Rt6/596"; 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 S1350374AbiAXTmr (ORCPT + 99 others); Mon, 24 Jan 2022 14:42:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346657AbiAXTb5 (ORCPT ); Mon, 24 Jan 2022 14:31:57 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23859C0604D0; Mon, 24 Jan 2022 11:15: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 dfw.source.kernel.org (Postfix) with ESMTPS id B546F60010; Mon, 24 Jan 2022 19:15:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0216C340E5; Mon, 24 Jan 2022 19:15:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051711; bh=5gpMEpfmr3TqHNa/BGaMeGbq5ejMLPM/MNPnSfuyYV4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Rt6/596G5jbbGnSX/zR+nNC+lNJjGm+pjNSxVFVt62KwlVhBZlxDvhSytQe3WQTK xc2aaJtnzAyjaaBUBdlNE6+y/mRFIogrx0p+s25+slB52aQl6FswMGXGfntU0keoaC rNditeh8DoqvJZ7FzE8w/UpLgQpxJ7ggVRAUO+hg= 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.19 062/239] netfilter: bridge: add support for pppoe filtering Date: Mon, 24 Jan 2022 19:41:40 +0100 Message-Id: <20220124183945.109568268@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183943.102762895@linuxfoundation.org> References: <20220124183943.102762895@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 c5380c6baf2e7..4b9d1d6bbf6f9 100644 --- a/net/bridge/br_netfilter_hooks.c +++ b/net/bridge/br_netfilter_hooks.c @@ -727,6 +727,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); @@ -744,8 +747,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; @@ -768,8 +769,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