From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FBC417C4 for ; Wed, 19 Jul 2023 02:58:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CE68C433C7; Wed, 19 Jul 2023 02:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689735508; bh=D6w6EeYtNDLWbQlw/yP+9AleWHyemKxx0ltn0aIqius=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=sWcU+iZQs3Ox31kZv4QQmp8MUgq1weM87kotu6Q3oyurJyGlZ7xdJ81CFTMkXfZXh uL4gePmvjrAboUQ2Chf+Z5iCQNUvNc9bfWn/GO4ViWWCLwfHieGGNATid1/xgfzk3w EUpNU7JfnVkqI4Sy7mrIt4bsXQ0Y3b1/WW4e3Hl6w9UKKb9XYPV67W5iAaMkjczF8k cCPQWZzDY85wWkLEUJJQd4OTBV8DAfElP0GbWXh9NogjjeEkK8PLM3Ef7oVEKroNg9 /4GTXF1JrIxnAl2oZ5x15BUKbrfgm+NTswyk1M0UXqLrCiocijxuRQMCTNiV1tr0W8 vi0zphRMFfnbw== Date: Tue, 18 Jul 2023 19:58:27 -0700 From: Jakub Kicinski To: Pablo Neira Ayuso , Florian Westphal Cc: Xin Long , network dev , dev@openvswitch.org, davem@davemloft.net, Eric Dumazet , Paolo Abeni , Pravin B Shelar , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Marcelo Ricardo Leitner , Davide Caratti , Aaron Conole Subject: Re: [PATCH net-next 0/3] net: handle the exp removal problem with ovs upcall properly Message-ID: <20230718195827.4c1db980@kernel.org> In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sun, 16 Jul 2023 17:09:16 -0400 Xin Long wrote: > With the OVS upcall, the original ct in the skb will be dropped, and when > the skb comes back from userspace it has to create a new ct again through > nf_conntrack_in() in either OVS __ovs_ct_lookup() or TC tcf_ct_act(). > > However, the new ct will not be able to have the exp as the original ct > has taken it away from the hash table in nf_ct_find_expectation(). This > will cause some flow never to be matched, like: > > 'ip,ct_state=-trk,in_port=1 actions=ct(zone=1)' > 'ip,ct_state=+trk+new+rel,in_port=1 actions=ct(commit,zone=1)' > 'ip,ct_state=+trk+new+rel,in_port=1 actions=ct(commit,zone=2),normal' > > if the 2nd flow triggers the OVS upcall, the 3rd flow will never get > matched. > > OVS conntrack works around this by adding its own exp lookup function to > not remove the exp from the hash table and saving the exp and its master > info to the flow keys instead of create a real ct. But this way doesn't > work for TC act_ct. > > The patch 1/3 allows nf_ct_find_expectation() not to remove the exp from > the hash table if tmpl is set with IPS_CONFIRMED when doing lookup. This > allows both OVS conntrack and TC act_ct to have a simple and clear fix > for this problem in the patch 2/3 and 3/3. Florian, Pablo, any opinion on these? Would you prefer to take them via netfilter?