From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796380501; b=Y/N5Wpe3bSuyslHvxnEeLmd8dYiEGCZgOMAg5bkVZ3vzkqZ9t/fw/euiAbKAF/rLG8Ao afRvzzEy0hkLDXNDoT+EMVxOra0QXpjlyHLcyb3sQ7BzG3k49hKt0x/Q/HK8lAa4FIATY feqZF/OA28kamrK2eKcvqGHb++Jr3tnjG+lJdLbFSvRbvWiL8RACwXJMhuXOlGBTV7bRR weFEWkz7x3tse6xV6wRYoTrRXamUKKYIkRCo/zGFVrxg33j5fPYgdUuJb34Doxq1yUPl9 nsxZL0kUgThtPhIndg4rnqd6P0M4uim05vXliSxZOk6+oGHRL6n6iLaZb78mxRpvdDA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380501; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=idCenzed7M8289v086nOrHLdhH2n01VPfUFy2ZdGxlU=; b=U9fZ3oPjsRx4gcy5XxtFI7HH60pxa0ggcRmJv1Uf6zdbA+hfzmcY/iiXBcv6Sjaxd2/S vM6XS85og9ZO17BHP4cDig5lMWqxVzfB6cdBUuQP9qapbv46k8BocKQF+0xHLJDBLznw9 Z1sroZNHD+vW4cyre7K//PIDdxR5XSONWzfoUqB56oN3vpvUkqp7szSqK5O3XgGNgbpks gQR84Zz8hVU1yLs3/9WyFyexPfbOxeZ+FJCnC6T1i7Pjm7VJqjsSAIhaulhSLR4OwahMu 6tYAmpJwRynL5UNyA8h/Zd3kzaQdQJd6Kh7Yv68NWcks2ysXa6WaD5uNCKDv3JpJoAQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=saBZuQao; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97EB5606A33E; Fri, 4 Dec 2026 10:35:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=saBZuQao Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11A5C1F000C2; Fri, 4 Dec 2026 10:35:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380501; bh=idCenzed7M8289v086nOrHLdhH2n01VPfUFy2ZdGxlU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=saBZuQaonmMLUVKi12YM7os/RDF3Z1ISEnO70um0TeMtrc+3mAFFhDIGojCfKiquW jWQE4zIKczIi5Y8EqAYcWznGWkqYE9Ci7SdXt2Z6jHVHstl/EqV4vYVOrrZP+fE9aA WvXH5CKG1/ui6OhlSQ3LWo/3OAzhpBTp3Zsg00Qo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alexei Starovoitov , Sasha Levin Subject: [PATCH 7.3 300/742] bpf: Take a neighbour of the L3 master in bpf_redirect_neigh() Date: Fri, 4 Dec 2026 19:02:44 +0900 Message-ID: <20261204100643.008082398@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexei Starovoitov [ Upstream commit c1b5decc73149f69db0b8d28ebcea204249e3b0b ] bpf_redirect_neigh() takes the neighbour from the route, the skb gets the device that the program has named. They are not always the same for IPv4, and the queue of a neighbour is purged with its own device only. When a L3 master was named take a neighbour of that device, as IPv6 does. Its driver drops the header and routes the packet, one entry does for all. Fixes: ba452c9e996d ("bpf: Fix bpf_redirect_neigh helper api to support supplying nexthop") Signed-off-by: Alexei Starovoitov Link: https://patch.msgid.link/20261125032938.670542-43-alexei.starovoitov@gmail.com Signed-off-by: Sasha Levin --- net/core/filter.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/core/filter.c b/net/core/filter.c index e5284b8345838..735031c4f7d53 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -2367,7 +2367,11 @@ static int bpf_out_neigh_v4(struct net *net, struct sk_buff *skb, } rcu_read_lock(); - if (!nh) { + if (!nh && netif_is_l3_master(dev)) { + /* The route leads to another device, this one looks it up again */ + skb_dst_drop(skb); + neigh = ip_neigh_gw4(dev, htonl(INADDR_ANY)); + } else if (!nh) { struct rtable *rt = skb_rtable(skb); neigh = ip_neigh_for_gw(rt, skb, &is_v6gw); -- 2.53.0