All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nft] tests: py: Add meta time tests without 'meta' keyword
@ 2022-04-09 12:57 Martin Gignac
  2022-04-10 15:20 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Gignac @ 2022-04-09 12:57 UTC (permalink / raw)
  To: netfilter-devel

v1.0.2 of 'nft' fails on 'time < "2022-07-01 11:00:00"' but succeeds
when 'meta' is specified ('meta time < "2022-07-01 11:00:00"'). This
extends coverage by testing 'time' without 'meta'.

Signed-off-by: Martin Gignac <martin.gignac@gmail.com>
---
 tests/py/any/meta.t         |  2 ++
 tests/py/any/meta.t.payload | 14 ++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/tests/py/any/meta.t b/tests/py/any/meta.t
index e3beea2e..12fabb79 100644
--- a/tests/py/any/meta.t
+++ b/tests/py/any/meta.t
@@ -218,6 +218,8 @@ meta hour "17:00:00" drop;ok;meta hour "17:00" drop
 meta hour "17:00:01" drop;ok
 meta hour "00:00" drop;ok
 meta hour "00:01" drop;ok
+time < "2022-07-01 11:00:00" accept;ok;meta time < "2022-07-01 11:00:00" accept
+time > "2022-07-01 11:00:00" accept;ok;meta time > "2022-07-01 11:00:00" accept
 
 meta time "meh";fail
 meta hour "24:00" drop;fail
diff --git a/tests/py/any/meta.t.payload b/tests/py/any/meta.t.payload
index 15439062..16dc1211 100644
--- a/tests/py/any/meta.t.payload
+++ b/tests/py/any/meta.t.payload
@@ -1058,3 +1058,17 @@ ip meta-test input
   [ meta load hour => reg 1 ]
   [ cmp eq reg 1 0x0001359c ]
   [ immediate reg 0 drop ]
+
+# time < "2022-07-01 11:00:00" accept
+ip test-ip4 input
+  [ meta load time => reg 1 ]
+  [ byteorder reg 1 = hton(reg 1, 8, 8) ]
+  [ cmp lt reg 1 0xf3a8fd16 0x00a07719 ]
+  [ immediate reg 0 accept ]
+
+# time > "2022-07-01 11:00:00" accept
+ip test-ip4 input
+  [ meta load time => reg 1 ]
+  [ byteorder reg 1 = hton(reg 1, 8, 8) ]
+  [ cmp gt reg 1 0xf3a8fd16 0x00a07719 ]
+  [ immediate reg 0 accept ]
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-11  3:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-09 12:57 [PATCH nft] tests: py: Add meta time tests without 'meta' keyword Martin Gignac
2022-04-10 15:20 ` Pablo Neira Ayuso
2022-04-11  3:43   ` Martin Gignac

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.