Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2008161pxu; Fri, 9 Oct 2020 05:47:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyClpm2JLbIQs91Erp7QHpR+uWVwIa8sLJgWV/6egRl5xAaDdJtUpnbl90hnLiXYKElXjOc X-Received: by 2002:a17:906:7016:: with SMTP id n22mr14737328ejj.402.1602247672952; Fri, 09 Oct 2020 05:47:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602247672; cv=none; d=google.com; s=arc-20160816; b=MoUUYFKTtMLhdH4o96t2muhPx1oRvL8jHTDlNtCSGhHnD4Zi4TpAf4NatDzXOngrM3 du/5CT4vjqm6zjVKhc+0dd5bct5rIG2Anv/PU5bUQg9f5dahLy98Tm9F6y251AP7Ukaq k9a6zRFqmv8YVRCbYAHlpGYWHrW+5tw98FG5WHhPglE9+9XdF2+D8gsWcfE3Q2aIpSyZ kOp9a195al/lSazxh9zFQ0NKtNqLNZ50HoV6UDUztOdHHj3xGU8RjRzN1UVkbfjvbDUN UkAIZsMjvedxzlH98g+07nWDZmyMDUhGylZx9D/VLOicp5eQTiGyxlHO9olg4yFBTIY8 c9Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=fPiYlt7VB7hKTUDjHNey/H9FFFT7TiUAMjyf5wt5L/0=; b=p5G3Un0Wt7kQ5R1iENqRChURBMv642aK/oTF1+Ec7NoAFdEJXWaDebanCaxTLnrMyo PlApC8iv7w82AOwh1XIT3NsY+Y5OiOd2Ty9x1rAZqYczIxkmRyH6szJcaW74FOs/jciA 3anzQrfuBEVehYPJH0gNSfA40EIA53HfgmFeZgI6jABzdBNcm9666p/AyXz3m4dct95b U96ZWKvl6lBLs7qmHW3r2+toqUTBd6rguY2/HOkuJeNA82/0I+81Y8BfWVaKDGzfcDHD tBARcbH8jG8tk/fmno6ugNrizchV69nOwcyXv2LuvrklWArrPx2ZeukAD3xPNMK2Mh5F y1tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i15si6078261ejb.337.2020.10.09.05.47.30; Fri, 09 Oct 2020 05:47:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387900AbgJILDb (ORCPT + 99 others); Fri, 9 Oct 2020 07:03:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732761AbgJILDb (ORCPT ); Fri, 9 Oct 2020 07:03:31 -0400 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50BC9C0613D2; Fri, 9 Oct 2020 04:03:31 -0700 (PDT) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1kQqBH-0006lw-QK; Fri, 09 Oct 2020 13:03:23 +0200 Date: Fri, 9 Oct 2020 13:03:23 +0200 From: Florian Westphal To: Jozsef Kadlecsik Cc: Francesco Ruggeri , open list , netdev , coreteam@netfilter.org, netfilter-devel@vger.kernel.org, Jakub Kicinski , David Miller , fw@strlen.org, Pablo Neira Ayuso Subject: Re: [PATCH nf v2] netfilter: conntrack: connection timeout after re-register Message-ID: <20201009110323.GC5723@breakpoint.cc> References: <20201007193252.7009D95C169C@us180.sjc.aristanetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jozsef Kadlecsik wrote: > > Any comments? > > Here is a simple reproducer. The idea is to show that keepalive packets > > in an idle tcp connection will be dropped (and the connection will time > > out) if conntrack hooks are de-registered and then re-registered. The > > reproducer has two files. client_server.py creates both ends of a tcp > > connection, bounces a few packets back and forth, and then blocks on a > > recv on the client side. The client's keepalive is configured to time > > out in 20 seconds. This connection should not time out. test is a bash > > script that creates a net namespace where it sets iptables rules for the > > connection, starts client_server.py, and then clears and restores the > > iptables rules (which causes conntrack hooks to be de-registered and > > re-registered). > > In my opinion an iptables restore should not cause conntrack hooks to be > de-registered and re-registered, because important TCP initialization > parameters cannot be "restored" later from the packets. Therefore the > proper fix would be to prevent it to happen. Otherwise your patch looks OK > to handle the case when conntrack is intentionally restarted. The repro clears all rules, waits 4 seconds, then restores the ruleset. using iptables-restore < FOO; sleep 4; iptables-restore < FOO will not result in any unregister ops. We could make kernel defer unregister via some work queue but i don't see what this would help/accomplish (and its questionable of how long it should wait). We could disallow unregister, but that seems silly (forces reboot...). I think the patch is fine.