HI, In the example rule below, subtables are used to store information on a per-client basis, and once the TCP::close occurs, the subtable is manually deleted. What happens if the client disappears without closing the connection? In other words do you have to explicitly delete the table, or can you rely on the entries timing out automatically? Is the command: “table delete -subtable $tbl $key” required in every case, or if all the entries in the table expire on their own, does the ENTIRE subtable disappear from memory? I would like to create subtables per client IP and allow the entries to expire on their own, but am worried about memory filling up with hundreds of “empty” tables.. Any help would be much appreciated.. Evan.
when CLIENT_ACCEPTED {
set tbl "connlimit:[IP::client_addr]"
set key "[TCP::client_port]"
if { [table keys -subtable $tbl -count] > 100 } {
event CLIENT_CLOSED disable
reject
} else {
table set -subtable $tbl $key "ignored" 180
set timer [after 60000 -periodic { table lookup -subtable $tbl $key }]
}
}
when CLIENT_CLOSED {
after cancel $timer
table delete -subtable $tbl $key
}