By the way, I have just noticed that while this gives an error on 1.0.2: add rule inet filter input iif lo time < "2022-07-01 11:00" accept This does not: add rule inet filter input iif lo meta time < "2022-07-01 11:00" accept The use of 'meta' in front of 'time' works around the bug. Should the tests include a few statements *without* 'meta'? -Martin On Fri, Apr 8, 2022 at 4:33 AM Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> wrote: > > Add meta time tests using < and > operands. > > Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> > --- > tests/py/any/meta.t | 2 ++ > tests/py/any/meta.t.json | 36 ++++++++++++++++++++++++++++++++++++ > tests/py/any/meta.t.payload | 14 ++++++++++++++ > 3 files changed, 52 insertions(+) > > diff --git a/tests/py/any/meta.t b/tests/py/any/meta.t > index fcf4292d63c0..e3beea2eed6c 100644 > --- a/tests/py/any/meta.t > +++ b/tests/py/any/meta.t > @@ -208,6 +208,8 @@ meta time "2019-06-21 17:00:00" drop;ok > meta time "2019-07-01 00:00:00" drop;ok > meta time "2019-07-01 00:01:00" drop;ok > meta time "2019-07-01 00:00:01" drop;ok > +meta time < "2022-07-01 11:00:00" accept;ok > +meta time > "2022-07-01 11:00:00" accept;ok > meta day "Saturday" drop;ok > meta day 6 drop;ok;meta day "Saturday" drop > meta day "Satturday" drop;fail > diff --git a/tests/py/any/meta.t.json b/tests/py/any/meta.t.json > index b140aaaa0e1c..5472dc85cfb5 100644 > --- a/tests/py/any/meta.t.json > +++ b/tests/py/any/meta.t.json > @@ -2561,6 +2561,42 @@ > } > ] > > +# meta time < "2022-07-01 11:00:00" accept > +[ > + { > + "match": { > + "left": { > + "meta": { > + "key": "time" > + } > + }, > + "op": "<", > + "right": "2022-07-01 11:00:00" > + } > + }, > + { > + "accept": null > + } > +] > + > +# meta time > "2022-07-01 11:00:00" accept > +[ > + { > + "match": { > + "left": { > + "meta": { > + "key": "time" > + } > + }, > + "op": ">", > + "right": "2022-07-01 11:00:00" > + } > + }, > + { > + "accept": null > + } > +] > + > # meta day "Saturday" drop > [ > { > diff --git a/tests/py/any/meta.t.payload b/tests/py/any/meta.t.payload > index d8351c275e64..1543906273c0 100644 > --- a/tests/py/any/meta.t.payload > +++ b/tests/py/any/meta.t.payload > @@ -1003,6 +1003,20 @@ ip meta-test input > [ cmp eq reg 1 0x22eb8a00 0x15ad18e1 ] > [ immediate reg 0 drop ] > > +# meta 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 ] > + > +# meta 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 ] > + > # meta day "Saturday" drop > ip test-ip4 input > [ meta load day => reg 1 ] > -- > 2.30.2 >