Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3593140pxb; Mon, 24 Jan 2022 13:03:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8Sh9cnHhZWvxucre2mJcetj5wSZNywEdYgKBi0wpNGZlDsjhF+5VezVg3nJ/vk9vkaAcc X-Received: by 2002:a17:903:404c:b0:14b:6dd8:9c3b with SMTP id n12-20020a170903404c00b0014b6dd89c3bmr1266172pla.80.1643058224194; Mon, 24 Jan 2022 13:03:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643058224; cv=none; d=google.com; s=arc-20160816; b=Onb9Q79mb3KLqVxmtVll822CE5E11/oeWNkTUGjtIGmm1nK3B3Z/Dm1Q7ZzDeELnQe PZGBYYlt8TL0RvaW0J1gebW3j1k5P3E+JtZaa44Dt6/MKo435SzxsGhMoY/VriFZurDd eeTLUq60+9m5prXb3ODv1QIYwweWbxvMtGPnO30XdjXDnAsr1E8KBXyb7+BC/PiTRPEi IN7BQipyYpMXbNYeJ/uLb4PGsnKMrpdiAvgq2w7gSAhE5CETXbFJqUl5ZCKRHLVtbntR kUeTIFYjvvOYAeZK7Uil1FcDzLB4KPnMAFxrpSRYJYOa5HqIilaoBzgoxX1NReb6OqZ1 qWCQ== 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=3Bl1MNnGlWKG/RkRnFsGS1meK0jU+kLcBEvaKBeDepo=; b=RIxATy/55qcagY3V6ew42XGPi+F4r01+bhiGQzjkPXasIo+cGWHCoILorlKpZybt6I jB/RB07OWpeW4JKbRQHoBr48Rfw/ljhRdO3PEfFYKjk7ob5sfMqA0P19raZGtSKHDSyF JnXB1WXiZTdbaXJFgm8KOubV+Ot2GVc8gUykycPDsVBzPKnFKxmtgR7fzdq1yRGQH/su Dkd/U+khEJyxn0de1gX/j6hD0KsA4jOqou371yxXAyG7qt9zkMTqZILEpbkgvJKrESPV +CyQD1BRvA3agqUqER/f9B4GGSSyaoejD/mtDjo0UAofxZxseI6VwWSpZPcOLW54HFry 7g8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FJ2IFaZI; 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 y7si11983077plh.421.2022.01.24.13.03.16; Mon, 24 Jan 2022 13:03:44 -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=FJ2IFaZI; 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 S1383241AbiAXU1B (ORCPT + 99 others); Mon, 24 Jan 2022 15:27:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352349AbiAXT5Y (ORCPT ); Mon, 24 Jan 2022 14:57:24 -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 3047FC047CD2; Mon, 24 Jan 2022 11:27:45 -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 CC56DB8122F; Mon, 24 Jan 2022 19:27:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2019C340E5; Mon, 24 Jan 2022 19:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052463; bh=7XPshxeoNpqnYhbFwujpf2lKWjymnt6lMU5HFqfZ5xU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FJ2IFaZI5S/u1rd3Bh3Iugv/kCNqN3UOBiy0Btc0WvM2vPAuR8VcXDas9afYgnsc+ umSIrQNSOK0rTvSwjvb1Edzea3nSrG7UK5WfjyWYPMFx9wb0PKL7VBCzbM/pXwo3R+ ZZ25vkcXuyzr6ppS9dzbBxMZ5yJF2T1EBy0X9BqQ= 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.4 060/320] netfilter: bridge: add support for pppoe filtering Date: Mon, 24 Jan 2022 19:40:44 +0100 Message-Id: <20220124183955.776948917@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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 2371b833b2bcd..480e4111b24c1 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