Re: [PATCH net v2 1/1] ipv4: fib: bound automatic table ID allocation
From: Ido Schimmel
Date: Tue Sep 01 2026 - 05:59:34 EST
On Tue, Sep 01, 2026 at 03:00:01AM +0000, Zihan Xi wrote:
> fib_empty_table() probes every table ID from 1 until it finds a
> free one. IPv4 tables are stored in a 256-bucket hash table, so a
> dense set of IDs makes each probe walk a growing hash chain while
> RTNL is held.
>
> Automatic table assignment ("ip rule ... table 0") is an IPv4-only
> legacy path. Bound the automatically allocated ID to 4096 so the
> RTNL hold stays bounded, without changing lookups of explicitly
> specified table IDs.
>
> Fixes: b801f54917b7 ("[NET]: Increate RT_TABLE_MAX to 2^32")
> Cc: stable@xxxxxxxxxxxxxxx
> Reported-by: Vega <vega@xxxxxxxxxx>
> Suggested-by: Ido Schimmel <idosch@xxxxxxxxxx>
> Assisted-by: Codex:gpt-5.4
> Signed-off-by: Zihan Xi <zihanx@xxxxxxxxxx>
Reviewed-by: Ido Schimmel <idosch@xxxxxxxxxx>
The bots will likely complain about the change in behavior because the
commit message doesn't spell it out. I explained why I think it's safe
in [1]. In addition, I checked, and both NetworkManager [2] and systemd
[3][4] explicitly forbid "table 0".
[1] https://lore.kernel.org/all/20260831110647.GA3202627@shredder/
[2] https://github.com/NetworkManager/NetworkManager/blob/2e83a4082b223499c4f1bba156998d0171071967/src/libnm-core-impl/nm-setting-ip-config.c#L2747-L2758
[3] https://github.com/systemd/systemd/blob/9b62fd169e06d14cbab801c66f2f9c2006edb75c/src/network/networkd-route-util.c#L456-L457
[4] https://www.freedesktop.org/software/systemd/man/latest/systemd.network.html#Table=