From patchwork Sun Jul 8 11:36:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harsha Sharma X-Patchwork-Id: 941016 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.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=netfilter-devel-owner@vger.kernel.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="eOyzHsnJ"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41NmdF029Nz9s1b for ; Sun, 8 Jul 2018 21:36:32 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754231AbeGHLga (ORCPT ); Sun, 8 Jul 2018 07:36:30 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:51949 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754227AbeGHLg3 (ORCPT ); Sun, 8 Jul 2018 07:36:29 -0400 Received: by mail-wm0-f67.google.com with SMTP id s12-v6so18522849wmc.1 for ; Sun, 08 Jul 2018 04:36:29 -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; bh=bKAzUuV60RqANG05YpOa4wdG4blxZD7uOimPeskyIT4=; b=eOyzHsnJJICNxbzOxgbT0+HZsFp/edEfsQCkCAhARF4synZj1Cpt4L53D+z1rZryga yfZL1BbeWQTe0yh/MJgubVKNQkNZlWj7PF7CpLR1bX7QRvDXvNoAR5wCJh8SI0YeYzhh Cw/OyaQht2v/1Ux8T8pd+YUfSfhftAOZnJfgsR7D4mtNXqC8XbPayGtNgn1LydmiPtle 7gkdjY3mpxZQ3NbaBwIHhuyA8HvotmzfraeFe1HwUlMlkTn4YrfQDQpbd6Rex9vUUfjZ I+UFs5JUC/aOCMEVgfnROi3DERa32zVXYJTEsTHUvl5jHIGjkFNon4MFb7pttdDbf6J+ AqEA== 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; bh=bKAzUuV60RqANG05YpOa4wdG4blxZD7uOimPeskyIT4=; b=eyu095nR5aDhN8KOUUl76z/gF1u/ao6LX0Hxj6PawzU7vrVrHkXFLSBh3nuhTS55EZ D7t0Jt4rjzxlU3rV6JkLisRZacZ7aG9L/eLa7SU/rKOq+mSFgPqksUOaufOxh5kJSlPp 4+iIXiiDqJSxYppMAzgdf4WlJLK8Y3cwPQe7XOp9+h7LgdOyZY07vsZ/aA+rSP0ZlOsq y0WYJ9GpFaGw7SahXOdQjLHdHMb6ZfSufh1EseM62VS62C2IQHCp0MRdCiepIMuOg+d4 GcDLoWJly3sjyRdUvfN54SDYKsHttxfSTqHSrcwofJfqEhPwxaR58pX1n7D+BxO8iEAr zjfg== X-Gm-Message-State: APt69E3qGMUQnLtMP90q7O9ddj6uQFni+8C8zFcgP7WsbcSIuLUuw/JY mRCqEkUNnQ6QNVI6/paSI4c= X-Google-Smtp-Source: AAOMgpdqY08kNhF1Tfqkgvz1wVAdsnS+s60pwEQIdRuR/JLOfuEjjZfGSbLIJKR2zJ1WiMuTq9YoSA== X-Received: by 2002:a1c:55c8:: with SMTP id j191-v6mr9673513wmb.67.1531049788409; Sun, 08 Jul 2018 04:36:28 -0700 (PDT) Received: from XDDDDD.fritz.box ([2001:16b8:2dc3:ed00:1559:4a7f:e13d:ffeb]) by smtp.gmail.com with ESMTPSA id 35-v6sm7816629wri.78.2018.07.08.04.36.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Jul 2018 04:36:27 -0700 (PDT) From: Harsha Sharma To: harshasharmaiitr@gmail.com, pablo@netfilter.org Cc: netfilter-devel@vger.kernel.org Subject: [PATCH nft] tests: py: add ct timeout tests Date: Sun, 8 Jul 2018 13:36:20 +0200 Message-Id: <20180708113620.20098-1-harshasharmaiitr@gmail.com> X-Mailer: git-send-email 2.14.1 Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Add test for adding ct timeout objects and assigning it via rule. Signed-off-by: Harsha Sharma --- tests/py/ip/objects.t | 6 ++++++ tests/py/ip/objects.t.payload | 4 ++++ tests/py/nft-test.py | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/tests/py/ip/objects.t b/tests/py/ip/objects.t index 5e8c763..82638f2 100644 --- a/tests/py/ip/objects.t +++ b/tests/py/ip/objects.t @@ -32,3 +32,9 @@ ct helper set tcp dport map {21 : "cthelp1", 2121 : "cthelp1" };ok ip saddr 192.168.1.3 limit name "lim1";ok ip saddr 192.168.1.3 limit name "lim3";fail limit name tcp dport map {443 : "lim1", 80 : "lim2", 22 : "lim1"};ok + +# ct timeout +%cttime1 type ct timeout { protocol:tcp, established:122 ;};ok +%cttime2 type ct timeout { protocol:udp, syn_sent:122 ;};fail + +ct timeout set "cttime1";ok diff --git a/tests/py/ip/objects.t.payload b/tests/py/ip/objects.t.payload index 193d797..4ab5b73 100644 --- a/tests/py/ip/objects.t.payload +++ b/tests/py/ip/objects.t.payload @@ -59,3 +59,7 @@ ip test-ip4 output [ cmp eq reg 1 0x00000006 ] [ payload load 2b @ transport header + 2 => reg 1 ] [ objref sreg 1 set __objmap%d ] + +# ct timeout set "cttime1" +ip test-ip4 output + [ objref type 6 name cttime1 ] diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py index e4367ad..5e9e2e3 100755 --- a/tests/py/nft-test.py +++ b/tests/py/nft-test.py @@ -1082,6 +1082,10 @@ def obj_process(obj_line, filename, lineno): obj_type = "ct helper" tokens[3] = "" + if obj_type == "ct" and tokens[3] == "timeout": + obj_type = "ct timeout" + tokens[3] = "" + if len(tokens) > 3: obj_spcf = " ".join(tokens[3:])