From 1ed9a3726c01fda218f37b7f4555c8b7106521ef Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 26 Aug 2016 11:19:18 +0200 Subject: src: add quota statement This new statement is stateful, so it can be used from flow tables, eg. # nft add rule filter input \ flow table http { ip saddr timeout 60s quota over 50 mbytes } drop This basically sets a quota per source IP address of 50 mbytes after which packets are dropped. Note that the timeout releases the entry if no traffic is seen from this IP after 60 seconds. Signed-off-by: Pablo Neira Ayuso --- tests/py/any/quota.t | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/py/any/quota.t (limited to 'tests/py/any/quota.t') diff --git a/tests/py/any/quota.t b/tests/py/any/quota.t new file mode 100644 index 00000000..9a8db114 --- /dev/null +++ b/tests/py/any/quota.t @@ -0,0 +1,24 @@ +:output;type filter hook output priority 0 +:ingress;type filter hook ingress device lo priority 0 + +*ip;test-ip4;output +*ip6;test-ip6;output +*inet;test-inet;output +*arp;test-arp;output +*bridge;test-bridge;output +*netdev;test-netdev;ingress + +quota 1025 bytes;ok +quota 1 kbytes;ok +quota 2 kbytes;ok +quota 1025 kbytes;ok +quota 1023 mbytes;ok +quota 10230 mbytes;ok +quota 1023000 mbytes;ok + +quota over 1 kbytes;ok +quota over 2 kbytes;ok +quota over 1025 kbytes;ok +quota over 1023 mbytes;ok +quota over 10230 mbytes;ok +quota over 1023000 mbytes;ok -- cgit v1.2.3