Filter: Remove mixed address tests and fix formatting
This commit is contained in:
parent
2755002890
commit
c9d11e6230
2 changed files with 9 additions and 37 deletions
|
@ -380,6 +380,9 @@ function t_enum()
|
||||||
{
|
{
|
||||||
bt_assert(format(RTS_DUMMY) = "(enum 30)0");
|
bt_assert(format(RTS_DUMMY) = "(enum 30)0");
|
||||||
bt_assert(format(RTS_STATIC) = "(enum 30)1");
|
bt_assert(format(RTS_STATIC) = "(enum 30)1");
|
||||||
|
bt_assert(format(NET_IP4) = "(enum 36)1");
|
||||||
|
bt_assert(format(NET_VPN6) = "(enum 36)4");
|
||||||
|
|
||||||
bt_assert(RTS_STATIC ~ [RTS_STATIC, RTS_DEVICE]);
|
bt_assert(RTS_STATIC ~ [RTS_STATIC, RTS_DEVICE]);
|
||||||
bt_assert(RTS_BGP !~ [RTS_STATIC, RTS_DEVICE]);
|
bt_assert(RTS_BGP !~ [RTS_STATIC, RTS_DEVICE]);
|
||||||
}
|
}
|
||||||
|
@ -458,7 +461,8 @@ function t_prefix_set()
|
||||||
prefix set pxs;
|
prefix set pxs;
|
||||||
{
|
{
|
||||||
pxs = [ 1.2.0.0/16, 1.4.0.0/16+, 44.66.88.64/30{24,28}, 12.34.56.0/24{8,16} ];
|
pxs = [ 1.2.0.0/16, 1.4.0.0/16+, 44.66.88.64/30{24,28}, 12.34.56.0/24{8,16} ];
|
||||||
bt_assert(format(pxs) = "[1.2.0.0/112{::0.1.0.0}, 1.4.0.0/112{::0.1.255.255}, 12.34.0.0/112{::1.255.0.0}, 44.66.88.64/124{::1f0}]");
|
bt_assert(format(pxs) = "[1.2.0.0/16{0.1.0.0}, 1.4.0.0/16{0.1.255.255}, 12.34.0.0/16{1.255.0.0}, 44.66.88.64/28{0.0.1.240}]");
|
||||||
|
|
||||||
bt_assert(1.2.0.0/16 ~ pxs);
|
bt_assert(1.2.0.0/16 ~ pxs);
|
||||||
bt_assert(1.4.0.0/16 ~ pxs);
|
bt_assert(1.4.0.0/16 ~ pxs);
|
||||||
bt_assert(1.4.0.0/18 ~ pxs);
|
bt_assert(1.4.0.0/18 ~ pxs);
|
||||||
|
@ -1038,6 +1042,7 @@ rd x;
|
||||||
bt_assert(x != 2:12345:20000);
|
bt_assert(x != 2:12345:20000);
|
||||||
bt_assert(!(x > 12345:200010));
|
bt_assert(!(x > 12345:200010));
|
||||||
|
|
||||||
|
bt_assert(format(0:1:2) = "1:2");
|
||||||
bt_assert(format(10.0.0.1:1000) = "10.0.0.1:1000");
|
bt_assert(format(10.0.0.1:1000) = "10.0.0.1:1000");
|
||||||
bt_assert(format(100000:20000) = "100000:20000");
|
bt_assert(format(100000:20000) = "100000:20000");
|
||||||
bt_assert(format(2:100000:20000) = "100000:20000");
|
bt_assert(format(2:100000:20000) = "100000:20000");
|
||||||
|
@ -1247,7 +1252,7 @@ int j;
|
||||||
|
|
||||||
filter roa_filter
|
filter roa_filter
|
||||||
{
|
{
|
||||||
if net ~ [ 10.0.0.0/8{16,24}, 2000::/3{16,96} ] then {
|
if net ~ [ 10.0.0.0/8{16,24} ] || net ~ [ 2000::/3{16,96} ] then {
|
||||||
accept;
|
accept;
|
||||||
}
|
}
|
||||||
reject;
|
reject;
|
||||||
|
@ -1333,39 +1338,6 @@ bt_test_suite(t_roa_check, "Testing ROA");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Testing Mixed Net Types
|
|
||||||
* -----------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
function t_mixed_prefix()
|
|
||||||
prefix set pxs;
|
|
||||||
prefix set pxt;
|
|
||||||
{
|
|
||||||
pxs = [ 98.45.0.0/16, 128.128.0.0/12+, 2200::/42-, ::ffff:d000:0/100{98,102}];
|
|
||||||
bt_assert(format(pxs) = "[::/0, ::/2{c000::}, 98.45.0.0/112{::0.1.0.0}, 128.128.0.0/108{::0.31.255.255}, 208.0.0.0/100{::124.0.0.0}, 2200::/42{ffff:ffff:ffc0::}]");
|
|
||||||
bt_assert(::fe00:0:0/88 !~ pxs);
|
|
||||||
bt_assert(::fffe:0:0/95 !~ pxs);
|
|
||||||
bt_assert(::ffff:d800:0/101 ~ pxs);
|
|
||||||
bt_assert(216.0.0.0/5 ~ pxs);
|
|
||||||
bt_assert(212.0.0.0/6 ~ pxs);
|
|
||||||
bt_assert(212.0.0.0/7 !~ pxs);
|
|
||||||
bt_assert(::ffff:8080:8080/121 ~ pxs);
|
|
||||||
bt_assert(::/0 ~ pxs);
|
|
||||||
bt_assert(0.0.0.0/0 !~ pxs);
|
|
||||||
bt_assert(128.135.64.17/32 ~ pxs);
|
|
||||||
|
|
||||||
# pxt = [ 0:1:2 10.1.10.0/24, 0:5:10000 10.1.10.0/24 ];
|
|
||||||
# print pxt;
|
|
||||||
|
|
||||||
bt_assert(format(NET_IP4) = "(enum 36)1"); ## if (net.type = NET_IP4) ...
|
|
||||||
bt_assert(format(NET_VPN6) = "(enum 36)4");
|
|
||||||
bt_assert(format(0:1:2) = "1:2");
|
|
||||||
}
|
|
||||||
|
|
||||||
bt_test_suite(t_mixed_prefix, "Testing mixed net types");
|
|
||||||
|
|
||||||
|
|
||||||
filter vpn_filter
|
filter vpn_filter
|
||||||
{
|
{
|
||||||
bt_assert(format(net) = "1:2 10.1.10.0/24");
|
bt_assert(format(net) = "1:2 10.1.10.0/24");
|
||||||
|
|
|
@ -438,7 +438,7 @@ trie_node_format4(const struct f_trie_node4 *t, buffer *buf)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ip4_nonzero(t->accept))
|
if (ip4_nonzero(t->accept))
|
||||||
buffer_print(buf, "%4I/%d{%4I}, ", t->addr, t->plen, t->accept);
|
buffer_print(buf, "%I4/%d{%I4}, ", t->addr, t->plen, t->accept);
|
||||||
|
|
||||||
trie_node_format4(t->c[0], buf);
|
trie_node_format4(t->c[0], buf);
|
||||||
trie_node_format4(t->c[1], buf);
|
trie_node_format4(t->c[1], buf);
|
||||||
|
@ -451,7 +451,7 @@ trie_node_format6(const struct f_trie_node6 *t, buffer *buf)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ip6_nonzero(t->accept))
|
if (ip6_nonzero(t->accept))
|
||||||
buffer_print(buf, "%6I/%d{%6I}, ", t->addr, t->plen, t->accept);
|
buffer_print(buf, "%I6/%d{%I6}, ", t->addr, t->plen, t->accept);
|
||||||
|
|
||||||
trie_node_format6(t->c[0], buf);
|
trie_node_format6(t->c[0], buf);
|
||||||
trie_node_format6(t->c[1], buf);
|
trie_node_format6(t->c[1], buf);
|
||||||
|
|
Loading…
Reference in a new issue