From 7f773c67c805e000187ba96dc9fdc269d639538e Mon Sep 17 00:00:00 2001 From: Evgeny Date: Sun, 8 Mar 2026 20:07:53 +0300 Subject: [PATCH] 1 --- src/tun_route.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/tun_route.c b/src/tun_route.c index 02ed902..61dd4bf 100644 --- a/src/tun_route.c +++ b/src/tun_route.c @@ -510,6 +510,24 @@ int tun_route_flush(const char *ifname) { return (ret == 0) ? 0 : -1; } +int tun_route_del_all(uint32_t ifindex, const char *ifname, struct CFG_ROUTE_ENTRY *routes) { + int count = 0; + struct CFG_ROUTE_ENTRY *entry = routes; + + while (entry) { + uint32_t network = ntohl(entry->ip.addr.v4.s_addr); + if (entry->ip.family == AF_INET) { + if (tun_route_del(ifindex, ifname, network, entry->netmask) == 0) { + count++; + } + } + entry = entry->next; + } + + DEBUG_INFO(DEBUG_CATEGORY_TUN, "Deleted %d routes via ifindex=%lu", count, (unsigned long)ifindex); + return count; +} + #endif // Platform-independent functions