bird and on-interface p2p routes
Hello, youm this question was asked like a gazillion times, but so far I faled to google the answer. So, I have a network softrouter on Linux which was clearly written by some ignorant folks; it operates the p2p tunX interface that doesn't have the remote IP set, only a local one. So bird does complain about "strange next-hop" when walking through the kernel routing table and seeing the local/self address as a gateway. Still, this is partially valid setup, because the hosts this softrouter injects into the kernel RT are reachable via p2p interface directly. I can declare these as a static routes reachable via tunX, but this setup lacks the automation (I will had to refresh thhe routes manually). So, my though is like this: is it possible to convert these from "strange next-hop" routes to this ===Cut=== 10.24.123.0/21 unicast [direct1 2023-12-07] * (200) dev tun0 ===Cut=== via the export filter ? I tried the following approach but it seems like I'm missing something: ===Cut=== filter exportkernelv4 { if ifname = "tun0" then { print "attempting to change route attributes: ifname ", ifname, ", gw: ", gw, ", dest: ", dest; onlink = true; #unset(gw); } accept; }; protocol kernel { learn; persist; scan time 20; ipv4 { import all; export filter exportkernelv4; }; } ===Cut=== What am I missing ? Seems like for some reason I just cannot merey unsert the gw attribute. Thanks. Eugene.
Hi, As far as I remember, if you set the interface in a filter, than the gw is undefined automatically. Yep, checked the documentation, and here it is: https://bird.network.cz/?get_doc&v=20&f=bird-5.html#ss5.5 string ifname Name of the outgoing interface. Sink routes (like blackhole, unreachable or prohibit) and multipath routes have no interface associated with them, so ifname returns an empty string for such routes. **Setting it would also change route to a direct one (remove gateway).** Regards, Alexander On Wed, Jan 10, 2024, 17:44 Eugene M. Zheganin <emz@norma.perm.ru> wrote:
Hello,
youm this question was asked like a gazillion times, but so far I faled to google the answer. So, I have a network softrouter on Linux which was clearly written by some ignorant folks; it operates the p2p tunX interface that doesn't have the remote IP set, only a local one. So bird does complain about "strange next-hop" when walking through the kernel routing table and seeing the local/self address as a gateway. Still, this is partially valid setup, because the hosts this softrouter injects into the kernel RT are reachable via p2p interface directly. I can declare these as a static routes reachable via tunX, but this setup lacks the automation (I will had to refresh thhe routes manually).
So, my though is like this: is it possible to convert these from "strange next-hop" routes to this
===Cut===
10.24.123.0/21 unicast [direct1 2023-12-07] * (200) dev tun0
===Cut===
via the export filter ? I tried the following approach but it seems like I'm missing something:
===Cut===
filter exportkernelv4 { if ifname = "tun0" then { print "attempting to change route attributes: ifname ", ifname, ", gw: ", gw, ", dest: ", dest; onlink = true; #unset(gw); } accept; };
protocol kernel { learn; persist; scan time 20; ipv4 { import all; export filter exportkernelv4; }; }
===Cut===
What am I missing ? Seems like for some reason I just cannot merey unsert the gw attribute.
Thanks.
Eugene.
Hello, On 11.01.2024 03:44, Alexander Zubkov wrote:
As far as I remember, if you set the interface in a filter, than the gw is undefined automatically.
Yep, checked the documentation, and here it is:
https://bird.network.cz/?get_doc&v=20&f=bird-5.html#ss5.5
string ifname
Name of the outgoing interface. Sink routes (like blackhole, unreachable or prohibit) and multipath routes have no interface associated with them, so ifname returns an empty string for such routes. **Setting it would also change route to a direct one (remove gateway).**
Thanks, that did it; but unfortunately, further debugging revealed that bird seems to completely ignore such routes and they don't make it to the export filters, being discarded earlier. Still the only option is to redeclare these as static. Eugene.
You mean exporting to the kernel? You can alter the routes in input filters. Or pipe routes to another table, altering them in the pipe export filter, and then export to the kernel from that other table. On Thu, Jan 11, 2024, 09:08 Eugene M. Zheganin <emz@norma.perm.ru> wrote:
Hello,
On 11.01.2024 03:44, Alexander Zubkov wrote:
As far as I remember, if you set the interface in a filter, than the gw is undefined automatically.
Yep, checked the documentation, and here it is: https://bird.network.cz/?get_doc&v=20&f=bird-5.html#ss5.5
string ifname
Name of the outgoing interface. Sink routes (like blackhole, unreachable or prohibit) and multipath routes have no interface associated with them, so ifname returns an empty string for such routes. **Setting it would also change route to a direct one (remove gateway).**
Thanks, that did it; but unfortunately, further debugging revealed that bird seems to completely ignore such routes and they don't make it to the export filters, being discarded earlier.
Still the only option is to redeclare these as static.
Eugene.
Hello, On 11.01.2024 13:29, Alexander Zubkov wrote:
You mean exporting to the kernel? You can alter the routes in input filters. Or pipe routes to another table, altering them in the pipe export filter, and then export to the kernel from that other table.
Nope, I need quite the opposite - I need to redistribute these into the OSPF; they are already present in the KRT. As far as I can see, bird just totally ignores these. Eugene.
You can try to enable debug logs, there might be some clues why the routes are discarded. Maybe they need at least fake nexthop when exporting to OSPF, etc. On Thu, Jan 11, 2024 at 10:19 AM Eugene M. Zheganin <emz@norma.perm.ru> wrote:
Hello,
On 11.01.2024 13:29, Alexander Zubkov wrote:
You mean exporting to the kernel? You can alter the routes in input filters. Or pipe routes to another table, altering them in the pipe export filter, and then export to the kernel from that other table.
Nope, I need quite the opposite - I need to redistribute these into the OSPF; they are already present in the KRT. As far as I can see, bird just totally ignores these.
Eugene.
On Thu, Jan 11, 2024 at 02:13:11PM +0500, Eugene M. Zheganin wrote:
Hello,
On 11.01.2024 13:29, Alexander Zubkov wrote:
You mean exporting to the kernel? You can alter the routes in input filters. Or pipe routes to another table, altering them in the pipe export filter, and then export to the kernel from that other table.
Nope, I need quite the opposite - I need to redistribute these into the OSPF; they are already present in the KRT. As far as I can see, bird just totally ignores these.
Yes, if you get 'strange next-hop' log message, then such route is rejected during parsing of netlink sockets, so it cannot be changed by filters. -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) "To err is human -- to blame it on a computer is even more so."
participants (3)
-
Alexander Zubkov -
Eugene M. Zheganin -
Ondrej Zajicek