Skip to contentSkip to conversation

doc: nft.8: Extend limit statement's burst value info

PATCH In review Phil Sutter 2 participants 3 messages Aug 26, 2022 – Aug 30, 2022 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 doc: nft.8: Extend limit statement's burst value info

Describe how the burst value influences the kernel module's token bucket in each of the two modes.

---
Looking at the code, maybe one should make byte-based limit burst default to either zero or four times the rate value instead of the seemingly arbitrary 5 bytes.

---
 doc/statements.txt | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
doc/statements.txt +7 -2
index 6aaf806bcff25..af8ccb8603c67 100644
@@ -332,8 +332,13 @@ ____
 A limit statement matches at a limited rate using a token bucket filter. A rule
 using this statement will match until this limit is reached. It can be used in
 combination with the log statement to give limited logging. The optional
-*over* keyword makes it match over the specified rate. Default *burst* is 5.
-if you specify *burst*, it must be non-zero value.
+*over* keyword makes it match over the specified rate.
+
+The *burst* value influences the bucket size, i.e. jitter tolerance. With
+packet-based *limit*, the bucket holds exactly *burst* packets, by default
+five. With byte-based *limit*, the bucket's minimum size is the given rate's
+byte value and the *burst* value adds to that, by default five bytes. If you
+specify *burst*, it must be a non-zero value.
 
 .limit statement values
 [options="header"]
Signature · 1 line
2.34.1
#1 lore raw
Quoted 8 lines · Phil Sutter

Describe how the burst value influences the kernel module's token bucket in each of the two modes.

---
Looking at the code, maybe one should make byte-based limit burst default to either zero or four times the rate value instead of the seemingly arbitrary 5 bytes.

This is a bug, let me have a look and then you follow up to update the manpage, OK?

Quoted 27 lines
---
 doc/statements.txt | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
doc/statements.txt +7 -2
index 6aaf806bcff25..af8ccb8603c67 100644
@@ -332,8 +332,13 @@ ____
 A limit statement matches at a limited rate using a token bucket filter. A rule
 using this statement will match until this limit is reached. It can be used in
 combination with the log statement to give limited logging. The optional
-*over* keyword makes it match over the specified rate. Default *burst* is 5.
-if you specify *burst*, it must be non-zero value.
+*over* keyword makes it match over the specified rate.
+
+The *burst* value influences the bucket size, i.e. jitter tolerance. With
+packet-based *limit*, the bucket holds exactly *burst* packets, by default
+five. With byte-based *limit*, the bucket's minimum size is the given rate's
+byte value and the *burst* value adds to that, by default five bytes. If you
+specify *burst*, it must be a non-zero value.
 
 .limit statement values
 [options="header"]
Signature · 1 line
2.34.1
author reviewer
#2 lore raw
Quoted 4 lines · Pablo Neira Ayuso
Quoted 3 lines · Phil Sutter

Describe how the burst value influences the kernel module's token bucket in each of the two modes.

Quoted 8 lines
Quoted 5 lines

---
Looking at the code, maybe one should make byte-based limit burst default to either zero or four times the rate value instead of the seemingly arbitrary 5 bytes.

This is a bug, let me have a look and then you follow up to update the manpage, OK?

ACK, thanks!

Cheers, Phil