Article View: linux.kernel.netdev
Article #8350[PATCH nf] netfilter: nft_flow_offload: do not offload multicast
From: Koral Ilgun
Date: Wed, 28 Oct 2026 20:59
Date: Wed, 28 Oct 2026 20:59
66 lines
13163 bytes
13163 bytes
From: Koral Ilgun <koral.ilgun@adtran.com>
A flow holds one output per direction, which it resolves when it is
added. The outputs of a multicast route change when listeners join
or leave. So a multicast flow in the flowtable continues to send to
the output that it resolved, also after the last listener left, and
the counters of the multicast routing stop.
IPv4 multicast stays out of the flowtable only because the reverse
route lookup in nft_flow_route() refuses a multicast source address.
The IPv6 route lookup has no such check, so IPv6 multicast that
ip6mr forwards goes into the flowtable.
Skip a multicast destination for both families, so that the result
no longer depends on the route lookup.
Fixes: a3c90f7a2323 ("netfilter: nf_tables: flow offload expression")
Signed-off-by: Koral Ilgun <koral.ilgun@adtran.com>
---
Tested on an arm64 router with Linux 6.18.54, with an inet flowtable
that offloads forwarded flows, and IPv4 and IPv6 multicast routed from
the WAN to one VLAN. Without this change, the IPv6 flow went into the
flowtable after its first packets: the ip6mr vif counters showed 25 of
1,500 packets, and the receiver still got all 400 packets after its
leave. With it, the vif counters showed 1,500 of 1,500, the flow stayed
out of the flowtable, and the stream stopped about 2.5 s after the
leave. IPv4 multicast stayed out of the flowtable before and after.
Unicast IPv4 and IPv6 flows still went into the flowtable.
net/netfilter/nft_flow_offload.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c
index d3c5651dd699..1fc755e594b0 100644
--- a/net/netfilter/nft_flow_offload.c
+++ b/net/netfilter/nft_flow_offload.c
@@ -10,6 +10,7 @@
#include <linux/netfilter/nf_conntrack_common.h>
#include <linux/netfilter/nf_tables.h>
#include <net/ip.h>
+#include <net/ipv6.h>
#include <net/flow.h>
#include <net/netfilter/nf_tables.h>
#include <net/netfilter/nf_tables_core.h>
@@ -35,6 +36,16 @@ static bool nft_flow_offload_skip(struct sk_buff *skb, int family)
return true;
}
+ /* A flow keeps the output it resolved at offload time, but the
+ * outputs of a multicast route change when listeners join or leave.
+ */
+ switch (family) {
+ case NFPROTO_IPV4:
+ return ipv4_is_multicast(ip_hdr(skb)->daddr);
+ case NFPROTO_IPV6:
+ return ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr);
+ }
+
return false;
}
base-commit: 734bef548a96e8774d6eef5dfa2026c6edc4e80b
--
2.43.0
Technical Details
Message-ID:
<20261028205938.662312-1-koralilgun@gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353021-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353021-linux-kernel-netdev=dewy.ru
From: koralilgun@gmail.com (Koral Ilgun)
Newsgroups: linux.kernel.netdev
Subject: [PATCH nf] netfilter: nft_flow_offload: do not offload multicast
Date: Wed, 28 Oct 2026 13:59:38 -0700
Organization: Usenet Network
Message-ID: <20261028205938.662312-1-koralilgun@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1867066"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:iQtWooeKOTzx3bBZrbV65bcYn80= sha256:RGpTsc5M51T8f8UZLEGEtFFe8Drw6JF/cbH+dDSlyPQ=
sha1:pT0ROSQAYtcWvGlA9PVggVvkbdM= sha256:kgcLFsbP1/EOVm26Whh+zs+aej8rm/HlpQY4Et1nwWw=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 5A382125C48; Thu, 29 Oct 2026 00:01:23 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id Tr4JZpYvpDCh;
Thu, 29 Oct 2026 00:01:20 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-353021-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 5EFE5125B20; Thu, 29 Oct 2026 00:01:12 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id C4EC92A74B; Wed, 28 Oct 2026 20:59:45 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1793221184;
b=ZfSwx+5B3qEdzRmRguA9MzDNvFCGWG67ACoNFO3VbilPu7TSSAVuy0Ku7cdVxMMnsPrd
WEFyFNLacdP9Tpe/cZWFmEirv7wmnzuiRcPoI1J32aM/KiW8qtT4VuN7zJGXhqfcxZo3F
Bv4YYhGMuuDbz2NpDpRPyNsoEeCHNkcnMVi3QSXo5XI1I7HHNtU4K1wpZdQcAI27FuvLX
qHLRkcRrlMuYqFp4RJ06JD627/Xwbt9UxPvEN27Hf9LzD+vnMd0w/GmMnBigdNCy8RT5X
S/xqoyE/I7tr0Uamysp5eWF6I2ED9yl3CoOMyqNaEVi+0RJrXDEhEyx+tZqK+gIRd/Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793221184;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:Date:Message-ID:
X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=qaQSYGMYJjRHdqv1JNYADQndewpgit/Om11IjQW+ZUk=;
b=GF+PfRI6yskLZcNY5bYfbAGFdgLHX9w8AxyVK3KnLpTujKH1UyIYRGsgy9TgctGVsISC
QcRjWrVPfto6v55pekE2ER/Z5n5Q68n8n0nuCmWvCvYKi6V9g+dMe3r8KWwAq+A9bpF7J
q8Xp80Ju0duuRnIJHAw2wTjExpDIb95vTgvBYLbrCKwhFN3ZJyUIblins32308G+bLa5Y
U9eUSCZLLayIaec5w3tFMy5+K//4qEMO1wW9xBGu3SzHaILi1RttIXj5jB9p99flJmD0q
LclQ3RxLEVVm7iDhERYk7Nly3Ks/ib56V11Xp93u9YIWpL8dsiG4n2+/cNN1lePc5kw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=u5QKoSGG;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 567CF606A326;
Wed, 28 Oct 2026 20:59:44 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=u5QKoSGG
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.172
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793221182;
b=T6UCbbmLM3/cL9MBjTrN4e/PgjcDe1V689Wacl/aywPOAP+Dd6kVR6t6GKBBETEWP9m6
EyfbLmgK47BqZvya9JNJ6rcBmkAhD52bxy5xwYwgcTU9X3/HXOrYhwfnQKcbptt/xH8bF
G/7dGB50wKKPFs9fd5dj2pqQ1kJM8UVSw5IeHS+2cHJr4quoTROd1Yr+gI+ysaLXI9ePb
zOFxvaMYPjGBoLEzHCVPhQ6rapCxnageNwLgxqIpmoGc94xyH4vTA26dJZVQhZnjXNUOa
ES2jJsIF1r3ZiuUZU0MdccfP9CNfzG6UTfrKFl1yllZ0wFW0ru8gL7FaUm4Sc3gcwmw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793221182;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version:
Content-Transfer-Encoding;
bh=qaQSYGMYJjRHdqv1JNYADQndewpgit/Om11IjQW+ZUk=;
b=U6HMGEk5dK9VIYi92cOZsSE617vMfa0YsuPmT+3C0/snDf61Vj/OiK+ikLD9ij6QbjRH
XNeZCuFYKnW+t3PV3MvQdIQei1ugAC2mkLoorzAHKsTBKlHi4ef+UX5bnQf1lRSdQdwLf
K8apac53KEO4W0pToLeo/wL29tJZnNgNjHFFZ0SU0slWaoz+FowjvzRpgRaDOiQrBI2Qp
3bMPaGoPLc+EtnlwOTzKknVhUC/WQS4P+g62xdM1yZZduDc2YquGpOc2pfnbpP4GU0rb+
KaEDvODo7OyGp9ubmarzlemydgR7abv9v1GxPEmpON1I2nrOmMkvSdl4KC9wp5ZZmZQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=u5QKoSGG;
arc=none smtp.remote-ip=74.125.82.172
X-Received: from mail-dy1-f172.google.com (mail-dy1-f172.google.com [74.125.82.172])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 464B5606A31A
for <netdev@vger.kernel.org>; Wed, 28 Oct 2026 20:59:42 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 464B5606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dy1-f172.google.com with SMTP id 5a478bee46e88-3514b90bb89so2724671eec.1
for <netdev@vger.kernel.org>; Wed, 28 Oct 2026 13:59:42 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1793221181; x=1793825981; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
bh=qaQSYGMYJjRHdqv1JNYADQndewpgit/Om11IjQW+ZUk=;
b=u5QKoSGGKa5FcFqgzz2UgIWYWG2ytJgfO8emLPx2PdBSUJgRSZ5N50PG1CpEZfhRQx
6nui0Ola6WQcunlDZLYRaLZ/2f/KoyJCo04OokKdxpFPaDvjBbC14iTopLpDIygIS4uL
QSoGW/1kajxzKQrjTwe/04JOgas7wR/ROxlYVOt+upOmoaLrALsDZxElpL/v2pmsjfNX
jAcEH9dZEairz3P9fCbq36OxGAt+bWhWv7OSP2V+/rIyV0TahtJsQMBleeuHQJKnmAf4
OHSKPWcs9nfzUp7REDuP53RbFPkfDFZw3ywxQydWfMM8NElPvdtcaPC43iMqbq3GbiJY
zD+w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1793221181; x=1793825981;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=qaQSYGMYJjRHdqv1JNYADQndewpgit/Om11IjQW+ZUk=;
b=0LEORROiXCPMoeNpfZoVKLRW/XQGPtt9YmrF2dpaqLg69VYo661P3Ul+GRLdYbPUDg
734KNQ+Af5NR/Q64SEONTBLzpMIAUF+Vbm6jouZVKauumnxcmwWjUj7LVdEyZvpHMLGi
RxJjocKCJaWaJykM3EqGch3LSEpSFsN2x2xixCDWuGJiPKPNVAbsrqqO7z3xR4D7U6hj
rEenY67emDI2kIg/lQBrfWifrSdlI8GM2LIOBKM+cZIWeAXkQm9PJ+usNWVS7rBhWPJB
oLg6hoJgcQmRDcjW87c5VZyKSiM2djnPr8zQ18gkJzNbaYo8ydp1a5ZrMw2OD3AYyJCl
rPpQ==
X-Forwarded-Encrypted: i=1; AKwUvByISILvgQxUfi0rMz3KxAoaj/f5KoZbNjjN6eoZdeDQWUOBXMYpAKX94LI+beMqpteVb2xkPLc=@vger.kernel.org
X-Gm-Message-State: AFq9FYL+fwb2QnoiJLM7tnU0W/3iF/0gnnkSvGADdOPn01eAQv0dGC5O
ZityYaj2w5puMz2pV4s08i3jnaKg6ls9ZT1abZHnPI0JhCDLshix2bN5
X-Gm-Gg: AYBFou0ILUULn7ExsGF++lkTLOQQhL5HvRn4N+L68XZPeHCJBibdoAlP14y4HIOQ/6+
ohDbeOnfTHoXh48fKPd6oHkNktbLGecV/WeAaU8ZsGNLCtC/DVNN6iescmRTcjj3RRdIOftJhJc
Py0yhIgbEruKCtoCSC4mkBZyXFxWHl+m0jgmHUnO1bi6xzum6UD3NUvonNXmzA/VoONQqWLqvC7
0iExn/wxX8u85lblSSGIBzl8nOrpU65fHHvQ0eiOLovz79cs0y5dedF1WCFG2jSDG0UpRakBFTX
0l0R0tnfotqQbYs809Q5BGyfYTtJaBHgjzaZD2eFIWPHz+00K1bhbJ2R6I/TUzYtY8cVhaT9Qpz
orqSSIMb0r6RN/GPUwWrUdIktVtX3F7BW1OrWEoZQtY9uMaNL6ZCuoXBhEIUd6I+kgQ0POTRDki
vzm6SeFoBl03ZIRcBO+kIugdtnlqAxdjOdM6ZMAlUCSAVzSY/hssV+m84uhLf7VkOEOBLhYGpFh
mNtUKZa/LlI0kUkpIk5EJEPoDrr30wbnsv47+L1VK3r2k/PDaCU9tgdRx7LyCKT/mHaYsHxR+iL
7n3vLlBjkZOb8K2ncAJpBRDxU08x08NDte3r/l0FXezbYHpD6nBfmPYToVs4UdapI2vSb16pcUo
R
X-Received: by 2002:a05:701b:4583:20b0:185:b157:f271 with SMTP id a92af1059eb24-1a6ce113ee5mr4231317c88.23.1793221181020;
Wed, 28 Oct 2026 13:59:41 -0700 (PDT)
X-Received: from samniyama.tailbcd61.ts.net ([76.20.4.3])
by smtp.gmail.com with ESMTPSA id a92af1059eb24-1a75d76814bsm7954568c88.10.2026.10.28.13.59.40
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 28 Oct 2026 13:59:40 -0700 (PDT)
X-Cc: pablo@netfilter.org,
fw@strlen.de,
phil@nwl.cc,
coreteam@netfilter.org,
netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Koral Ilgun <koral.ilgun@adtran.com>
X-Mailer: git-send-email 2.43.0
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list