From patchwork Tue Oct 15 17:27:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi-Hung Wei X-Patchwork-Id: 1177250 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="dF6mhplT"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46t2mc4Q9Sz9sPF for ; Wed, 16 Oct 2019 04:41:52 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 4F900EE1; Tue, 15 Oct 2019 17:39:26 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 83D80ED6 for ; Tue, 15 Oct 2019 17:39:24 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 3A5586C5 for ; Tue, 15 Oct 2019 17:39:24 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id p12so3233205pgn.6 for ; Tue, 15 Oct 2019 10:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=F8YjLLu7jH97iIH9j91rMUHNw4EW7mCrXDKWY8urhIg=; b=dF6mhplTtBI+gXsfYMmT12Q1fwIsBwpZyluJdDAqtUqEeoWEcENMHZlwljnp25YcRG FGoT26aFo8zaIAryJ1iJpG2fHMvmlYRZljaLy8sWkDpMJZvwtrwORigvKCTXnScqDGx/ /kzkkO7VD7aw7aibLq8bqe+4oddyyVHkDA7W88aKKhfcM4UOBPFGzS2XPY/g+C2hwBw6 gFBrfoXy+uyJzoqK0yINRvRwaWQX+TUZJiLUhzK0EKMZQTYEI5cCX8jz/ScrafeD1TmZ hSGb5aPNc0L3qT2Um6KVLvEY3S95D5l9foULAHtUGLVaiM/JEZKMq2cILmQjJpOJxOMf oKGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=F8YjLLu7jH97iIH9j91rMUHNw4EW7mCrXDKWY8urhIg=; b=dVxMU8DsKB/Q01rbiQIVz30jvcfTniowsP+GXk0Kb9XaRNyPoGZqiGpz/87qkRIzaf H9hkmsdi8EybS41yDIUIGEyWgmE/GpbDZQE8JbIhafqDQbwbiq0T3JNxeDqKLGKJHAk2 UUqiZs5dinAYvi13x2WomT3ZPO/ZedFeeE7j998RfggAWpUzWSp7WNuBuqRskLx3h+MC D0fsH13F5D70PRZshf0t5Dze3yq9nYxWClAL/T8TRPezsZuP6Zp7H+wbmSKYzBMcZURl aiIbXIzBeZNcULbIFxnT/wwSXDzDmZW9kUP1fUL3dPRWC+OBFdLaPga1lUhi1rRNPXTb aEQQ== X-Gm-Message-State: APjAAAVVmflx2sjK5mH/ZYcWxvoC/eXAOHSZnSxqh97nRImkLhWvFSAA Ujfg8mvt+C1owffyzoMhRObdP7tA0bs= X-Google-Smtp-Source: APXvYqzWIWLycUmg+GGMnyubdfCRh/WUoWg7K0bLvCgC9+DnnWA4EYToQiyuACiGYBlgoeCIf25SHA== X-Received: by 2002:a63:2d43:: with SMTP id t64mr39592499pgt.428.1571161163306; Tue, 15 Oct 2019 10:39:23 -0700 (PDT) Received: from Husky.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id q204sm25590311pfc.11.2019.10.15.10.39.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 15 Oct 2019 10:39:22 -0700 (PDT) From: Yi-Hung Wei To: dev@openvswitch.org Date: Tue, 15 Oct 2019 10:27:45 -0700 Message-Id: <1571160473-46132-5-git-send-email-yihung.wei@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1571160473-46132-1-git-send-email-yihung.wei@gmail.com> References: <1571160473-46132-1-git-send-email-yihung.wei@gmail.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Flavio Leitner Subject: [ovs-dev] [PATCH v2 04/12] datapath: add seqadj extension when NAT is used. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Flavio Leitner upstream patch: commit fa7e428c6b7ed3281610511a2b2ec716d9894be8 Author: Flavio Leitner Date: Mon Mar 25 15:58:31 2019 -0300 openvswitch: add seqadj extension when NAT is used. 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 Signed-off-by: David S. Miller Signed-off-by: Yi-Hung Wei Reviewed-by: Yifeng Sun --- datapath/conntrack.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/datapath/conntrack.c b/datapath/conntrack.c index 291d4f4723d9..1b345a03e704 100644 --- a/datapath/conntrack.c +++ b/datapath/conntrack.c @@ -1063,6 +1063,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: