🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #8546

Re: [PATCH nf] netfilter: nft_flow_offload: do not offload multicast

#8546
From: Fernando Fernandez Mancera
Date: Thu, 29 Oct 2026 11:30
93 lines
16495 bytes
On 10/28/26 9:59 PM, Koral Ilgun wrote:
> 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;
>   }

The patch is sound and I think it is better skip the flow earlier here. 
I believe there is a bigger problem with IPv6 route engine not rejecting 
a routing request for a saddr that is multicast, I am already looking 
into that. In any case, couldn't we simplify this code as:

diff --git a/net/netfilter/nft_flow_offload.c 
b/net/netfilter/nft_flow_offload.c
index d3c5651dd699..7d0b87a1bca1 100644
--- a/net/netfilter/nft_flow_offload.c
+++ b/net/netfilter/nft_flow_offload.c
@@ -33,6 +33,10 @@ static bool nft_flow_offload_skip(struct sk_buff 
*skb, int family)

                 if (unlikely(opt->optlen))
                         return true;
+
+               return ipv4_is_multicast(ip_hdr(skb)->daddr);
+       } else if (family == NFPROTO_IPV6) {
+               return ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr);
         }

         return false;


Thanks,
Fernando.

>   
> 
> base-commit: 734bef548a96e8774d6eef5dfa2026c6edc4e80b
Technical Details
Message-ID: <cec680c8-7eb1-4a90-ba9a-e6723781cb79@suse.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353270-linux-kernel-netdev=dewy.ru
References: <20261028205938.662312-1-koralilgun@gmail.com>

Show 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-353270-linux-kernel-netdev=dewy.ru
From: fmancera@suse.de (Fernando Fernandez Mancera)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH nf] netfilter: nft_flow_offload: do not offload multicast
Date: Thu, 29 Oct 2026 12:30:08 +0100
Organization: Usenet Network
Message-ID: <cec680c8-7eb1-4a90-ba9a-e6723781cb79@suse.de>
References: <20261028205938.662312-1-koralilgun@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="1996723"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:LP1bPKxxVQOuMKBjQbCE5no0Fvk= sha256:yIXiL6i4244KIkz2ex5QMgECNQgIL1Djct/GuClAy/w=
	sha1:gmt8hau1/GbAylInSFZMgj0Ktt4= sha256:ymq+s6HqKcmy0Y3nyLuGdFv7cwzuIKZwDtJbdsqWDmw=
