Issues with Table Lookup command
Hello,
I'm looking on some information about the expected output and data-type for "table lookup" especially in corner cases (entry does not exist, etc).
In the Wiki it does not specify the output - but it does show example code as:
if { [table lookup -subtable "blacklist" $srcip] != "" } {...}
Which seems to indicate a string output is expected. We have seen some strange behavior with code like:
if {[table lookup -notouch $l7table] eq "" } {
table set $l7table 1 3
} else {
table incr -notouch $l7table
}
In some cases we have seen that table entry gets created with a timeout other than the expected 3 seconds, which leads me to believe it is possible that the entry is nonexistent but returning something other than NULL. In this case the "table incr" command would create a net-new entry with value of 1 and timeout of 180 (default).
So my question - what are the various return values for "table lookup"? Is it possible the VERY FIRST TIME a table lookup is performed (having never even created the table entry) it returns a different value than NULL? It would certainly explain the behavior.