[RFC PATCH 19/20] add typed test config
Asbjørn Sloth Tønnesen
ast at 2e8.dk
Mon Dec 30 17:56:45 CET 2019
---
filter/test.conf | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/filter/test.conf b/filter/test.conf
index d0941e11..cbc4e90d 100644
--- a/filter/test.conf
+++ b/filter/test.conf
@@ -1403,3 +1403,44 @@ protocol static
ipv6 { import where false; };
route fd01::/48 unreachable;
}
+
+define default_route:ipv4 = 0.0.0.0/0;
+define default_route:ipv6 = ::/0;
+
+function typed_function:ipv4()
+{
+ reject;
+}
+
+function typed_function:ipv6()
+{
+ if net = default_route then accept;
+}
+
+# this function is implicitly typed since it uses a typed symbol
+function is_default_route()
+{
+ return net = default_route;
+}
+
+filter implicitly_typed
+{
+ if is_default_route() then
+ accept;
+ else
+ reject;
+}
+
+protocol static
+{
+ ipv4 { import filter implicitly_typed; };
+ route 0.0.0.0/0 unreachable;
+ route 192.0.2.0/24 unreachable;
+}
+
+protocol static
+{
+ ipv6 { import filter implicitly_typed; };
+ route ::/0 unreachable;
+ route 2001:db8::/48 unreachable;
+}
--
2.24.0
More information about the Bird-users
mailing list