Content-Language: en-US
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 E53E3125C64; Thu, 29 Oct 2026 14:31:53 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.15
X-Spam-Status: No, score=-3.15 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	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 (1024-bit key)
	header.d=suse.de header.b=wka+4KDh; dkim=neutral
	reason="invalid (unsupported algorithm ed25519-sha256)"
	header.d=suse.de header.b=SGqzxJt1; dkim=pass (1024-bit key)
	header.d=suse.de header.b=wka+4KDh; dkim=neutral
	reason="invalid (unsupported algorithm ed25519-sha256)"
	header.d=suse.de header.b=SGqzxJt1
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 NLfxekfHjxho;
	Thu, 29 Oct 2026 14:31:51 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-353270-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=suse.de
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 2DB30125C62; Thu, 29 Oct 2026 14:31:32 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 66990601907; Thu, 29 Oct 2026 11:31:31 +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=1793273488;
	b=rDyKq7hO72EOOt/Q6Qte4reozsZMwoBIXyLJCS+9QwvypoEzZlb9qEJMuKxVep5xKoak
	 EpE+P3O9pS37l3MAvAi6XBrDd8MNyFXtVZ6p3lkC6MLTbAezJGzjxOmeXbwr4aIgUQ9x9
	 lFC0v+2wt6ASlIm/DaK/A2QU0/dt3jG4kZ06nWBJAGcYRagMgk00uvVz1H6z6dB/lgQHG
	 UhLoDHy50L9n7FA4rOZmDxKNduxigIW0B+Wo/WJ2ByOZPHn8ye3l7sH57cM/ahAsiHNef
	 EHPgi18U0d8V0lyxASTJcpvVyN4ljf5LRr1pn0EAk7N4jqtrPY8gEuH8KiJ5sdzZ62A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793273488;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 DKIM-Signature:DKIM-Signature:DKIM-Signature:Received:Received:
	 Message-ID:Date:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding:X-Spam-Flag:X-Spam-Level:
	 X-Spamd-Result:X-Spam-Score;
	bh=tjVTZSn+XDaK4kzFzUCDE27OhwqyotiavTeXKJ2X2ow=;
	b=ItZoFtmfz68+L+ahP2FXUlwxmVTRHmkxkHOG0eXMv1G7/IRIenTfBdC+TkJALbKO+g4o
	 3zV1lrQVOeJFEhCexNNE9lFsSRWcnCBaLOZv1CuxH/3rv82qv/i/2b/S5I86MnHYrCE1T
	 3TbOZvQcuvxf2/iQS+VGJXTsgMpEbA21PMCinf7zl9a3TE5lw4nZbFo7xQDULdAi3wags
	 FFM+8nkZ4o8jJEgFP093ryb3T2pqiqAZkRMhpegpl+zAc019AxZynFbROnGfFS5aJOr1E
	 Wq5iOt9pBg/5Kg360iTi5GD9pZ5EgoYi58Up4oMy1Wx1pUOSUFP4s6E6eIlffJEaYQw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=wka+4KDh;
	dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SGqzxJt1;
	dkim=pass header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=wka+4KDh;
	dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SGqzxJt1;
	dmarc=pass header.from=suse.de;
	spf=pass smtp.mailfrom=suse.de;
	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 4BB0C606A322;
	Thu, 29 Oct 2026 11:31:28 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=wka+4KDh;
	dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SGqzxJt1;
	dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=wka+4KDh;
	dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SGqzxJt1
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.135.223.130
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793273487;
	b=xAARLbtxuTqI5DfeXZaiLPoAHLAeFGsjYWTXThKeIhyJYeeXEXP99e8h1g6rpgRzmBWL
	 oEgFDc1DfRL643EBZW6xM/OVKwzS4J4WcAor1GB8Dbo8IVlLRYSk18oFBkox3FP0iOgvg
	 Hs3nK5HPCAHzB6LEysyC2TSIXxZi+FI8Y828MD8/0W3cbkNeDRUiaZy+BJsDLAF5pjwWH
	 rgw+P+WmM7kGsticXAT+b08zJ/0recFk3TMTAZm5a7M9eqqSU2cAchlcDfxnDQJX8LKY/
	 zh/bWPiPUFqA69kkVV7aSz94iIyDwqbZspwkwzuK/WrWaso64auymuniEa+2Rm820bg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793273487;
	h=DMARC-Filter:Received:DKIM-Signature:DKIM-Signature:DKIM-Signature:
	 DKIM-Signature:Received:Received:Message-ID:Date:MIME-Version:
	 User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding:X-Spam-Flag:X-Spam-Level:
	 X-Spamd-Result:X-Spam-Score;
	bh=tjVTZSn+XDaK4kzFzUCDE27OhwqyotiavTeXKJ2X2ow=;
	b=s/zspuMclqqYdGFQzWUmSJuO2pkVa5nTKH0TieuNzM5K1kSBwF6rZMonvSGoTwE5EQun
	 DJLoHDrkWU+GcD1nWjhQa+Myc36t7M29msnI30HKyIgd0thTWAYIANiPMlm1yHXxSvhup
	 X3uvvLZYaao5r6JLqiVWD6Q/gjK5nZE4W7BLzNPcDX40415DfJuZzF4anwuEom5UaZQSV
	 gnUcp22mH0QKUI8qm+bq3sYgrrngH2zJeFc/Wtb9VIixxU1ZjaFJDbdcXft9TNQjBTCoM
	 XEvDXMwBiXLr/YOEWdyPCGrbd7j9nDVyD5Nt4ekR41w7H1Uwe8AFzoo4d9H9jPaTsMA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=suse.de;
	spf=pass smtp.mailfrom=suse.de;
	dkim=pass header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=wka+4KDh;
	dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SGqzxJt1;
	dkim=pass header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=wka+4KDh;
	dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SGqzxJt1;
	arc=none smtp.remote-ip=195.135.223.130
