From b858e5f8c0bf68f1ee7ef6ad1da35b60102601a1 Mon Sep 17 00:00:00 2001
From: Nico Boehr <nico@nicoboehr.de>
Date: Sun, 1 Jun 2025 18:34:44 +0200
Subject: [PATCH] backbone_babel: use bird 2.17 for babel ip4-over-ip6 nexthops

---
 roles/backbone_babel/tasks/routing_bird.yml      | 13 +++++++++++++
 .../templates/bird-backbone-babel.conf.j2        | 16 +++++++++++++++-
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/roles/backbone_babel/tasks/routing_bird.yml b/roles/backbone_babel/tasks/routing_bird.yml
index d72bd33..8d558c0 100644
--- a/roles/backbone_babel/tasks/routing_bird.yml
+++ b/roles/backbone_babel/tasks/routing_bird.yml
@@ -1,8 +1,21 @@
 ---
+- name: Setup bird repos on bookworm
+  when: ansible_facts['distribution_major_version'] == "12"
+  block:
+    - name: Deploy bird apt repo key
+      ansible.builtin.copy:
+        src: bird-cznic-labs-pkg-apt-key.gpg
+        dest: /usr/share/keyrings/cznic-labs-pkg.gpg
+    - name: Deploy bird cz.nic apt repo config
+      ansible.builtin.copy:
+        src: bird-cznic-labs-pkg-apt.list
+        dest: /etc/apt/sources.list.d/cznic-labs-bird2.list 
+
 - name: Install bird2
   ansible.builtin.apt:
     name: bird2
     state: present
+    update_cache: yes
 
 - name: Mask babeld to avoid conflicts with bird
   ansible.builtin.systemd_service:
diff --git a/roles/backbone_babel/templates/bird-backbone-babel.conf.j2 b/roles/backbone_babel/templates/bird-backbone-babel.conf.j2
index bca852e..153627c 100644
--- a/roles/backbone_babel/templates/bird-backbone-babel.conf.j2
+++ b/roles/backbone_babel/templates/bird-backbone-babel.conf.j2
@@ -1,4 +1,18 @@
 # ANSIBLE managed
+protocol static bb_babel_static_v6 {
+	ipv6;
+{% for ip in bb_babel_loopback_ipv6 %}
+	route {{ ip }}/128 unreachable;
+{% endfor %}
+};
+
+protocol static bb_babel_static_v4 {
+	ipv4;
+{% for ip in bb_babel_loopback_ipv4 %}
+	route {{ ip }}/32 unreachable;
+{% endfor %}
+};
+
 filter import_backbone_babel {
 {% for network in bb_babel_networks|ansible.utils.ipv6 %}
 	if net.type = NET_IP6 && net ~ [{{ network }}+] then {
@@ -29,7 +43,7 @@ filter export_backbone_babel {
 	reject;
 };
 
-protocol babel backbone_babel {
+protocol babel bb_babel {
 {% for interface in interfaces %}
         interface "{{ interface }}" {
                 type wired;
-- 
GitLab