mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-08 12:18:42 +00:00
Merge commit '472be46f7ab211f38e7662543f1436df30dca753' into thread-next
This commit is contained in:
commit
a0041dd236
177
filter/test.conf
177
filter/test.conf
@ -607,6 +607,9 @@ prefix px;
|
||||
{
|
||||
px = 1.2.0.0/18;
|
||||
bt_assert(format(px) = "1.2.0.0/18");
|
||||
bt_assert(px.ip = 1.2.0.0);
|
||||
bt_assert(px.len = 18);
|
||||
|
||||
bt_assert(192.168.0.0/16 ~ 192.168.0.0/16);
|
||||
bt_assert(192.168.0.0/17 ~ 192.168.0.0/16);
|
||||
bt_assert(192.168.254.0/24 ~ 192.168.0.0/16);
|
||||
@ -744,9 +747,11 @@ bt_test_suite(t_prefix_set, "Testing prefix sets");
|
||||
|
||||
function t_prefix6()
|
||||
{
|
||||
prefix px;
|
||||
px = 1020::/18;
|
||||
prefix px = 1020::/18;
|
||||
bt_assert(format(px) = "1020::/18");
|
||||
bt_assert(px.ip = 1020::);
|
||||
bt_assert(px.len = 18);
|
||||
|
||||
bt_assert(1020:3040:5060:: ~ 1020:3040:5000::/40);
|
||||
bt_assert(1020:3040::/32 ~ 1020:3040::/32);
|
||||
bt_assert(1020:3040::/33 ~ 1020:3040::/32);
|
||||
@ -828,33 +833,6 @@ bt_test_suite(t_prefix6_set, "Testing prefix IPv6 sets");
|
||||
|
||||
|
||||
|
||||
function t_flowspec()
|
||||
prefix p;
|
||||
{
|
||||
p = flow4 { dst 10.0.0.0/8; };
|
||||
bt_assert(p !~ [ 10.0.0.0/8 ] );
|
||||
|
||||
bt_assert(format(flow4 { dst 10.0.0.0/8; proto = 23; }) = "flow4 { dst 10.0.0.0/8; proto 23; }");
|
||||
bt_assert(format(flow6 { dst ::1/128; src ::2/127; }) = "flow6 { dst ::1/128; src ::2/127; }");
|
||||
bt_assert(format(flow6 { next header false 42; }) = "flow6 { next header false 42; }");
|
||||
bt_assert(format(flow6 { port 80; }) = "flow6 { port 80; }");
|
||||
bt_assert(format(flow6 { dport > 24 && < 30 || 40..50,60..70,80 && >= 90; }) = "flow6 { dport > 24 && < 30 || 40..50,60..70,80 && >= 90; }");
|
||||
bt_assert(format(flow6 { sport 0..0x400; }) = "flow6 { sport 0..1024; }");
|
||||
bt_assert(format(flow6 { icmp type 80; }) = "flow6 { icmp type 80; }");
|
||||
bt_assert(format(flow6 { icmp code 90; }) = "flow6 { icmp code 90; }");
|
||||
bt_assert(format(flow6 { tcp flags 0x03/0x0f; }) = "flow6 { tcp flags 0x3/0x3 && 0x0/0xc; }");
|
||||
bt_assert(format(flow6 { length 0..65535; }) = "flow6 { length 0..65535; }");
|
||||
bt_assert(format(flow6 { dscp = 63; }) = "flow6 { dscp 63; }");
|
||||
bt_assert(format(flow6 { fragment is_fragment || !first_fragment; }) = "flow6 { fragment is_fragment || !first_fragment; }");
|
||||
bt_assert(format(flow6 { label 1000..2000; }) = "flow6 { label 1000..2000; }");
|
||||
bt_assert(format(flow6 { }) = "flow6 { }");
|
||||
}
|
||||
|
||||
bt_test_suite(t_flowspec, "Testing flowspec routes");
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Testing Paths
|
||||
* -------------
|
||||
@ -1832,6 +1810,137 @@ bt_test_suite(t_rd_set, "Testing sets of route distinguishers");
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Testing VPN nets
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
function t_net_vpn()
|
||||
{
|
||||
prefix p;
|
||||
|
||||
p = 100:200 10.0.1.0/24;
|
||||
bt_assert(format(p) = "100:200 10.0.1.0/24");
|
||||
bt_assert(p.type = NET_VPN4);
|
||||
bt_assert(p.len = 24);
|
||||
bt_assert(p.ip = 10.0.1.0);
|
||||
bt_assert(p.rd = 100:200);
|
||||
|
||||
p = 1012:2024 fe80:386c::/32;
|
||||
bt_assert(format(p) = "1012:2024 fe80:386c::/32");
|
||||
bt_assert(p.type = NET_VPN6);
|
||||
bt_assert(p.len = 32);
|
||||
bt_assert(p.ip = fe80:386c::);
|
||||
bt_assert(p.rd = 1012:2024);
|
||||
}
|
||||
|
||||
bt_test_suite(t_net_vpn, "Testing VPN nets");
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Testing ROA nets
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
|
||||
function t_net_roa()
|
||||
{
|
||||
prefix p;
|
||||
|
||||
p = 12.13.0.0/16 max 24 as 1234;
|
||||
bt_assert(format(p) = "12.13.0.0/16-24 AS1234");
|
||||
bt_assert(p.type = NET_ROA4);
|
||||
bt_assert(p.ip = 12.13.0.0);
|
||||
bt_assert(p.len = 16);
|
||||
bt_assert(p.maxlen = 24);
|
||||
bt_assert(p.asn = 1234);
|
||||
|
||||
p = 1000::/8 max 32 as 1234;
|
||||
bt_assert(format(p) = "1000::/8-32 AS1234");
|
||||
bt_assert(p.type = NET_ROA6);
|
||||
bt_assert(p.ip = 1000::);
|
||||
bt_assert(p.len = 8);
|
||||
bt_assert(p.maxlen = 32);
|
||||
bt_assert(p.asn = 1234);
|
||||
}
|
||||
|
||||
bt_test_suite(t_net_roa, "Testing ROA nets");
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Testing Flowspec nets
|
||||
* ---------------------
|
||||
*/
|
||||
|
||||
function t_net_flowspec()
|
||||
{
|
||||
prefix p;
|
||||
|
||||
p = flow4 { dst 10.0.0.0/8; };
|
||||
bt_assert(p.type = NET_FLOW4);
|
||||
bt_assert(p.ip = 10.0.0.0);
|
||||
bt_assert(p.len = 8);
|
||||
bt_assert(p.src = 0.0.0.0/0);
|
||||
bt_assert(p.dst = 10.0.0.0/8);
|
||||
|
||||
bt_assert(p !~ [ 10.0.0.0/8 ] );
|
||||
bt_assert(p.dst ~ [ 10.0.0.0/8 ] );
|
||||
|
||||
p = flow6 { dst ::1/128; };
|
||||
bt_assert(p.type = NET_FLOW6);
|
||||
bt_assert(p.ip = ::1);
|
||||
bt_assert(p.len = 128);
|
||||
bt_assert(p.src = ::/0);
|
||||
bt_assert(p.dst = ::1/128);
|
||||
|
||||
bt_assert(format(flow4 { dst 10.0.0.0/8; proto = 23; }) = "flow4 { dst 10.0.0.0/8; proto 23; }");
|
||||
bt_assert(format(flow6 { dst ::1/128; src ::2/127; }) = "flow6 { dst ::1/128; src ::2/127; }");
|
||||
bt_assert(format(flow6 { next header false 42; }) = "flow6 { next header false 42; }");
|
||||
bt_assert(format(flow6 { port 80; }) = "flow6 { port 80; }");
|
||||
bt_assert(format(flow6 { dport > 24 && < 30 || 40..50,60..70,80 && >= 90; }) = "flow6 { dport > 24 && < 30 || 40..50,60..70,80 && >= 90; }");
|
||||
bt_assert(format(flow6 { sport 0..0x400; }) = "flow6 { sport 0..1024; }");
|
||||
bt_assert(format(flow6 { icmp type 80; }) = "flow6 { icmp type 80; }");
|
||||
bt_assert(format(flow6 { icmp code 90; }) = "flow6 { icmp code 90; }");
|
||||
bt_assert(format(flow6 { tcp flags 0x03/0x0f; }) = "flow6 { tcp flags 0x3/0x3 && 0x0/0xc; }");
|
||||
bt_assert(format(flow6 { length 0..65535; }) = "flow6 { length 0..65535; }");
|
||||
bt_assert(format(flow6 { dscp = 63; }) = "flow6 { dscp 63; }");
|
||||
bt_assert(format(flow6 { fragment is_fragment || !first_fragment; }) = "flow6 { fragment is_fragment || !first_fragment; }");
|
||||
bt_assert(format(flow6 { label 1000..2000; }) = "flow6 { label 1000..2000; }");
|
||||
bt_assert(format(flow6 { }) = "flow6 { }");
|
||||
|
||||
}
|
||||
|
||||
bt_test_suite(t_net_flowspec, "Testing flowspec networks");
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Testing IPv6 SADR nets
|
||||
* ----------------------
|
||||
*/
|
||||
|
||||
function t_net_sadr()
|
||||
{
|
||||
prefix p;
|
||||
p = fe80:386c::/32 from 2001:db8:1:13::/64;
|
||||
bt_assert(format(p) = "fe80:386c::/32 from 2001:db8:1:13::/64");
|
||||
bt_assert(p.type = NET_IP6_SADR);
|
||||
bt_assert(p.ip = fe80:386c::);
|
||||
bt_assert(p.len = 32);
|
||||
bt_assert(p.src = 2001:db8:1:13::/64);
|
||||
bt_assert(p.dst = fe80:386c::/32);
|
||||
}
|
||||
|
||||
bt_test_suite(t_net_sadr, "Testing IPv6 SADR nets");
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Testing defined() function
|
||||
* --------------------------
|
||||
@ -2267,16 +2376,6 @@ prefix pfx;
|
||||
bt_assert(2001:0db8:85a3:8a2e::/64 ~ ::/0);
|
||||
bt_assert(10.130.130.0/24 !~ ::/0);
|
||||
bt_assert(2001:0db8:85a3:8a2e::/64 !~ 0.0.0.0/0);
|
||||
|
||||
pfx = 12.13.0.0/16 max 24 as 1234;
|
||||
bt_assert(pfx.len = 16);
|
||||
bt_assert(pfx.maxlen = 24);
|
||||
bt_assert(pfx.asn = 1234);
|
||||
|
||||
pfx = 1000::/8 max 32 as 1234;
|
||||
bt_assert(pfx.len = 8);
|
||||
bt_assert(pfx.maxlen = 32);
|
||||
bt_assert(pfx.asn = 1234);
|
||||
}
|
||||
|
||||
bt_test_suite(t_roa_check, "Testing ROA");
|
||||
|
Loading…
Reference in New Issue
Block a user