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

Function lookup_nhop

freebsd/netinet/in_fib.c:213–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211
212#ifndef FIB_ALGO
213static struct nhop_object *
214lookup_nhop(uint32_t fibnum, struct in_addr dst, uint32_t scopeid)
215{
216 RIB_RLOCK_TRACKER;
217 struct rib_head *rh;
218 struct radix_node *rn;
219 struct nhop_object *nh;
220
221 KASSERT((fibnum < rt_numfibs), ("fib4_check_urpf: bad fibnum"));
222 rh = rt_tables_get_rnh(fibnum, AF_INET);
223 if (rh == NULL)
224 return (NULL);
225
226 /* Prepare lookup key */
227 struct sockaddr_in sin4;
228 memset(&sin4, 0, sizeof(sin4));
229 sin4.sin_len = sizeof(struct sockaddr_in);
230 sin4.sin_addr = dst;
231
232 nh = NULL;
233 RIB_RLOCK(rh);
234 rn = rh->rnh_matchaddr((void *)&sin4, &rh->head);
235 if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0))
236 nh = RNTORT(rn)->rt_nhop;
237 RIB_RUNLOCK(rh);
238
239 return (nh);
240}
241#endif
242
243/*

Callers 1

fib4_check_urpfFunction · 0.70

Calls 2

rt_tables_get_rnhFunction · 0.85
memsetFunction · 0.85

Tested by

no test coverage detected