mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-24 10:37:52 +04:00
The prefix row placement is common to RTL839x and RTL930x, but where an IPv6 entry sits is not: an RTL839x PIE rule matches a whole IPv6 destination in any row, while an RTL930x entry spans three rows and may only start on two rows of every eight. otto_l3_v6_row() and otto_l3_v6_slot() chose between the two layouts through use_l3_tables, which says how a family routes, not how its table is laid out. Give the families v6_slot_to_row() and v6_row_to_slot() and move each layout next to its row mover. Ordering, insertion, compaction and the capacity and IPv4/IPv6 collision checks stay common, and keep calling the same two helpers, which now ask the family. The common code calls them only for a family with a row mover. The formulas move unchanged. Built on the host from l3.c as it is, the placement code before and after this change maps every slot and row of both layouts alike, and runs 160000 random IPv4 and IPv6 insertions and removals, past a full table on both families, with the same rows and the same moves; a one-line mutation planted in each of the four callbacks makes the results differ. On an HPE 1920-48G (RTL8393) an IPv6 test round passes 20 of 20 checks, among them a /48 and a /64 inserted in both orders and IPv4 and IPv6 routes side by side, the routes of those checks forwarded in hardware to the right gateway. RTL930x is compile-tested only. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Gennaro Cimmino <gcimmino@rayonra.net> Link: https://github.com/openwrt/openwrt/pull/25868 Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>