mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-14 13:08:30 +04:00
On RTL839x a route forwards through its gateway's L2 entry. A gateway that sends nothing lets that entry age out, and a packet routed through it then hits the routing entry age-out exception, whose action is forward after reset: the packet is routed and also reaches the CPU, which routes it a second time when IPv4 forwarding is on. Trap it instead (ROUTING_AGE, bits 15:14 of ROUTING_EXCPT_CTRL: 0 drop, 1 forward, 2 trap; Realtek GPL SDK, dal_cypress_trap.c, exception ROUTE_EXCEPTION_TYPE_ENTRY_AGE_OUT), as the TTL exception already does. The CPU routes such packets alone until the gateway sends again and its entry is learnt anew. Measured on an HPE 1920-48G (RTL8393), 10.99.0.0/16 via a gateway that sends nothing, 8 echo requests per case, once the age of its L2 entry had run down to 0 (about 4.5 minutes on the bench): - without this change: forwarding off, 8/8 routed and 8/8 at the CPU as well; forwarding on, 14 at the gateway, 8 from the switch and 6 from the kernel - with it: forwarding off, none routed, 8/8 at the CPU; forwarding on, 8 at the gateway, none of them twice With a fresh entry, 8/8 were routed in hardware and none reached the CPU, without and with this change. Both images also carried the pending switch MAC change for #25768 items 3 and 4 and bench debugfs files. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Gennaro Cimmino <gcimmino@rayonra.net> Link: https://github.com/openwrt/openwrt/pull/25821 Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>