From patchwork Mon Mar 25 18:58:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Flavio Leitner X-Patchwork-Id: 1064715 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sysclose.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=sysclose.org header.i=fbl@sysclose.org header.b="YuGYwbXH"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44Sk7c6g7kz9sSS for ; Tue, 26 Mar 2019 05:58:52 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729938AbfCYS6v (ORCPT ); Mon, 25 Mar 2019 14:58:51 -0400 Received: from sender-of-o51.zoho.com ([135.84.80.216]:21012 "EHLO sender-of-o51.zoho.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729238AbfCYS6u (ORCPT ); Mon, 25 Mar 2019 14:58:50 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1553540324; cv=none; d=zoho.com; s=zohoarc; b=b2A7xMNbfyQQOf+HCwr6VSkYRCQ4OeMmCUnPn0tPoS40WTO/4vFf3nO4rF85m7ZbbMnVNUH/yRPmk5A4YBg8Ar3HlO0gwmjlbC1JRA84FoSaM5U3Pu0gRsdLHxE4oT+mdvvHPRkZn7hNkW5DlsZ7OjGqzpSOIXu8dZFz2mTFSyM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1553540324; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To:ARC-Authentication-Results; bh=m/649Zh+j/IScF5MI9HXrvCcRR+tP7kSKiwVnfdBZ4Q=; b=lWUlaWh6MpSTbNPl+MBJZGPOb528T/IfxXaPUdOXOU8VnUcxyGNGAG3Ke6BhSHWpqnivNmF6bI4R1ksUR3BPFI5HJL7YC70AxK1tcVs/X8Ylr4dX3jQEOvga0u58rfYgAqaz+9zjwSvGS9gQYyqdHSIIdayqr5CM8rln0ImdlMU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass header.i=sysclose.org; spf=pass smtp.mailfrom=fbl@sysclose.org; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1553540324; s=zoho; d=sysclose.org; i=fbl@sysclose.org; h=From:To:Cc:Message-ID:Subject:Date:MIME-Version:Content-Transfer-Encoding:Content-Type; l=1216; bh=m/649Zh+j/IScF5MI9HXrvCcRR+tP7kSKiwVnfdBZ4Q=; b=YuGYwbXH36WhozNiuxSBY4WK7ktIHWTGVOPJNC6EBn3sUxSHYqT0SZqwKut01VFU olrHfyKzNkco4b5YSeZQp4UUQXPC/Z8OmQbdcoWk0n6JHCGnc5dx8jxJsx1askfDPUr P3nKG95CtFDbfuAW8pe5351+/oB8AU4+XOAXGKSw= Received: from localhost (177.183.215.126 [177.183.215.126]) by mx.zohomail.com with SMTPS id 1553540323039641.4013972572742; Mon, 25 Mar 2019 11:58:43 -0700 (PDT) From: Flavio Leitner To: netdev@vger.kernel.org Cc: Joe Stringer , Pravin B Shelar , dev@openvswitch.org, netfilter-devel@vger.kernel.org Message-ID: <20190325185831.27284-1-fbl@sysclose.org> Subject: [PATCH net-next v2] openvswitch: add seqadj extension when NAT is used. Date: Mon, 25 Mar 2019 15:58:31 -0300 X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-ZohoMailClient: External Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When the conntrack is initialized, there is no helper attached yet so the nat info initialization (nf_nat_setup_info) skips adding the seqadj ext. A helper is attached later when the conntrack is not confirmed but is going to be committed. In this case, if NAT is needed then adds the seqadj ext as well. Fixes: 16ec3d4fbb96 ("openvswitch: Fix cached ct with helper.") Signed-off-by: Flavio Leitner Acked-by: Pravin B Shelar --- net/openvswitch/conntrack.c | 6 ++++++ 1 file changed, 6 insertions(+) Changelog: v2 - removed nfct_help(ct) check as it is not necessary. diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c index 51080004677e..845b83598e0d 100644 --- a/net/openvswitch/conntrack.c +++ b/net/openvswitch/conntrack.c @@ -990,6 +990,12 @@ static int __ovs_ct_lookup(struct net *net, struct sw_flow_key *key, GFP_ATOMIC); if (err) return err; + + /* helper installed, add seqadj if NAT is required */ + if (info->nat && !nfct_seqadj(ct)) { + if (!nfct_seqadj_ext_add(ct)) + return -EINVAL; + } } /* Call the helper only if: