From 3690ccbe4a7eb6b4e79591b07905813112fe9d49 Mon Sep 17 00:00:00 2001 From: uvok cheetah Date: Tue, 25 Jun 2024 18:43:58 +0200 Subject: bird: Fixup default route selection --- roles/uvok_bird/defaults/main.yml | 1 + roles/uvok_bird/templates/clearnet.conf.j2 | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'roles/uvok_bird') diff --git a/roles/uvok_bird/defaults/main.yml b/roles/uvok_bird/defaults/main.yml index 4934326..8bf0ef3 100644 --- a/roles/uvok_bird/defaults/main.yml +++ b/roles/uvok_bird/defaults/main.yml @@ -11,3 +11,4 @@ uvok_bird_opts: clear_as: "64496" rpki1: "127.0.0.1" rpki2: "127.0.0.2" + babel_accept_default: false diff --git a/roles/uvok_bird/templates/clearnet.conf.j2 b/roles/uvok_bird/templates/clearnet.conf.j2 index ff6674b..87ae8d8 100644 --- a/roles/uvok_bird/templates/clearnet.conf.j2 +++ b/roles/uvok_bird/templates/clearnet.conf.j2 @@ -29,6 +29,7 @@ protocol static myprefix { protocol static default6 { route ::/0 reject; ipv6 { + preference 10; table t_myas_trs; import all; export none; @@ -99,7 +100,14 @@ template bgp pt_rc from pt_clearnet { protocol babel p_myas_babel { ipv6 { table t_myas_babel; - import where source ~ [RTS_DEVICE, RTS_BABEL]; + import filter { +{% if uvok_bird_opts.babel_accept_default %} + # accept also default route +{% else %} + if is_default_route() then reject; +{% endif %} + accept; + }; export where source ~ [RTS_DEVICE, RTS_BABEL, RTS_STATIC]; }; @@ -168,10 +176,14 @@ protocol kernel pk_myas_out { if (source = RTS_BGP) then { accept; } - # default route + # static default route if (source = RTS_STATIC) then { accept; } +{% if uvok_bird_opts.babel_accept_default %} + # add babel default route + if is_default_route() then accept; +{% endif %} reject; }; }; -- cgit v1.2.3