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

Function ia_need_loopback_route

freebsd/netinet/in.c:803–824  ·  view source on GitHub ↗

* Checks if @ia needs to install loopback route to @ia address via * ifa_maintain_loopback_route(). * * Return true on success. */

Source from the content-addressed store, hash-verified

801 * Return true on success.
802 */
803static bool
804ia_need_loopback_route(const struct in_ifaddr *ia)
805{
806 struct ifnet *ifp = ia->ia_ifp;
807
808 /* Case 4: Skip loopback interfaces */
809 if ((ifp->if_flags & IFF_LOOPBACK) ||
810 (ia->ia_addr.sin_addr.s_addr == INADDR_ANY))
811 return (false);
812
813 /* Clash avoidance: Skip p2p interfaces with both addresses are equal */
814 if ((ifp->if_flags & IFF_POINTOPOINT) &&
815 ia->ia_dstaddr.sin_addr.s_addr == ia->ia_addr.sin_addr.s_addr)
816 return (false);
817
818 /* Case 2: skip /32 prefixes */
819 if (!(ifp->if_flags & IFF_POINTOPOINT) &&
820 (ia->ia_sockmask.sin_addr.s_addr == INADDR_BROADCAST))
821 return (false);
822
823 return (true);
824}
825
826/*
827 * Calculate "prefix" route corresponding to @ia.

Callers 2

in_aifaddr_ioctlFunction · 0.85
in_scrubprefixFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected