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

Function in_localip_more

freebsd/netinet/in.c:165–188  ·  view source on GitHub ↗

* Return a reference to the interface address which is different to * the supplied one but with same IP address value. */

Source from the content-addressed store, hash-verified

163 * the supplied one but with same IP address value.
164 */
165static struct in_ifaddr *
166in_localip_more(struct in_ifaddr *original_ia)
167{
168 struct rm_priotracker in_ifa_tracker;
169 in_addr_t original_addr = IA_SIN(original_ia)->sin_addr.s_addr;
170 uint32_t original_fib = original_ia->ia_ifa.ifa_ifp->if_fib;
171 struct in_ifaddr *ia;
172
173 IN_IFADDR_RLOCK(&in_ifa_tracker);
174 LIST_FOREACH(ia, INADDR_HASH(original_addr), ia_hash) {
175 in_addr_t addr = IA_SIN(ia)->sin_addr.s_addr;
176 uint32_t fib = ia->ia_ifa.ifa_ifp->if_fib;
177 if (!V_rt_add_addr_allfibs && (original_fib != fib))
178 continue;
179 if ((original_ia != ia) && (original_addr == addr)) {
180 ifa_ref(&ia->ia_ifa);
181 IN_IFADDR_RUNLOCK(&in_ifa_tracker);
182 return (ia);
183 }
184 }
185 IN_IFADDR_RUNLOCK(&in_ifa_tracker);
186
187 return (NULL);
188}
189
190/*
191 * Determine whether an IP address is in a reserved set of addresses

Callers 2

in_aifaddr_ioctlFunction · 0.85
in_scrubprefixFunction · 0.85

Calls 1

ifa_refFunction · 0.85

Tested by

no test coverage detected