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

Function ifa_ifwithbroadaddr

freebsd/net/if.c:1947–1971  ·  view source on GitHub ↗

* Locate an interface based on the broadcast address. */ ARGSUSED */

Source from the content-addressed store, hash-verified

1945 */
1946/* ARGSUSED */
1947struct ifaddr *
1948ifa_ifwithbroadaddr(const struct sockaddr *addr, int fibnum)
1949{
1950 struct ifnet *ifp;
1951 struct ifaddr *ifa;
1952
1953 NET_EPOCH_ASSERT();
1954 CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) {
1955 if ((fibnum != RT_ALL_FIBS) && (ifp->if_fib != fibnum))
1956 continue;
1957 CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
1958 if (ifa->ifa_addr->sa_family != addr->sa_family)
1959 continue;
1960 if ((ifp->if_flags & IFF_BROADCAST) &&
1961 ifa->ifa_broadaddr &&
1962 ifa->ifa_broadaddr->sa_len != 0 &&
1963 sa_equal(ifa->ifa_broadaddr, addr)) {
1964 goto done;
1965 }
1966 }
1967 }
1968 ifa = NULL;
1969done:
1970 return (ifa);
1971}
1972
1973/*
1974 * Locate the point to point interface with a given destination address.

Callers 1

ip_outputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected