]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: py: add expires tests with different time bases
authorFlorian Westphal <fw@strlen.de>
Wed, 9 May 2018 09:59:39 +0000 (11:59 +0200)
committerFlorian Westphal <fw@strlen.de>
Wed, 9 May 2018 09:59:39 +0000 (11:59 +0200)
Signed-off-by: Florian Westphal <fw@strlen.de>
tests/py/any/ct.t
tests/py/any/ct.t.payload

index ce6d51a40115147fc70c59550b048731aeb268b6..5ed3b4a0f0900524fdcca67fc5412085193f04cc 100644 (file)
@@ -63,8 +63,11 @@ ct zone set {123, 127};fail
 ct label set {123, 127};fail
 ct event set {new, related, destroy, label};fail
 
-ct expiration 30;ok;ct expiration 30s
-ct expiration 22;ok;ct expiration 22s
+ct expiration 30s;ok
+ct expiration 30000ms;ok;ct expiration 30s
+ct expiration 1m-1h;ok
+ct expiration 1d-1h;fail
+ct expiration > 4d23h59m59s;ok
 ct expiration != 233;ok;ct expiration != 3m53s
 ct expiration 33-45;ok;ct expiration 33s-45s
 ct expiration != 33-45;ok;ct expiration != 33s-45s
index 9f288e79140dfccc7014de6273b4da6bbb8bc4a7..9338466d5df415d5146a2ef363e44ede07e3775c 100644 (file)
@@ -226,15 +226,28 @@ ip test-ip4 output
   [ immediate reg 1 0x00000011 ]
   [ ct set mark with reg 1 ]
 
-# ct expiration 30
+# ct expiration 30s
 ip test-ip4 output
   [ ct load expiration => reg 1 ]
   [ cmp eq reg 1 0x00007530 ]
 
-# ct expiration 22
+# ct expiration 30000ms
 ip test-ip4 output
   [ ct load expiration => reg 1 ]
-  [ cmp eq reg 1 0x000055f0 ]
+  [ cmp eq reg 1 0x00007530 ]
+
+# ct expiration 1m-1h
+ip test-ip4 output
+  [ ct load expiration => reg 1 ]
+  [ byteorder reg 1 = hton(reg 1, 4, 4) ]
+  [ cmp gte reg 1 0x60ea0000 ]
+  [ cmp lte reg 1 0x80ee3600 ]
+
+# ct expiration > 4d23h59m59s
+ip test-ip4 output
+  [ ct load expiration => reg 1 ]
+  [ byteorder reg 1 = hton(reg 1, 4, 4) ]
+  [ cmp gt reg 1 0x18c8bf19 ]
 
 # ct expiration != 233
 ip test-ip4 output