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

Function select_nhop

lib/ff_route.c:603–620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

601}
602
603static struct nhop_object *
604select_nhop(struct nhop_object *nh, const struct sockaddr *gw)
605{
606 if (!NH_IS_NHGRP(nh))
607 return (nh);
608#ifdef ROUTE_MPATH
609 struct weightened_nhop *wn;
610 uint32_t num_nhops;
611 wn = nhgrp_get_nhops((struct nhgrp_object *)nh, &num_nhops);
612 if (gw == NULL)
613 return (wn[0].nh);
614 for (int i = 0; i < num_nhops; i++) {
615 if (match_nhop_gw(wn[i].nh, gw))
616 return (wn[i].nh);
617 }
618#endif
619 return (NULL);
620}
621
622/*
623 * 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.70

Tested by

no test coverage detected