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=1796383635; b=vJ/q9AwglOIPlmUJGxOWce6K6/kPW+8eZaEOIvHWXbK9OE/GwbwAucPzNOxRZyN86iBQ BcVnep6anvvx+kHHcqQvSuc9OyvGt5Aq3VIUcjER4BEgdW0ch3P+rsbv7bqdKT9/ic122 KbYSbsAY+9fSzlqHVGpLoRhxEJxFSulFDmI7IkDg0+WHflgv8tIf+gUGVM+1H2Y5HKd/4 zCuQzbWNTHYV3UgkYHvbwzspyD3iq3mrSZWp/nJt0TjpeJnsAN+Xr2skN7sk/TPuUR8ko nlUGO7CbmlQ7/7NT7ny1Dbg8+M6A7r9p/MEAJw8ih6nZyyh+jnaFu/OjrlM974UvNBw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383635; 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=kCbtHUAe6kVwwd0fnQaNWfab4v3x0Y5vRXsnDsrtVCQ=; b=XLf74i9dUsNzPMRx+TGfuuvtJSt/oexdShVjCg4xJKjRa2xmeX2zlf4fMmjJR8neOPFy SA4d+861CQudgNTTPSl13tmWhvYx2J/Xq290u8GEQbdzlHLwhpSqVgZy+nLvGybUFP4k/ ed4JOe8kRF4OCRP7cA4bKOWPF7IjYru+qKF5zU90YaEoGWpUGKTMsXHS4U+tHm3kvAheT V8SSMSro2zZiKioxDdtiIqFvYUwNcyol4YXAckUwqxEF67kvYuytDxpAJnNgetJYiLKve 3jTbyim2UkUyyhWbN2skY3LLo5FEj2phZzlYEi1Tw04CBTdY41xIstwTeJ7rXGeGlpA== 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=jLYrhnk8; 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 7150E606A322; Fri, 4 Dec 2026 11:27:15 +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=jLYrhnk8 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB9821F000C2; Fri, 4 Dec 2026 11:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383635; bh=kCbtHUAe6kVwwd0fnQaNWfab4v3x0Y5vRXsnDsrtVCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jLYrhnk8YLct/Z/H1EhNQmcz24uoJGBkuvPTMXQC+ktgAHxiy6z1KgVq1baHFaCj6 pjPckTi6YKGGcSRnqjqjh2OJ0d1agC4pvPLCiBzR5alcYiK/oAUdpT/vm9qt52wy98 iq1u5QGRLCwCKGkJUjliqiMNBelMsTPG8rmFnOOQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alexei Starovoitov , Sasha Levin Subject: [PATCH 6.12 306/555] bpf: Take a neighbour of the L3 master in bpf_redirect_neigh() Date: Fri, 4 Dec 2026 19:05:49 +0900 Message-ID: <20261204100621.065916809@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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.12-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 4efe10a2fea6b..c2e26724a7548 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -2374,7 +2374,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