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

Function rib_lookup

freebsd/net/route/route_helpers.c:192–221  ·  view source on GitHub ↗

* Wrapper for the control plane functions for performing af-agnostic * lookups. * @fibnum: fib to perform the lookup. * @dst: sockaddr with family and addr filled in. IPv6 addresses needs to be in * deembedded from. * @flags: fib(9) flags. * @flowid: flow id for path selection in multipath use case. * * Returns nhop_object or NULL. * * Requires NET_EPOCH. * */

Source from the content-addressed store, hash-verified

190 *
191 */
192struct nhop_object *
193rib_lookup(uint32_t fibnum, const struct sockaddr *dst, uint32_t flags,
194 uint32_t flowid)
195{
196 struct nhop_object *nh;
197
198 nh = NULL;
199
200 switch (dst->sa_family) {
201#ifdef INET
202 case AF_INET:
203 {
204 const struct sockaddr_in *a = (const struct sockaddr_in *)dst;
205 nh = fib4_lookup(fibnum, a->sin_addr, 0, flags, flowid);
206 break;
207 }
208#endif
209#ifdef INET6
210 case AF_INET6:
211 {
212 const struct sockaddr_in6 *a = (const struct sockaddr_in6*)dst;
213 nh = fib6_lookup(fibnum, &a->sin6_addr, a->sin6_scope_id,
214 flags, flowid);
215 break;
216 }
217#endif
218 }
219
220 return (nh);
221}
222
223#ifdef ROUTE_MPATH
224static void

Callers 1

ifa_ifwithrouteFunction · 0.85

Calls 2

fib4_lookupFunction · 0.85
fib6_lookupFunction · 0.85

Tested by

no test coverage detected