Skip to content

Commit acb50d3

Browse files
Darleletcapflam
authored andcommitted
DOC: management: document ptr lookup for table commands
Add missing documentation and examples for the optional ptr lookup method for table {show,set,clear} commands introduced in commit 9b2717e ("MINOR: stktable: use {show,set,clear} table with ptr"), as initially described in GH #2118. It may be backported in 3.0. (cherry picked from commit 7422f16) Signed-off-by: Christopher Faulet <[email protected]>
1 parent f060712 commit acb50d3

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

doc/management.txt

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,7 +1833,8 @@ clear map [@<ver>] <map>
18331833
version of the map is cleared (the one being matched against). However it is
18341834
possible to specify another version using '@' followed by this version.
18351835

1836-
clear table <table> [ data.<type> <operator> <value> ] | [ key <key> ]
1836+
clear table <table> [ data.<type> <operator> <value> ] | [ key <key> ] |
1837+
[ ptr <ptr> ]
18371838
Remove entries from the stick-table <table>.
18381839

18391840
This is typically used to unblock some users complaining they have been
@@ -1863,23 +1864,39 @@ clear table <table> [ data.<type> <operator> <value> ] | [ key <key> ]
18631864
same type as the table, which currently is limited to IPv4, IPv6, integer and
18641865
string.
18651866

1867+
When the ptr form is used the entry <ptr> is removed. <ptr> is written in
1868+
the form 0xffff and must correspond to the address returned by a previous
1869+
"show table" command. Matching an entry using its pointer may be relevant if
1870+
the entry cannot be matched using the key due to empty key or incompatible
1871+
characters on the cli.
1872+
18661873
Example :
18671874
$ echo "show table http_proxy" | socat stdio /tmp/sock1
18681875
>>> # table: http_proxy, type: ip, size:204800, used:2
18691876
>>> 0x80e6a4c: key=127.0.0.1 use=0 exp=3594729 gpc0=0 conn_rate(30000)=1 \
18701877
bytes_out_rate(60000)=187
18711878
>>> 0x80e6a80: key=127.0.0.2 use=0 exp=3594740 gpc0=1 conn_rate(30000)=10 \
18721879
bytes_out_rate(60000)=191
1880+
>>> 0x80e6b40: key=127.0.0.3 use=0 exp=3594743 gpc0=2 conn_rate(30000)=10 \
1881+
bytes_out_rate(60000)=200
18731882

18741883
$ echo "clear table http_proxy key 127.0.0.1" | socat stdio /tmp/sock1
18751884

18761885
$ echo "show table http_proxy" | socat stdio /tmp/sock1
18771886
>>> # table: http_proxy, type: ip, size:204800, used:1
18781887
>>> 0x80e6a80: key=127.0.0.2 use=0 exp=3594740 gpc0=1 conn_rate(30000)=10 \
1888+
>>> 0x80e6b40: key=127.0.0.3 use=0 exp=3594743 gpc0=2 conn_rate(30000)=10 \
1889+
bytes_out_rate(60000)=200
18791890
bytes_out_rate(60000)=191
18801891
$ echo "clear table http_proxy data.gpc0 eq 1" | socat stdio /tmp/sock1
18811892
$ echo "show table http_proxy" | socat stdio /tmp/sock1
18821893
>>> # table: http_proxy, type: ip, size:204800, used:1
1894+
>>> 0x80e6b40: key=127.0.0.3 use=0 exp=3594743 gpc0=2 conn_rate(30000)=10 \
1895+
bytes_out_rate(60000)=200
1896+
1897+
$ echo "clear table http_proxy ptr 0x80e6b40" | socat stdio /tmp/sock1
1898+
$ echo "show table http_proxy" | socat stdio /tmp/sock1
1899+
>>> # table: http_proxy, type: ip, size:204800, used:0
18831900

18841901
commit acl @<ver> <acl>
18851902
Commit all changes made to version <ver> of ACL <acl>, and deletes all past
@@ -2537,13 +2554,20 @@ set ssl tls-key <id> <tlskey>
25372554
or 80 bits TLS ticket key (ex. openssl rand 80 | openssl base64 -A).
25382555

25392556
set table <table> key <key> [data.<data_type> <value>]*
2557+
set table <table> ptr <ptr> [data.<data_type> <value>]*
25402558
Create or update a stick-table entry in the table. If the key is not present,
25412559
an entry is inserted. See stick-table in section 4.2 to find all possible
25422560
values for <data_type>. The most likely use consists in dynamically entering
25432561
entries for source IP addresses, with a flag in gpc0 to dynamically block an
25442562
IP address or affect its quality of service. It is possible to pass multiple
25452563
data_types in a single call.
25462564

2565+
Optional ptr lookup may be used instead of key lookup for an existing entry:
2566+
<ptr> is written in the form 0xffff and must correspond to the address
2567+
returned by a previous "show table" command. Matching an entry using its
2568+
pointer may be relevant if the entry cannot be matched using the key due to
2569+
empty key or imcompatible characters on the cli.
2570+
25472571
set timeout cli <delay>
25482572
Change the CLI interface timeout for current connection. This can be useful
25492573
during long debugging sessions where the user needs to constantly inspect
@@ -3688,7 +3712,8 @@ show table
36883712
>>> # table: front_pub, type: ip, size:204800, used:171454
36893713
>>> # table: back_rdp, type: ip, size:204800, used:0
36903714

3691-
show table <name> [ data.<type> <operator> <value> [data.<type> ...]] | [ key <key> ]
3715+
show table <name> [ data.<type> <operator> <value> [data.<type> ...]] |
3716+
[ key <key> ] | [ ptr <ptr> ]
36923717
Dump contents of stick-table <name>. In this mode, a first line of generic
36933718
information about the table is reported as with "show table", then all
36943719
entries are dumped. Since this can be quite heavy, it is possible to specify
@@ -3714,6 +3739,12 @@ show table <name> [ data.<type> <operator> <value> [data.<type> ...]] | [ key <k
37143739
same type as the table, which currently is limited to IPv4, IPv6, integer,
37153740
and string.
37163741

3742+
When the ptr form is used the entry <ptr> is shown. <ptr> is written in
3743+
the form 0xffff and must correspond to the address returned by a previous
3744+
"show table" command. Matching an entry using its pointer may be relevant if
3745+
the entry cannot be matched using the key due empty key or incompatible
3746+
characters on the cli.
3747+
37173748
Example :
37183749
$ echo "show table http_proxy" | socat stdio /tmp/sock1
37193750
>>> # table: http_proxy, type: ip, size:204800, used:2
@@ -3736,6 +3767,12 @@ show table <name> [ data.<type> <operator> <value> [data.<type> ...]] | [ key <k
37363767
$ echo "show table http_proxy key 127.0.0.2" | \
37373768
socat stdio /tmp/sock1
37383769
>>> # table: http_proxy, type: ip, size:204800, used:2
3770+
>>> 0x80e6a80: key=127.0.0.2 use=0 exp=3594740 gpc0=1 conn_rate(30000)=10 \
3771+
bytes_out_rate(60000)=191
3772+
3773+
$ echo "show table http_proxy ptr 0x80e6a80" | \
3774+
socat stdio /tmp/sock1
3775+
>>> # table: http_proxy, type: ip, size:204800, used:2
37393776
>>> 0x80e6a80: key=127.0.0.2 use=0 exp=3594740 gpc0=1 conn_rate(30000)=10 \
37403777
bytes_out_rate(60000)=191
37413778

0 commit comments

Comments
 (0)