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

Function in6_selectsrc_addr

freebsd/netinet6/in6_src.c:594–616  ·  view source on GitHub ↗

* Select source address based on @fibnum, @dst and @scopeid. * Stores selected address to @srcp. * Returns 0 on success. * * Used by non-socket based consumers (ND code mostly) */

Source from the content-addressed store, hash-verified

592 * Used by non-socket based consumers (ND code mostly)
593 */
594int
595in6_selectsrc_addr(uint32_t fibnum, const struct in6_addr *dst,
596 uint32_t scopeid, struct ifnet *ifp, struct in6_addr *srcp,
597 int *hlim)
598{
599 struct ifnet *retifp;
600 struct sockaddr_in6 dst_sa;
601 int error;
602
603 retifp = ifp;
604 bzero(&dst_sa, sizeof(dst_sa));
605 dst_sa.sin6_family = AF_INET6;
606 dst_sa.sin6_len = sizeof(dst_sa);
607 dst_sa.sin6_addr = *dst;
608 dst_sa.sin6_scope_id = scopeid;
609 sa6_embedscope(&dst_sa, 0);
610
611 error = in6_selectsrc(fibnum, &dst_sa, NULL, NULL, NULL, &retifp, srcp);
612 if (hlim != NULL)
613 *hlim = in6_selecthlim(NULL, retifp);
614
615 return (error);
616}
617
618/*
619 * clone - meaningful only for bsdi and freebsd

Callers 4

nat64_icmp6_reflectFunction · 0.85
nd6_ns_output_fibFunction · 0.85
nd6_na_output_fibFunction · 0.85
icmp6_reflectFunction · 0.85

Calls 4

bzeroFunction · 0.85
sa6_embedscopeFunction · 0.85
in6_selectsrcFunction · 0.85
in6_selecthlimFunction · 0.85

Tested by

no test coverage detected