bird and on-interface p2p routes

Alexander Zubkov green at qrator.net
Wed Jan 10 23:44:17 CET 2024


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 at 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.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20240110/41facf80/attachment.htm>


More information about the Bird-users mailing list