Changeset View
Changeset View
Standalone View
Standalone View
sys/net/route/route_ctl.c
Show First 20 Lines • Show All 1,322 Lines • ▼ Show 20 Lines | #endif | ||||
rt_routemsg(RTM_DELETE, rt, nh, fibnum); | rt_routemsg(RTM_DELETE, rt, nh, fibnum); | ||||
} | } | ||||
rtfree(rt); | rtfree(rt); | ||||
} | } | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
} | } | ||||
static int | |||||
rt_delete_unconditional(struct radix_node *rn, void *arg) | |||||
{ | |||||
struct rtentry *rt = RNTORT(rn); | |||||
struct rib_head *rnh = (struct rib_head *)arg; | |||||
rn = rnh->rnh_deladdr(rt_key(rt), rt_mask(rt), &rnh->head); | |||||
if (RNTORT(rn) == rt) | |||||
rtfree(rt); | |||||
return (0); | |||||
} | |||||
/* | |||||
* Removes all routes from the routing table without executing notifications. | |||||
* rtentres will be removed after the end of a current epoch. | |||||
*/ | |||||
static void | |||||
rib_flush_routes(struct rib_head *rnh) | |||||
{ | |||||
RIB_WLOCK(rnh); | |||||
rnh->rnh_walktree(&rnh->head, rt_delete_unconditional, rnh); | |||||
RIB_WUNLOCK(rnh); | |||||
} | |||||
void | |||||
rib_flush_routes_family(int family) | |||||
{ | |||||
struct rib_head *rnh; | |||||
for (uint32_t fibnum = 0; fibnum < rt_numfibs; fibnum++) { | |||||
if ((rnh = rt_tables_get_rnh(fibnum, family)) != NULL) | |||||
rib_flush_routes(rnh); | |||||
} | |||||
} | |||||
static void | static void | ||||
rib_notify(struct rib_head *rnh, enum rib_subscription_type type, | rib_notify(struct rib_head *rnh, enum rib_subscription_type type, | ||||
struct rib_cmd_info *rc) | struct rib_cmd_info *rc) | ||||
{ | { | ||||
struct rib_subscription *rs; | struct rib_subscription *rs; | ||||
CK_STAILQ_FOREACH(rs, &rnh->rnh_subscribers, next) { | CK_STAILQ_FOREACH(rs, &rnh->rnh_subscribers, next) { | ||||
if (rs->type == type) | if (rs->type == type) | ||||
▲ Show 20 Lines • Show All 150 Lines • Show Last 20 Lines |