]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: stick-tables/cli: "set table" without key must not clear the table
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 17 Nov 2026 12:48:25 +0000 (13:48 +0100)
committerOlivier Houchard <cognet@ci0.org>
Tue, 17 Nov 2026 12:41:28 +0000 (13:41 +0100)
commit8ff243b2a11c3d9d569fdc5dc8d108f3465eac09
treeed92be78b6cc6787dd2667e52a4b392084ac3902
parent0b4bb8f447fdf8e36bee3c5d97c185dee4f1285e
BUG/MEDIUM: stick-tables/cli: "set table" without key must not clear the table

cli_parse_table_req() accepts "set table <table>" without any "key" nor
"ptr" argument and returns 0, so that the table I/O handler runs with the
"set" action, which, like "clear", kills all unreferenced entries of the
table. So an operator mistyping "set table t" silently wipes the whole
table instead of getting an error (the doc's synopsis lists key/ptr as
required):

  > set table t key 10.0.0.1 data.gpc0 1   (x4)
  > show table t     => used:4
  > set table t      => (no output)
  > show table t     => used:0

Let's return the usage message when "set" is used without key nor ptr.

This was introduced in 1.7 by commit f13ebdf28 ("REORG: cli: move table
dump/clear/set to stick_table.c") which made "set" use the table I/O
handler. Before that, it was a no-op. This should be backported to all
stable versions.
src/stick_table.c