Re: [PATCH net v2 1/1] ipv4: fib: bound automatic table ID allocation
From: zihan xi <hidden>
Date: 2026-09-01 09:34:31
Also in:
lkml, stable
On Tue, Sep 1, 2026 at 5:21 PM Ido Schimmel [off-list ref] wrote:
On Tue, Sep 01, 2026 at 03:00:01AM +0000, Zihan Xi wrote:quoted
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@vger.kernel.org Reported-by: Vega <redacted> Suggested-by: Ido Schimmel <idosch@nvidia.com> Assisted-by: Codex:gpt-5.4 Signed-off-by: Zihan Xi <redacted>Reviewed-by: Ido Schimmel <idosch@nvidia.com> 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/ (local) [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=
Thanks for the review. I will send a v3 that spells out the user-visible change: table-0 auto-assignment now fails with ENOBUFS if IDs 1..4096 are occupied, while explicit table IDs are unchanged. I will also keep your Reviewed-by.