• Brenden Blanco's avatar
    Support iterating from a 0-filled table key · 14915e05
    Brenden Blanco authored
    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: default avatarBrenden Blanco <bblanco@plumgrid.com>
    14915e05
test_stat1.py 2.57 KB