Skip to content

Commit

Permalink
corerouter: use patched version of bird2 and add proper inbound metrics
Browse files Browse the repository at this point in the history
Switch to using a patched version of the BIRD daemon (`bird2-babelpatch`)
maintained in our own repository. This version includes modifications to the
Babel protocol, allowing route filtering based on specific interfaces and
neighbors, while exporting all Babel routes to BIRD's core for enhanced
flexibility.

Link: https://bird.network.cz/pipermail/bird-users/2023-February/016705.html
Link: #1087
  • Loading branch information
spolack authored and Noki committed Nov 23, 2024
1 parent 990e056 commit 019c0a1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion group_vars/role_corerouter/imageprofile.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
role_corerouter__packages__to_merge:
- bird2
- bird2-babelpatch
- bird2c
- collectd-mod-dhcpleases
- collectd-mod-olsrd
Expand Down
22 changes: 17 additions & 5 deletions roles/cfg_openwrt/templates/corerouter/bird.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,23 @@ protocol babel {
ipv6 sadr {
table v6_main;
# Import only /56 location aggregates and default routes
import where (net.len = 56) || (net = ::/0 from {{ freifunk_global_prefix }} );
import filter {
if ! (net.len = 56 || net = ::/0 from {{ freifunk_global_prefix }}) then reject;
{% for nw in networks | selectattr('role', 'equalto', 'mesh') %}
{# metrics for 2 GHz adhoc get a penalty over 5 GHz adhoc so 5 GHz is preferred #}
{% set default_mesh_metric = hostvars[inventory_hostname].get('mesh_metric_adhoc_' ~ nw.get('mesh_radio'), mesh_metric_default_in) %}
if ifname = "{{ libnetwork.getIfname(nw) }}" then {
babel_metric = babel_metric + {{ nw.get('mesh_metric', default_mesh_metric) }};
}
{% endfor %}
{% for nw in networks | selectattr('role', 'equalto', 'tunnel') %}
if ifname = "{{ nw.get('ifname') }}" then {
babel_metric = babel_metric + {{ nw.get('mesh_metric', mesh_metric_tunnel_in) }};
}
{% endfor %}
accept;
};

export filter {
if net = {{ ipv6_prefix }} from ::/0 then accept;
if source = RTS_BABEL then accept;
Expand All @@ -40,19 +56,15 @@ protocol babel {
};

# Mesh interfaces
{# metrics for 2 GHz adhoc get a penalty over 5 GHz adhoc so 5 GHz is preferred #}
{% for nw in networks | selectattr('role', 'equalto', 'mesh') %}
{% set default_mesh_metric = hostvars[inventory_hostname].get('mesh_metric_adhoc_' ~ nw.get('mesh_radio'), mesh_metric_default_in) %}
interface "{{ libnetwork.getIfname(nw) }}" {
type wireless;
rxcost {{ nw.get('mesh_metric', default_mesh_metric) }};
};
{% endfor %}
# Tunnel interfaces provided by tunspace
{% for nw in networks | selectattr('role', 'equalto', 'tunnel') %}
interface "{{ nw.get('ifname') }}" {
type wireless;
rxcost {{ nw.get('mesh_metric', mesh_metric_tunnel_in) }};
};
{% endfor %}
}
Expand Down

0 comments on commit 019c0a1

Please sign in to comment.