Bug 279662

Summary: net/bird2@netlink - broken multiple FIB support
Product: Base System Reporter: Marek Zarychta <zarychtam>
Component: kernAssignee: Gleb Smirnoff <glebius>
Status: Closed FIXED    
Severity: Affects Some People CC: crest, glebius, olivier, zlei
Priority: --- Flags: zlei: mfc-stable14+
Version: 14.0-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Regression test shell script none

Description Marek Zarychta 2024-06-11 04:52:15 UTC
While trying to reproduce the issue found on the BIRD-users mailing list[1], I refreshed my old BIRD testing setup and can confirm that net/bird2@netlink cannot cope with FIBs other than 0.

Minimal steps to reproduce:
1. Increase sysctl net.fibs to at least 5
2. Deploy net/bird2@netlink with "protocol kernel" using not default FIB, for example:
 
protocol kernel {
        kernel table 4;
        (...)
}

I can provide a more advanced config to reproduce, if someone is willing to do so, please email me.

1. https://bird.network.cz/pipermail/bird-users/2024-June/017722.html
Comment 1 Marek Zarychta 2024-06-11 13:24:44 UTC
I have to add that routes are always installed in FIB 0 regardless of protocol 
kernel {
        kernel table #
}
setting.
Comment 2 Olivier Cochard freebsd_committer freebsd_triage 2024-06-12 19:51:58 UTC
Created attachment 251422 [details]
Regression test shell script

Here is a shell script to reproduce quickly the bug.
Tested on a -current:
- Works with bird2-rtsock-2.15.1
- Fails with bird2-2.15.1
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-06-20 23:12:13 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=f34aca55adef1e28cd68b2e6705a0cac03f0238e

commit f34aca55adef1e28cd68b2e6705a0cac03f0238e
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2024-06-20 23:10:39 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2024-06-20 23:10:39 +0000

    netlink/route: provide pre-2.6.19 Linux compat shim

    The old Linux used 8-bit rtm_table field of the RTM_NEWROUTE message to
    specify routing table id.  Modern netlink uses RTA_TABLE 32-bit attribute.

    Unfortunately, there is modern software (namely bird) that would prefer
    the old API as long as the routing table id fits into 8-bit.

    PR:             279662

 sys/netlink/route/rt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Comment 4 Marek Zarychta 2024-06-21 09:27:58 UTC
Thank you for fixing the issue with net/bird2@netlink. I can confirm that on stable/14 with commit f34aca55adef1e28cd68b2e6705a0cac03f0238e applied the problem has gone.
Comment 5 Zhenlei Huang freebsd_committer freebsd_triage 2024-06-25 07:32:17 UTC
This should be safe to MFC. Open now to track it.
Comment 6 commit-hook freebsd_committer freebsd_triage 2024-06-25 12:47:42 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=df7001bad09474da00885ed853bc6708019fb292

commit df7001bad09474da00885ed853bc6708019fb292
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2024-06-20 23:10:39 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2024-06-25 12:47:24 +0000

    netlink/route: provide pre-2.6.19 Linux compat shim

    The old Linux used 8-bit rtm_table field of the RTM_NEWROUTE message to
    specify routing table id.  Modern netlink uses RTA_TABLE 32-bit attribute.

    Unfortunately, there is modern software (namely bird) that would prefer
    the old API as long as the routing table id fits into 8-bit.

    PR:             279662
    (cherry picked from commit f34aca55adef1e28cd68b2e6705a0cac03f0238e)

 sys/netlink/route/rt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Comment 7 crest 2024-07-05 11:46:42 UTC
Does nlf_get_u8() extract the correct byte of the 32bit table identifier on big endian architectures?