MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rt_table_init

Function rt_table_init

freebsd/net/route.c:97–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95SYSINIT(route_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, route_init, NULL);
96
97struct rib_head *
98rt_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
138static int
139rt_freeentry(struct radix_node *rn, void *arg)

Callers 2

in_initheadFunction · 0.85
in6_initheadFunction · 0.85

Calls 5

mallocFunction · 0.85
rn_inithead_internalFunction · 0.85
tmproutes_initFunction · 0.85
nhops_init_ribFunction · 0.85
rib_init_subscriptionsFunction · 0.85

Tested by

no test coverage detected