X-Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA9B6606A31A;
	Thu, 29 Oct 2026 11:31:26 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AA9B6606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de
X-Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp-out1.suse.de (Postfix) with ESMTPS id B421A21F41;
	Thu, 29 Oct 2026 11:31:24 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa;
	t=1793273484; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=tjVTZSn+XDaK4kzFzUCDE27OhwqyotiavTeXKJ2X2ow=;
	b=wka+4KDhldbLQT6m+X5KOCx2dB+6sSZtfaFc0xpw+DGa3gfmu/Uuzx/HATxfUTtaZbRUGz
	leEVoDAq34yufGiUlGnY7d3/BvPqn/M5GY6X3nbOrbzYbFkcVlYZ4970DFEaNNQoldvC7C
	sqPHFJc4KAYgVE4eDZQvm3A7QKhq2YM=
X-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;
	s=susede2_ed25519; t=1793273484;
	h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=tjVTZSn+XDaK4kzFzUCDE27OhwqyotiavTeXKJ2X2ow=;
	b=SGqzxJt19DPz0ZsY9k6f4n6gtWdOJhqzZYrdl9tKY+LnfnYp2hNjL195plPP8xcFd+f1TR
	QyvKTyVPMqPbsaCQ==
X-Authentication-Results: smtp-out1.suse.de;
	none
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa;
	t=1793273484; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=tjVTZSn+XDaK4kzFzUCDE27OhwqyotiavTeXKJ2X2ow=;
	b=wka+4KDhldbLQT6m+X5KOCx2dB+6sSZtfaFc0xpw+DGa3gfmu/Uuzx/HATxfUTtaZbRUGz
	leEVoDAq34yufGiUlGnY7d3/BvPqn/M5GY6X3nbOrbzYbFkcVlYZ4970DFEaNNQoldvC7C
	sqPHFJc4KAYgVE4eDZQvm3A7QKhq2YM=
X-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;
	s=susede2_ed25519; t=1793273484;
	h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=tjVTZSn+XDaK4kzFzUCDE27OhwqyotiavTeXKJ2X2ow=;
	b=SGqzxJt19DPz0ZsY9k6f4n6gtWdOJhqzZYrdl9tKY+LnfnYp2hNjL195plPP8xcFd+f1TR
	QyvKTyVPMqPbsaCQ==
X-Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1F08513419;
	Thu, 29 Oct 2026 11:31:24 +0000 (UTC)
X-Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])
	by imap1.dmz-prg2.suse.org with ESMTPSA
	id UydtOIsu42qIBQAAD6G6ig
	(envelope-from <fmancera@suse.de>); Thu, 29 Oct 2026 11:31:24 +0000
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
X-User-Agent: Mozilla Thunderbird
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-In-Reply-To: <20261028205938.662312-1-koralilgun@gmail.com>
X-Spamd-Result: default: False [-13.29 / 50.00];
	SUSE_INTERNAL_BYPASS(-9.00)[];
	BAYES_HAM(-3.00)[100.00%];
	NEURAL_HAM_LONG(-1.00)[-1.000];
	NEURAL_HAM_SHORT(-0.20)[-1.000];
	MIME_GOOD(-0.10)[text/plain];
	XM_UA_NO_VERSION(0.01)[];
	RCPT_COUNT_SEVEN(0.00)[9];
	FREEMAIL_TO(0.00)[gmail.com,vger.kernel.org];
	RCVD_VIA_SMTP_AUTH(0.00)[];
	MIME_TRACE(0.00)[0:+];
	ARC_NA(0.00)[];
	MID_RHS_MATCH_FROM(0.00)[];
	FREEMAIL_ENVRCPT(0.00)[gmail.com];
	DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];
	FROM_EQ_ENVFROM(0.00)[];
	FROM_HAS_DN(0.00)[];
	TO_DN_SOME(0.00)[];
	RCVD_TLS_ALL(0.00)[];
	TO_MATCH_ENVRCPT_ALL(0.00)[];
	RCVD_COUNT_TWO(0.00)[2];
	DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]