summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorAdam Smith <adamsmith@yzguy.io>2026-10-08 01:20:09 +0000
committerChristian Breunig <christian@breunig.cc>2026-11-07 22:19:52 +0100
commit9babe4468dec43d2df20488bacd3877d77c42b35 (patch)
tree5e2b7e9114411a9e5a17efdecbd83a68bcf087b6 /data
parentd6902e6423ec78b5b99d96b6427ebee771ea6c38 (diff)
downloadvyos-1x-9babe4468dec43d2df20488bacd3877d77c42b35.tar.gz
vyos-1x-9babe4468dec43d2df20488bacd3877d77c42b35.zip
wwan: T9388: apply a static bearer's address/gateway/DNS directly
QMI raw-ip modems get their address, gateway and DNS from ModemManager as a "static" bearer instead of over a DHCP(v6) or Router Advertisement exchange, so "address dhcp", "address dhcpv6" and "ipv6 address autoconf" never produced a usable config and only worked for IPv4 by accident. Check the interface's connected bearer first. If its method for the family is static, apply it directly; if it is dhcp, or there is no bearer yet, fall through to the existing DHCP(v6) client / kernel SLAAC unchanged. - Address and DNS are applied from the bearer. DNS is registered with vyos-hostsd under the same dhcp-<if>/dhcpv6-<if> tags a real client uses. A DHCP(v6) client which was started while the bearer was still missing, including one which keeps restarting, is stopped before the settings are applied. - The default route is rendered into FRR as a tag 210 static route, the same way a DHCP one is. WWANIf records the gateway of the bearer in /run/vyos-wwan, which the new get_wwan_router() filter reads, and a new block in staticd.frr.j2 fed by get_wwan_interfaces() renders the IPv4 and IPv6 default routes. Distance, no-default-route and VRFs behave as for DHCP, also for an interface without "address dhcp". frrender notices a gateway change, and WWANIf reconciles FRR with vyos-frr-render.py whenever the recorded gateway changes, the way the dhclient lease hook does, so op-mode reconnect is covered as well. The state is written atomically, as the renderer reads it concurrently. - The address installed from the bearer is recorded in /run/vyos-wwan too. It is removed on reconnect, when the family is no longer configured and when the interface goes away, and nothing else on the interface is ever touched. - vyos-netlinkd applies the bearer again after it re-dials a lost session, as the new session can come back with a different address or gateway. A DHCP client used to pick that up on its own. What a previous session left behind is dropped for a family the new one does not supply, the configured DHCP(v6) client or SLAAC is started for it as a commit would, and an incomplete result is retried on the following reconcile passes for a while. - The bearer is picked by its connected status rather than bearers[0], and its config is polled briefly with wait_for() until it is no longer missing or a placeholder, since it can be populated slightly after the bearer reports connected.
Diffstat (limited to 'data')
-rw-r--r--data/templates/frr/staticd.frr.j218
1 files changed, 18 insertions, 0 deletions
diff --git a/data/templates/frr/staticd.frr.j2 b/data/templates/frr/staticd.frr.j2
index d842d6a89..0ee2dd631 100644
--- a/data/templates/frr/staticd.frr.j2
+++ b/data/templates/frr/staticd.frr.j2
@@ -103,6 +103,24 @@ vrf {{ vrf }}
{% endif %}
{% endfor %}
{% endif %}
+{# IPv4 and IPv6 default routes from WWAN interfaces with a static bearer #}
+{% if wwan is vyos_defined %}
+{% for interface, interface_config in wwan.items() %}
+{% set distance = interface_config.default_route_distance if interface_config.default_route_distance is vyos_defined else '' %}
+{% if interface_config.ipv4 is vyos_defined and interface_config.no_default_route is not vyos_defined %}
+{% set next_hop = interface | get_wwan_router('ipv4') %}
+{% if next_hop is vyos_defined %}
+{{ ip_prefix }} route 0.0.0.0/0 {{ next_hop }} {{ interface }} tag 210 {{ distance }}
+{% endif %}
+{% endif %}
+{% if interface_config.ipv6 is vyos_defined %}
+{% set next_hop = interface | get_wwan_router('ipv6') %}
+{% if next_hop is vyos_defined %}
+{{ ipv6_prefix }} route ::/0 {{ next_hop }} {{ interface }} tag 210 {{ distance }}
+{% endif %}
+{% endif %}
+{% endfor %}
+{% endif %}
{# IPv6 routing #}
{% if route6 is vyos_defined %}
{% for prefix, prefix_config in route6.items() %}