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

Function ifa_ifwithaddr

freebsd/net/if.c:1902–1929  ·  view source on GitHub ↗

* Locate an interface based on a complete address. */ ARGSUSED*/

Source from the content-addressed store, hash-verified

1900 */
1901/*ARGSUSED*/
1902struct ifaddr *
1903ifa_ifwithaddr(const struct sockaddr *addr)
1904{
1905 struct ifnet *ifp;
1906 struct ifaddr *ifa;
1907
1908 NET_EPOCH_ASSERT();
1909
1910 CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) {
1911 CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
1912 if (ifa->ifa_addr->sa_family != addr->sa_family)
1913 continue;
1914 if (sa_equal(addr, ifa->ifa_addr)) {
1915 goto done;
1916 }
1917 /* IP6 doesn't have broadcast */
1918 if ((ifp->if_flags & IFF_BROADCAST) &&
1919 ifa->ifa_broadaddr &&
1920 ifa->ifa_broadaddr->sa_len != 0 &&
1921 sa_equal(ifa->ifa_broadaddr, addr)) {
1922 goto done;
1923 }
1924 }
1925 }
1926 ifa = NULL;
1927done:
1928 return (ifa);
1929}
1930
1931int
1932ifa_ifwithaddr_check(const struct sockaddr *addr)

Callers 10

div_output_inboundFunction · 0.85
in_pcbladdrFunction · 0.85
add_vifFunction · 0.85
ip_dooptionsFunction · 0.85
in6_pcbbindFunction · 0.85
rip6_bindFunction · 0.85
ifa_ifwithaddr_checkFunction · 0.85
vxlan_set_hwcapsFunction · 0.85
ifa_ifwithrouteFunction · 0.85
rt_getifa_fibFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected