#991016 iproute2: "ip route show table ..." fails for empty tables ("Error: ipv4: FIB table does not exist")

Package:
iproute2
Source:
iproute2
Description:
networking and traffic control tools
Submitter:
Lars Kruse
Date:
2025-03-26 18:42:01 UTC
Severity:
normal
Tags:
#991016#5
Date:
2021-07-13 00:51:27 UTC
From:
To:
Dear Maintainer,

I just upgraded a host from Buster to testing.
After reboot my locally configured policy routing failed to work.

How to reproduce:

 root@example:~# echo 120 foo >>/etc/iproute2/rt_tables
 root@example:~# ip route show table foo
 Error: ipv4: FIB table does not exist.
 Dump terminated
 root@example:~# ip route show table 120
 Error: ipv4: FIB table does not exist.
 Dump terminated

Previously (with Buster) the above commands would output the (empty)
table.

After adding a route to the table, it becomes accessible:

 root@example:~# ip route add 1.2.3.4/32 via 127.0.0.1 table foo
 root@example:~# ip route show table foo
 1.2.3.4 via 127.0.0.1 dev lo


I am able to work around this problem by downgrading either the Linux
kernel or the iproute2 package to 4.19 (Buster).

I experimented a bit with different combinations of various versions of
the Linux kernel and the iproute2 package (thanks to snapshots.d.o):

 Linux 4.9.0-9-amd64 + iproute2 5.10.0-4 -> OK
 Linux 4.19.0-17-amd64 + iproute2 5.10.0-4 -> OK
 Linux 5.3.0-3-amd64 + iproute2 5.10.0-4 -> FAIL
 Linux 5.4.0-3-amd64 + iproute2 5.10.0-4 -> FAIL
 Linux 5.10.0-7-amd64 + iproute2 4.20.0-2+deb10u1 -> OK
 Linux 5.10.0-7-amd64 + iproute2 5.x -> FAIL

Thus the problem seems to have been introduced at the beginning of the
Linux 5.x series.

The problem is discussed here:
https://www.spinics.net/lists/netdev/msg559739.html
Relevant contributions in this thread seem to be:
https://www.spinics.net/lists/netdev/msg559925.html
https://www.spinics.net/lists/netdev/msg559906.html


Summary: "ip route show table SOMETHING" is failing now, if the table
"SOMETHING" does not contain any routes.  Previously it exited with
success (and empty output).

I can imagine, that this changed behaviour could break some scripts
related to policy routing. At least for me it caused problems with my
tinc setup.

Thank your for maintaining this package!

Cheers,
Lars