|
|
|
|
@ -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
|
|
|
|
|
|