From 9dcd809778256615895de139cff6a0436e54dda6 Mon Sep 17 00:00:00 2001 From: Red Bear OS Date: Thu, 9 Jul 2026 11:16:33 +0300 Subject: [PATCH] =?UTF-8?q?route:=20flush=20node=20=E2=80=94=20clear=20ent?= =?UTF-8?q?ire=20routing=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New /scheme/netcfg/route/flush clears all routes at once: echo > /scheme/netcfg/route/flush Mirrors Linux 'ip route flush all'. Replaces the route table with a new empty RouteTable. All existing Rc shares see the change immediately. Useful for bulk route management (clear and re-add). Notifies route/list subscribers after flush. All 31 tests pass. --- netstack/src/scheme/netcfg/mod.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/netstack/src/scheme/netcfg/mod.rs b/netstack/src/scheme/netcfg/mod.rs index 2e4f1cfc04..b381d1be1c 100644 --- a/netstack/src/scheme/netcfg/mod.rs +++ b/netstack/src/scheme/netcfg/mod.rs @@ -128,7 +128,7 @@ fn mk_root_node( nat — NAT bindings (bindings / stats)\n\ capture — packet capture (enable/read/filter/count)\n\ sysctl — kernel tunables (net/ipv4/ip_forward)\n\ - route — routing table (list/add/rm/count/gateway)\n\ + route — routing table (list/add/rm/flush/count/gateway)\n\ resolv — DNS configuration (nameserver/nameserver6)\n\ ifaces — per-interface config/stats (eth0/lo/...)\n\ version — netstack version info\n" @@ -566,9 +566,20 @@ fn mk_root_node( notifier.borrow_mut().schedule_notify("route/list"); } Ok(()) - } - }, - }, + } + }, + "flush" => { + wo [route_table, notifier] (Option<()>, None) + |_cur_value, _line| { + Ok(()) + } + |_cur_value| { + *route_table.borrow_mut() = RouteTable::default(); + notifier.borrow_mut().schedule_notify("route/list"); + Ok(()) + } + }, + }, "arp" => { "list" => { ro [devices] || {