From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f66.google.com (mail-ej1-f66.google.com [209.85.218.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5962742B75E for ; Tue, 5 May 2026 11:01:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.66 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777978875; cv=none; b=Zn5aVgWKwbTdJuiQ17sYvsrVuSw1P4QPQgHZsqHITBKQsD+kUAUWQEAK2SrpxR9UMNwpo9F2B53VjWj6zBQvqdLZ6TCFLEIQJIaz2Su1xueqTBuMhbemCxdjbdWTQZSr5qPGQamB0VkNi7AKN6tKx6+/hh6iPZAcRfJxG3uqeH0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777978875; c=relaxed/simple; bh=yZHX2zu6pRXp/aiFpcnEVJYoWFJl2mSPRNnA8tmDQVs=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=boLOCdXrv91S8BWTwRG/kLXABcNjl0WLE2VvBaKAN0ZQLezUKTMPyV/Iag/51rlqkPBcc1IuLBg730fYMbCcUwDfyCyjNQMM1/Z9IVFRJNHbSZq83QsaRbvUBUI8Ydkyl9dzCTDIs7+5gvRIjH22u7g61lXPvPVoPH8oO1Lw0H4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ovn.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ovn.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f66.google.com with SMTP id a640c23a62f3a-b9c603ec2dfso711027466b.1 for ; Tue, 05 May 2026 04:01:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777978871; x=1778583671; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:to:subject:cc:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DArCLHy5i8lXdAo5MW+nZY6yAncYzCTVpd/mPRM7974=; b=d/QIemBm1CGl559dr1vBJC9AmV3Aqy6WqHMxt5cRywiChs8TmtQzwscy+DbZZulE4p +fQi3L9Xr7FE4pdeZw1lWFwkeahmlx9RkqIA6c5y+jw3w8lx0swSWONQIRiPUOamgVE/ TRSuqlmjVk3g1Vq2ihdjVmlrVip3axi22UqoaTXoS+EkWc8+dpbRU2BVYDiiiXRuOwCb VA9wvzPn/4+UwwFDVqh/F/OJB5x0+dpTK2W5lW3ZWMg5eQXOAe1K8y9q1eXBT6pXV18U YCNK9dlJwDldHzwUC4G6BBM1PmnTFAo2ZAx3qG55MgcVs8XC0eo2afRBg534Mhi0BAWg rthg== X-Forwarded-Encrypted: i=1; AFNElJ8R6dbHxjh1xo7MPIPMUuJDz6FaeNt3Ug7gN24qFkWYftzg+NW4tcpoPhTuLW6FWphUyOBlcj0=@vger.kernel.org X-Gm-Message-State: AOJu0YyLlTGsPT9mYa1o5C2/BJBoNPIHR9nfEz1Sibgs9teY002ueShx NvdDQcBcHTZYwKV46Y//vb/C/89lq7mmWaWTgDom1WtO9irxZk4/dE2/ X-Gm-Gg: AeBDiet/yTks4P1veylR3FjkF+sEghPzOmfikHVBUJX4mTW33xHq5rFlObZYTsFrHYn tSVsX4wNLbFqPoRHQJGKRGT/vDx5a2optcis5C4lAN945PQj9MelqUWDFK+Mke2eo2NUROzkrTU xnaLsov1+TNNydjI0lS1yIvWbX57xyceK4fxe4cfIO/YBUfrbGeOK8EdQwcQev/SI+f8KkNS62S aQqEChgJXTIdejZL827+ldJQhGbglAZTxI4/ap3lIqMjAs+SkradzvZ9RFk6y+hVFVyEtGPxpOF oxQXyrDD2F53VjHY6Wbz3p/0loSUcPsGuW2wAvEoSHDwu1GJdikuVEFOlOG9BdmF7+sRZwFWAPp AKQh8yOpitFdxUik+a6v32fyLGGuhnYwh2Gyxc/pfwjmdS+rZNCH67WNziwF9/NrQLpgZdZLfcM XhsDBSEwkNA/bW7GvNr/I8NYKPB4JMBeN9YKSa/tzutm+5wws+L56CkZS/CIFiwaw+Lw== X-Received: by 2002:a17:906:9f87:b0:b9b:ddb2:b1c1 with SMTP id a640c23a62f3a-bbffcf7eb2amr739165066b.21.1777978870741; Tue, 05 May 2026 04:01:10 -0700 (PDT) Received: from [192.168.88.241] (37-48-40-237.nat.epc.tmcz.cz. [37.48.40.237]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-bc4b921a277sm14495866b.3.2026.05.05.04.01.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 May 2026 04:01:10 -0700 (PDT) Message-ID: Date: Tue, 5 May 2026 13:01:08 +0200 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: i.maximets@ovn.org, netfilter-devel@vger.kernel.org, fw@strlen.de, davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, horms@kernel.org, Eelco Chaudron , Aaron Conole Subject: Re: [PATCH net 06/12] netfilter: nf_conntrack_expect: honor expectation helper field To: Pablo Neira Ayuso References: <20260326125153.685915-1-pablo@netfilter.org> <20260326125153.685915-7-pablo@netfilter.org> <8fd5d3a3-d1d7-4542-a0db-1678989940d4@ovn.org> Content-Language: en-US From: Ilya Maximets Autocrypt: addr=i.maximets@ovn.org; keydata= xsFNBF77bOMBEADVZQ4iajIECGfH3hpQMQjhIQlyKX4hIB3OccKl5XvB/JqVPJWuZQRuqNQG /B70MP6km95KnWLZ4H1/5YOJK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g3 fCikcHzYYWKaXS6HABEBAAHCwXwEGAEIACYCGwwWIQSH6ZrVEpascJjzbVq59+x3yCm/lgUC Z8H0qQUJDIjuxgAKCRC59+x3yCm/loAdD/wJCOhPp9711J18B9c4f+eNAk5vrC9Cj3RyOusH Hebb9HtSFm155Zz3xiizw70MSyOVikjbTocFAJo5VhkyuN0QJIP678SWzriwym+EG0B5P97h FSLBlRsTi4KD8f1Ll3OT03lD3o/5Qt37zFgD4mCD6OxAShPxhI3gkVHBuA0GxF01MadJEjMu jWgZoj75rCLG9sC6L4r28GEGqUFlTKjseYehLw0s3iR53LxS7HfJVHcFBX3rUcKFJBhuO6Ha /GggRvTbn3PXxR5UIgiBMjUlqxzYH4fe7pYR7z1m4nQcaFWW+JhY/BYHJyMGLfnqTn1FsIwP dbhEjYbFnJE9Vzvf+RJcRQVyLDn/TfWbETf0bLGHeF2GUPvNXYEu7oKddvnUvJK5U/BuwQXy TRFbae4Ie96QMcPBL9ZLX8M2K4XUydZBeHw+9lP1J6NJrQiX7MzexpkKNy4ukDzPrRE/ruui yWOKeCw9bCZX4a/uFw77TZMEq3upjeq21oi6NMTwvvWWMYuEKNi0340yZRrBdcDhbXkl9x/o skB2IbnvSB8iikbPng1ihCTXpA2yxioUQ96Akb+WEGopPWzlxTTK+T03G2ljOtspjZXKuywV Wu/eHyqHMyTu8UVcMRR44ki8wam0LMs+fH4dRxw5ck69AkV+JsYQVfI7tdOu7+r465LUfg== In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 5/5/26 1:16 AM, Pablo Neira Ayuso wrote: > Hi Ilya, > > On Mon, May 04, 2026 at 02:19:20PM +0200, Ilya Maximets wrote: >> On 5/1/26 12:37 PM, Pablo Neira Ayuso wrote: >>> Hi Ilya, >>> >>> On Thu, Apr 30, 2026 at 10:58:38PM +0200, Ilya Maximets wrote: >>>> On 3/26/26 1:51 PM, Pablo Neira Ayuso wrote: >>>>> The expectation helper field is mostly unused. As a result, the >>>>> netfilter codebase relies on accessing the helper through exp->master. >>>>> >>>>> Always set on the expectation helper field so it can be used to reach >>>>> the helper. >>>>> >>>>> nf_ct_expect_init() is called from packet path where the skb owns >>>>> the ct object, therefore accessing exp->master for the newly created >>>>> expectation is safe. This saves a lot of updates in all callsites >>>>> to pass the ct object as parameter to nf_ct_expect_init(). >>>>> >>>>> This is a preparation patches for follow up fixes. >>>>> >>>>> Signed-off-by: Florian Westphal >>>>> Signed-off-by: Pablo Neira Ayuso >>>>> --- >>>> >>>> Hi, Pablo and Florian. >>>> >>>> I was investigating FTP test failures in OVS with 7.0 kernel and bisected >>>> the issue down to this commit. AFAIU, with this change all the related >>>> connections over time gain their parents' helpers,. This is causing a change >>>> visible to the userspace, because FTP data connections are now reported to >>>> have helpers in the conntrack dump: >>>> >>>> # conntrack -L >>>> tcp 6 119 TIME_WAIT src=10.1.1.1 dst=10.1.1.2 sport=59534 dport=21 \ >>>> src=10.1.1.2 dst=10.1.1.1 sport=21 dport=59534 \ >>>> [ASSURED] mark=0 helper=ftp use=2 >>>> tcp 6 119 TIME_WAIT src=10.1.1.2 dst=10.1.1.1 sport=52709 dport=52381 \ >>>> src=10.1.1.1 dst=10.1.1.2 sport=52381 dport=52709 \ >>>> [ASSURED] mark=0 helper=ftp use=1 >>>> >>>> Before this commit only the control connection had helper=ftp reported in >>>> the dump. The traffic seems to work fine, but our tests fail because we >>>> do not expect the helper attached. >>>> >>>> AFAIU, it's generally not something that should be happening, as helpers >>>> on data connections do not really make much sense. But I'm just trying to >>>> figure out if you would consider this as a regression and fix in the kernel >>>> or if we should adjust our userspace components for this new dump content, >>>> which would not be very straightforward to do if we want to be able to run >>>> tests on both old and the new versions. >>>> >>>> What do you think? >>> >>> It seems previous behaviour to 9c42bc9db90a was inconsistent, ie. only >>> the h323 helper sets on exp->helper, then it shows helper= in expected >>> connections via ctnetlink. I guess this is for debugging given that >>> h323 is actually a family of helpers. >>> >>> To consistently skip dumping this for expected connections, probably >>> this is the way to do: >>> >>> diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conn >>> index eda5fe4a75c8..9491ae9e080e 100644 >>> --- a/net/netfilter/nf_conntrack_netlink.c >>> +++ b/net/netfilter/nf_conntrack_netlink.c >>> @@ -226,7 +226,7 @@ static int ctnetlink_dump_helpinfo(struct sk_buff *sk >>> const struct nf_conn_help *help = nfct_help(ct); >>> struct nf_conntrack_helper *helper; >>> >>> - if (!help) >>> + if (!help || ct->status & IPS_EXPECTED) >>> return 0; >>> >>> rcu_read_lock(); >> >> I'm not sure. I tried this change and it fixed one case but broke another. >> Looking at what we're testing, the old behavior (at least for FTP) was: >> "if helper was committed - report it, if not - don't". i.e. it's not really >> about the connection being expected it's about if the user committed the >> helper for the connection or not. >> >> Let me explain a few scenarios that we have in the OVS system tests and what >> I see with the old kernel (6.19), the new (7.0) and the patch above. >> >> A) The first scenario has the following OpenFlow rules (simplified): >> >> table=0,in_port=1,tcp,action=ct(alg=ftp,commit),2 >> table=0,in_port=2,tcp,action=ct(table=1) >> table=1,in_port=2,tcp,ct_state=+trk+est,action=1 >> table=1,in_port=2,tcp,ct_state=+trk+rel,action=1 >> >> This set of rule blindly commits every packet coming from port 1 with the >> helper and sends to port 2. Packets from port 2 are passed through ct and >> only related or established traffic is passed to port 1. This is a very >> rudimentary setup that users can make to allow ftp from port 1 towards port 2, >> but not in the opposite direction. >> >> For this scenario regardless of the kernel version or the patch above I see >> that both the data and the control connections have a helper reported in the >> ctnetlink dump. > > This ruleset then is attached the conntrack helper to data connection, > that is, ALG is inspecting the FTP data connection but it will just > find no patterns because it is only the FTP control connection that > creates expectations? Yes. It's just a "lazy" way to make the traffic work, we do not expect the helper on the data connection to do anything useful in this scenario. Best regards, Ilya Maximets.