mjschultz/py-radix

adding 0.0.0.0/0 (default route) causes problems

Closed this issue · 1 comments

Submitted via email:

Program

The following program adds 3 routes (including a default route to radix)

import radix

radix_trie = radix.Radix()
radix_trie.add('192.168.30.0/24')
radix_trie.add('1.1.1.0/24')
radix_trie.add('0.0.0.0/0')

print('print table:')
for rnode in radix_trie:
     print(rnode.prefix)

entry = radix_trie.search_best("10.10.10.10")
print('Route lookup for 10.10.10.10 returned:', entry)

Output

When this program is executed, the following output is displayed:

print table:
None/0
1.1.1.0/24
192.168.30.0/24
Route lookup for 10.10.10.10 returned: None

Please note the 'None/0' entry.

Route lookup

As shown in the output, when a route table lookup is done in this table
for a destination that would match with default route, The route lookup
is returning no entries.

Corrected in #10