diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2020-04-05 03:56:07 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2021-09-25 16:06:43 +0200 |
commit | 562a2b8c29a50cca5731b0a19e99a87a261ab4ef (patch) | |
tree | 045f47c52ec694ec3ec5fe2f7a055ceb125d620b /filter | |
parent | 13225f1dbff54619476f2d8f6bc779dbb4983e3e (diff) |
Filter: Fix trie test
Generated prefixes must be valid.
Diffstat (limited to 'filter')
-rw-r--r-- | filter/trie_test.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/filter/trie_test.c b/filter/trie_test.c index b2b36716..5e931e4e 100644 --- a/filter/trie_test.c +++ b/filter/trie_test.c @@ -58,7 +58,8 @@ get_random_ip6_prefix(void) struct f_prefix p; u8 pxlen = xrandom(120)+8; ip6_addr ip6 = ip6_build(bt_random(),bt_random(),bt_random(),bt_random()); - net_addr_ip6 net6 = NET_ADDR_IP6(ip6, pxlen); + ip6_addr mask = ip6_mkmask(pxlen); + net_addr_ip6 net6 = NET_ADDR_IP6(ip6_and(ip6, mask), pxlen); p.net = *((net_addr*) &net6); @@ -87,7 +88,7 @@ generate_random_ipv6_prefixes(list *prefixes) struct f_prefix_node *px = calloc(1, sizeof(struct f_prefix_node)); px->prefix = f; - bt_debug("ADD\t" PRIip6 "/%d %d-%d\n", ARGip6(net6_prefix(&px->prefix.net)), px->prefix.net.pxlen, px->prefix.lo, px->prefix.hi); + bt_debug("ADD\t" PRIip6 "/%d{%d,%d}\n", ARGip6(net6_prefix(&px->prefix.net)), px->prefix.net.pxlen, px->prefix.lo, px->prefix.hi); add_tail(prefixes, &px->n); } } |