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

Function ia_getrtprefix

freebsd/netinet/in.c:829–847  ·  view source on GitHub ↗

* Calculate "prefix" route corresponding to @ia. */

Source from the content-addressed store, hash-verified

827 * Calculate "prefix" route corresponding to @ia.
828 */
829static void
830ia_getrtprefix(const struct in_ifaddr *ia, struct in_addr *prefix, struct in_addr *mask)
831{
832
833 if (ia->ia_ifp->if_flags & IFF_POINTOPOINT) {
834 /* Case 3: return host route for dstaddr */
835 *prefix = ia->ia_dstaddr.sin_addr;
836 mask->s_addr = INADDR_BROADCAST;
837 } else if (ia->ia_ifp->if_flags & IFF_LOOPBACK) {
838 /* Case 4: return host route for ifaddr */
839 *prefix = ia->ia_addr.sin_addr;
840 mask->s_addr = INADDR_BROADCAST;
841 } else {
842 /* Cases 1,2: return actual ia prefix */
843 *prefix = ia->ia_addr.sin_addr;
844 *mask = ia->ia_sockmask.sin_addr;
845 prefix->s_addr &= mask->s_addr;
846 }
847}
848
849/*
850 * Adds or delete interface "prefix" route corresponding to @ifa.

Callers 3

in_handle_ifaddr_routeFunction · 0.85
in_hasrtprefixFunction · 0.85
in_scrubprefixFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected