Changeset View
Changeset View
Standalone View
Standalone View
sys/net/route.c
Show First 20 Lines • Show All 342 Lines • ▼ Show 20 Lines | vnet_route_uninit(const void *unused __unused) | ||||
free(V_rt_tables, M_RTABLE); | free(V_rt_tables, M_RTABLE); | ||||
uma_zdestroy(V_rtzone); | uma_zdestroy(V_rtzone); | ||||
} | } | ||||
VNET_SYSUNINIT(vnet_route_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, | VNET_SYSUNINIT(vnet_route_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, | ||||
vnet_route_uninit, 0); | vnet_route_uninit, 0); | ||||
#endif | #endif | ||||
struct rib_head * | struct rib_head * | ||||
rt_table_init(int offset, int family, u_int fibnum) | rt_table_init(int offset, int keylen, int family, u_int fibnum) | ||||
{ | { | ||||
struct rib_head *rh; | struct rib_head *rh; | ||||
rh = malloc(sizeof(struct rib_head), M_RTABLE, M_WAITOK | M_ZERO); | rh = malloc(sizeof(struct rib_head), M_RTABLE, M_WAITOK | M_ZERO); | ||||
/* TODO: These details should be hidded inside radix.c */ | /* TODO: These details should be hidded inside radix.c */ | ||||
/* Init masks tree */ | /* Init masks tree */ | ||||
rn_inithead_internal(&rh->head, rh->rnh_nodes, offset); | rn_inithead_internal(&rh->head, rh->rnh_nodes, offset); | ||||
rn_setkeylen(&rh->head, keylen); | |||||
rn_inithead_internal(&rh->rmhead.head, rh->rmhead.mask_nodes, 0); | rn_inithead_internal(&rh->rmhead.head, rh->rmhead.mask_nodes, 0); | ||||
rh->head.rnh_masks = &rh->rmhead; | rh->head.rnh_masks = &rh->rmhead; | ||||
/* Save metadata associated with this routing table. */ | /* Save metadata associated with this routing table. */ | ||||
rh->rib_family = family; | rh->rib_family = family; | ||||
rh->rib_fibnum = fibnum; | rh->rib_fibnum = fibnum; | ||||
#ifdef VIMAGE | #ifdef VIMAGE | ||||
rh->rib_vnet = curvnet; | rh->rib_vnet = curvnet; | ||||
#endif | #endif | ||||
tmproutes_init(rh); | tmproutes_init(rh); | ||||
/* Init locks */ | /* Init locks */ | ||||
RIB_LOCK_INIT(rh); | RIB_LOCK_INIT(rh); | ||||
/* Finally, set base callbacks */ | /* Finally, set base callbacks */ | ||||
rh->rnh_addaddr = rn_addroute; | rh->rnh_addaddr = rn_addroute; | ||||
rh->rnh_deladdr = rn_delete; | rh->rnh_deladdr = rn_delete; | ||||
rh->rnh_matchaddr = rn_match; | rh->rnh_matchaddr = rn_match_fixed; | ||||
rh->rnh_lookup = rn_lookup; | rh->rnh_lookup = rn_lookup; | ||||
rh->rnh_walktree = rn_walktree; | rh->rnh_walktree = rn_walktree; | ||||
rh->rnh_walktree_from = rn_walktree_from; | rh->rnh_walktree_from = rn_walktree_from; | ||||
return (rh); | return (rh); | ||||
} | } | ||||
static int | static int | ||||
▲ Show 20 Lines • Show All 1,904 Lines • Show Last 20 Lines |