diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2024-02-16 18:44:40 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2024-02-16 18:44:40 +0100 |
commit | c3335b504403136ef8deb81cb034480a65ca2815 (patch) | |
tree | c63e160e1ce983154bb082d107f93617ab329314 | |
parent | 5c04f0e2354ff0cca9b1479e68882b72755f3aab (diff) |
Static: Allow to define both nexthop and interface
Allow to define both nexthop and interface using iproute2-like syntax,
e.g.: route 10.0.0.0/16 via 10.1.0.1 dev "eth0";
Now we can avoid to use link-local scope hack (e.g. 10.1.0.1%eth0)
for cases where both nexthop and interface have to be defined.
Thanks to Marcin Saklak for the suggestion.
-rw-r--r-- | doc/bird.sgml | 12 | ||||
-rw-r--r-- | proto/static/config.Y | 3 |
2 files changed, 13 insertions, 2 deletions
diff --git a/doc/bird.sgml b/doc/bird.sgml index 3861a595..76ca7f75 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -5940,6 +5940,12 @@ options (<cf/bfd/ and <cf/weight 1/), the second nexthop has just <cf/weight 2/. that BFD protocol also has to be configured, see <ref id="bfd" name="BFD"> section for details. Default value is no. + <tag><label id="static-route-dev">dev <m/text/</tag> + The outgoing interface associated with the nexthop. Useful for + link-local nexthop addresses or when multiple interfaces use the same + network prefix. By default, the outgoing interface is resolved from the + nexthop address. + <tag><label id="static-route-mpls">mpls <m/num/[/<m/num/[/<m/num/[...]]]</tag> MPLS labels that should be pushed to packets forwarded by the route. The option could be used for both IP routes (on MPLS ingress routers) @@ -6120,7 +6126,8 @@ protocol static { via 198.51.100.20 bfd # BFD-controlled next hop via 192.0.2.1; route 203.0.113.0/24 blackhole; # Sink route - route 10.2.0.0/24 via "arc0"; # Secondary network + route 10.2.0.0/24 via "arc0"; # Direct route + route 10.2.2.0/24 via 192.0.2.1 dev "eth0" onlink; # Route with both nexthop and iface route 192.168.10.0/24 via 198.51.100.100 { ospf_metric1 = 20; # Set extended attribute }; @@ -6139,7 +6146,8 @@ protocol static { route 2001:db8:10::/48 via 2001:db8:1::1; # Route with global nexthop route 2001:db8:20::/48 via fe80::10%eth0; # Route with link-local nexthop route 2001:db8:30::/48 via fe80::20%'eth1.60'; # Iface with non-alphanumeric characters - route 2001:db8:40::/48 via "eth2"; # Direct route to eth2 + route 2001:db8:40::/48 via fe80::30 dev "eth1"; # Another link-local nexthop + route 2001:db8:50::/48 via "eth2"; # Direct route to eth2 route 2001:db8::/32 unreachable; # Unreachable route route ::/0 via 2001:db8:1::1 bfd; # BFD-controlled default route } diff --git a/proto/static/config.Y b/proto/static/config.Y index 215681e8..e746b63c 100644 --- a/proto/static/config.Y +++ b/proto/static/config.Y @@ -87,6 +87,9 @@ stat_nexthop: this_snh->via = IPA_NONE; this_snh->iface = if_get_by_name($2); } + | stat_nexthop DEV TEXT { + this_snh->iface = if_get_by_name($3); + } | stat_nexthop MPLS label_stack { this_snh->mls = $3; } |