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=1796382187; b=NtFaKQUKTOycq1joZN4x723r+wzh/B/Q0okfq2HZWkP6V7VlkJ7sfz5NktkCVUVEIZhL DwjLM3g9pP7oVYTz2y/8CN7AS1pB3BctZbfRM2yIHSwW+VPviF8b3dKwBefrOEHIG0jiA pMLXlIKhWshX4pZSimgK4LLWr3W9zNEQh1Bm0xdj88/+YTxZRvVlSRWqydRjoXhLjfzOb O6s7TzsYrA1Nc6X9Hu1YFBQyGZk66BxG3acwhIZ/2OciWvNidd0LxgJpik9J9XRg/KpeZ 8vZ/8vJf9RtgOgUWjjm1khURDsgd8bZnKos+GhqD82OwBDCyg/6bxQvQDRBsOX/Sn0A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382187; 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=VmTxQBJ1ESvJzyHBmubbeRVGv4hBssZ1y7A7ZehUX04=; b=zNHwsdErl2PuHVNtmxoRmJOjllZKfkOtpIkxmeHhj1lI/TiLQd6Nw6qKxadeEEGUb9/J g9b9i3jhh4ZrG0oR/SJuMl2g5k+6BHLqpOkR+dfoGNSAq1v8nlD4hhr19fcF4lw4TewMB spLqohPHN2HLmObwHB4oMQTmPtvLhOV4sw5c+5TJ0/uiPck8zFvQsckzDPAauHx5XxTqB Pjs9hUMKkiBuKVtvMihKL1BWn2B9M9fc0cGTxq/AR3bSeIT9Kn57kVUqdCVoWaZ+gbLq4 B3/3DArrgFEmU0q3eNA0FWB4B6aIOkxkyjN5lRmOQScV5i11dMdEegcYEMolx5a1kCg== 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=2NUHPFWq; 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 F3563606A322; Fri, 4 Dec 2026 11:03:06 +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=2NUHPFWq Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6755D1F00897; Fri, 4 Dec 2026 11:03:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382186; bh=VmTxQBJ1ESvJzyHBmubbeRVGv4hBssZ1y7A7ZehUX04=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=2NUHPFWqvnXDWUI8ta9tkuqpP84M2zeASLYDOyNqsDDUn0r6smTiGrkzoHIMc5157 JcW91fR6dw9+CXeKm4eZ6O73759so21iVdfQ2xmiltLuVqQgbwds+IRHwkJUGV403r IOnJKYC6fq0SF344pHgNsel3lpXAetUUNo1EE1R8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alexei Starovoitov , Sasha Levin Subject: [PATCH 6.18 319/703] bpf: Take a neighbour of the L3 master in bpf_redirect_neigh() Date: Fri, 4 Dec 2026 19:03:38 +0900 Message-ID: <20261204100636.263704372@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@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 6.18-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 b65d58fe1d4cb..f34315dff06ca 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -2366,7 +2366,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