| 95 | SYSINIT(route_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, route_init, NULL); |
| 96 | |
| 97 | struct rib_head * |
| 98 | rt_table_init(int offset, int family, u_int fibnum) |
| 99 | { |
| 100 | struct rib_head *rh; |
| 101 | |
| 102 | rh = malloc(sizeof(struct rib_head), M_RTABLE, M_WAITOK | M_ZERO); |
| 103 | |
| 104 | /* TODO: These details should be hidded inside radix.c */ |
| 105 | /* Init masks tree */ |
| 106 | rn_inithead_internal(&rh->head, rh->rnh_nodes, offset); |
| 107 | rn_inithead_internal(&rh->rmhead.head, rh->rmhead.mask_nodes, 0); |
| 108 | rh->head.rnh_masks = &rh->rmhead; |
| 109 | |
| 110 | /* Save metadata associated with this routing table. */ |
| 111 | rh->rib_family = family; |
| 112 | rh->rib_fibnum = fibnum; |
| 113 | #ifdef VIMAGE |
| 114 | rh->rib_vnet = curvnet; |
| 115 | #endif |
| 116 | |
| 117 | tmproutes_init(rh); |
| 118 | |
| 119 | /* Init locks */ |
| 120 | RIB_LOCK_INIT(rh); |
| 121 | |
| 122 | nhops_init_rib(rh); |
| 123 | |
| 124 | /* Init subscription system */ |
| 125 | rib_init_subscriptions(rh); |
| 126 | |
| 127 | /* Finally, set base callbacks */ |
| 128 | rh->rnh_addaddr = rn_addroute; |
| 129 | rh->rnh_deladdr = rn_delete; |
| 130 | rh->rnh_matchaddr = rn_match; |
| 131 | rh->rnh_lookup = rn_lookup; |
| 132 | rh->rnh_walktree = rn_walktree; |
| 133 | rh->rnh_walktree_from = rn_walktree_from; |
| 134 | |
| 135 | return (rh); |
| 136 | } |
| 137 | |
| 138 | static int |
| 139 | rt_freeentry(struct radix_node *rn, void *arg) |
no test coverage detected