Why Enabling Multipath Routing Shrinks the FIB Table: Uncovering a Hidden Linux Kernel Bug

A long‑standing Linux kernel bug causes the FIB routing hash table to shrink from 256 to 2 entries when multipath routing is enabled, leading to performance degradation; the article explains the faulty macros, traces the communication with the original authors, and advises applying the upstream fix or patching locally.

ITPUB
ITPUB
ITPUB
Why Enabling Multipath Routing Shrinks the FIB Table: Uncovering a Hidden Linux Kernel Bug

During a forum discussion a user noticed a puzzling piece of code in the Linux kernel’s routing subsystem. The macro definitions under #ifdef CONFIG_IP_ROUTE_MULTIPATH set FIB_TABLE_HASHSZ to 2 when multipath routing is enabled, and to 256 otherwise.

Why the macro is problematic

Logically, enabling multipath routing should increase the size of the routing hash table to accommodate more paths, not reduce it. The current definitions therefore produce an unintentionally small hash table, which can hurt routing performance.

Investigation and communication

The author first contacted the original maintainer, Alan Cox, who indicated he had not touched the code for 15 years and suggested speaking with Alexey Kuznetsov. Alexey redirected the query to Denis V. Lunev, who confirmed that the macro had been altered by a later patch and that the reduction was indeed a bug.

Resolution

Denis provided a corrected version of the macro, setting FIB_TABLE_HASHSZ to a larger value (e.g., 256) when CONFIG_IP_ROUTE_MULTIPATH is enabled. The upstream maintainer has submitted a fix, but it may take time before the change appears in released distributions.

Practical recommendation

For systems that require immediate remediation, users can apply the patch locally by replacing the macro definitions with the corrected values and recompiling the kernel. This will restore proper hash table sizing and improve routing performance.

Although the bug primarily affects performance and does not introduce functional failures, it has been present in the kernel for about four years, illustrating how subtle macro mistakes can linger unnoticed.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linux kernelpatchmultipathFIB
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.