From patchwork Sun Aug 5 12:34:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harsha Sharma X-Patchwork-Id: 953523 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="hmL4kSxQ"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41k0dM47JBz9ryt for ; Sun, 5 Aug 2018 22:36:23 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726150AbeHEOks (ORCPT ); Sun, 5 Aug 2018 10:40:48 -0400 Received: from mail-pf1-f180.google.com ([209.85.210.180]:41453 "EHLO mail-pf1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726100AbeHEOks (ORCPT ); Sun, 5 Aug 2018 10:40:48 -0400 Received: by mail-pf1-f180.google.com with SMTP id y10-v6so5498239pfn.8 for ; Sun, 05 Aug 2018 05:36:22 -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=3t28Fd2xNIE5dkN7T0drxTKS4bPDpIBo0RE1rB7u/X4=; b=hmL4kSxQJpQw2x2KF3rdBPLdsnhqyoM7siss/5VeYQa+OeDqNNzeUAkA/UmLC7Hc6y hNJToo9nhvOZz0poQygaRmvyXwolGaOyz0FMv3m6GdWiedPYwgvo5hO0g35qBsZPdZx4 C5mol8Yz6GlAqBs5MSwwRZLIrgdT0lOoiqi6E6YQXEnxAXifyV6B1HqPIDtAYfOpSDCd aRqUiHGge3MWRLnmQW9cpWU8sNQ/EBaKRmGeesZY5Ky29Y4/jyT8rLFAm9Yd+vsqxt3C 85QOnMX1R36rS1nc10bYr7chUTZcQmDG81NxMUXKLC4TA+aTXA/RxdFopkNdGlzocowG syNw== 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=3t28Fd2xNIE5dkN7T0drxTKS4bPDpIBo0RE1rB7u/X4=; b=eXEQFOLf91cwoTbpgDbFgMKSIMoQZjh187NXIJhD78IiwbcIqzxsHrpHzzqkogfkzR m/jUj6FUYhJi2mMEsGmbXnETrvxTIkDuD4yB1ehTZ8BjeaIkto/u9uTW5bDxAdcijaGs wenOe9yGJRzyrCd64kCTFDrN6OhTE1Zq7dXX2Q/4k1YvixSlnXAYi3EbaIgRzmpgdij+ qTV1rTwDuWorE2gWzjTZ1hb7++EYAhPaaDd8T5HEcee4Rex7BzeG89vmBANApCHJfGVv YbRNr3hpDLvJza1Z94umgkFZp6ikGTLeFH9Di2CZ8znsB2Yv9+ofp9AYAwlxuPhQUSTs swjw== X-Gm-Message-State: AOUpUlFgwq2rqvDvhE/g2esHBZ50P9fQXyKc4n0ZFmBJFsVLgbtTr+da Iok9kMkzoH45WWx0Uz0blX8= X-Google-Smtp-Source: AAOMgpe7UZa1zEMCyJXfPbHhtPAUPWIBW5TGIXSpro8gC1n1EHTGiSoc3ZY5GNsXLJ8T9Wr/xiGnKA== X-Received: by 2002:a63:338e:: with SMTP id z136-v6mr10607370pgz.171.1533472580337; Sun, 05 Aug 2018 05:36:20 -0700 (PDT) Received: from XDDDDD.iitr.ernet.in ([103.37.201.44]) by smtp.gmail.com with ESMTPSA id r19-v6sm14051172pgo.68.2018.08.05.05.35.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Aug 2018 05:36:19 -0700 (PDT) From: Harsha Sharma To: harshasharmaiitr@gmail.com, pablo@netfilter.org Cc: netfilter-devel@vger.kernel.org Subject: [PATCH nft v4 2/3] tests: py: add ct timeout tests Date: Sun, 5 Aug 2018 18:04:42 +0530 Message-Id: <20180805123442.19143-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 --- Changes in v4: - update tests with syntax Changes in v3: - Add more tests for multiple timeout policies Changes in v2: - No change tests/py/ip/objects.t | 9 +++++++++ tests/py/ip/objects.t.payload | 4 ++++ tests/py/nft-test.py | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/tests/py/ip/objects.t b/tests/py/ip/objects.t index 5e8c763..4666809 100644 --- a/tests/py/ip/objects.t +++ b/tests/py/ip/objects.t @@ -32,3 +32,12 @@ 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; policy = { established:122 } ;};ok +%cttime2 type ct timeout { protocol udp; policy = { syn_sent:122 } ;};fail +%cttime3 type ct timeout { protocol tcp; policy = { established:132, close:16, close_wait:16 } ;};ok +%cttime4 type ct timeout { protocol udp; policy = { replied:14, unreplied:19 } ;};ok +%cttime5 type ct timeout {protocol tcp; policy = { estalbished:100 } ;};fail + +ct timeout set "cttime1";ok diff --git a/tests/py/ip/objects.t.payload b/tests/py/ip/objects.t.payload index 193d797..719b6c3 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 7 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:])