Support iterating from a 0-filled table key
In the case that 0-filled keys are valid in the table, the previous
algorithm did not properly iterate.
The API of the bpf_get_next_key routine is such that the iteration
over a map should start with an invalid key. When a 0 key is valid, this
causes iteration to start anywhere inside the hash table, skipping some
entries. So, add logic to the Iter object to test if the init key is
invalid. If otherwise, try a few alternatives until an invalid key is
found. If none found, raise an exception.
Also adds a test for indexing arrays from 0, which nows works with this
too.
Fixes: #260
Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
Showing
tests/cc/test_array.py
0 → 100755
Please register or sign in to comment