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

Function select_nhop

freebsd/net/rtsock.c:701–718  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

699}
700
701static struct nhop_object *
702select_nhop(struct nhop_object *nh, const struct sockaddr *gw)
703{
704 if (!NH_IS_NHGRP(nh))
705 return (nh);
706#ifdef ROUTE_MPATH
707 struct weightened_nhop *wn;
708 uint32_t num_nhops;
709 wn = nhgrp_get_nhops((struct nhgrp_object *)nh, &num_nhops);
710 if (gw == NULL)
711 return (wn[0].nh);
712 for (int i = 0; i < num_nhops; i++) {
713 if (match_nhop_gw(wn[i].nh, gw))
714 return (wn[i].nh);
715 }
716#endif
717 return (NULL);
718}
719
720/*
721 * Handles RTM_GET message from routing socket, returning matching rt.

Callers 1

handle_rtm_getFunction · 0.70

Calls 2

match_nhop_gwFunction · 0.85
nhgrp_get_nhopsFunction · 0.50

Tested by

no test coverage detected