Repository navigation
Commit e59089d
realtek: l3: skip IPv4 routes without a nexthop device
A blackhole, unreachable or prohibit route has no device behind its
nexthop: fib_create_info() refuses one for these types and skips the
nexthop check that would find one, so fib_nh_dev stays NULL.
otto_l3_fib_add_v4() hands that device to is_vlan_dev() before any
test, and otto_l3_fib_check_v4(), which the delete path runs as well,
does the same in its variable initialisers. On an RTL9303 with the L3
offload built in, "ip route add blackhole 10.99.8.0/24" oopses in the
rtl83xx work queue and panics the box:
CPU 0 Unable to handle kernel paging request at virtual address
00000000, epc == 8070fe3c, ra == 80710594
Workqueue: rtl83xx otto_l3_fib_event_work_do
epc : 8070fe3c otto_l3_fib_add_v4+0x1c0/0x794
Kernel panic - not syncing: Fatal exception
The faulting load is the priv_flags word is_vlan_dev() tests. Such
routes are common on a router, for address space it announces but does
not use.
Handle them where a route through a nexthop object is already handled,
for the same reasons: there is nothing to offload, and the route can
still replace one that was, so the entry for its destination is taken
out, and a host route is trapped where the host table can hold it. The
delete path takes the same exit.
Tested on an RTL9303 (Hasivo S1100W-8XGT-SE) with the L3 offload built
in. Without this change the command above panics the box; with it, a
blackhole /24 stays in the kernel with no entry in hardware, an
offloaded /24 replaced by a blackhole loses its entry and gets it back
when replaced through the gateway again, a blackhole /32 gets a trap
entry in the host table, unreachable and prohibit routes go in as
well, and every delete leaves no entry and no oops. RTL839x, which runs
this code in a stock build, was not tested.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Gennaro Cimmino <gcimmino@rayonra.net>
Link: openwrt/openwrt#25513
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>1 parent db61fd4 commit e59089d
1 file changed
Lines changed: 11 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1526 | 1526 | | |
1527 | 1527 | | |
1528 | 1528 | | |
1529 | | - | |
1530 | | - | |
1531 | | - | |
1532 | | - | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
1533 | 1534 | | |
1534 | | - | |
1535 | | - | |
| 1535 | + | |
| 1536 | + | |
1536 | 1537 | | |
1537 | 1538 | | |
1538 | 1539 | | |
| |||
1646 | 1647 | | |
1647 | 1648 | | |
1648 | 1649 | | |
1649 | | - | |
1650 | | - | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
1651 | 1654 | | |
1652 | 1655 | | |
1653 | 1656 | | |
| |||
0 commit comments