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

Function stf_getsrcifa6

freebsd/net/if_stf.c:369–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367}
368
369static int
370stf_getsrcifa6(struct ifnet *ifp, struct in6_addr *addr, struct in6_addr *mask)
371{
372 struct rm_priotracker in_ifa_tracker;
373 struct ifaddr *ia;
374 struct in_ifaddr *ia4;
375 struct in6_ifaddr *ia6;
376 struct sockaddr_in6 *sin6;
377 struct in_addr in;
378
379 NET_EPOCH_ASSERT();
380
381 CK_STAILQ_FOREACH(ia, &ifp->if_addrhead, ifa_link) {
382 if (ia->ifa_addr->sa_family != AF_INET6)
383 continue;
384 sin6 = (struct sockaddr_in6 *)ia->ifa_addr;
385 if (!IN6_IS_ADDR_6TO4(&sin6->sin6_addr))
386 continue;
387
388 bcopy(GET_V4(&sin6->sin6_addr), &in, sizeof(in));
389 IN_IFADDR_RLOCK(&in_ifa_tracker);
390 LIST_FOREACH(ia4, INADDR_HASH(in.s_addr), ia_hash)
391 if (ia4->ia_addr.sin_addr.s_addr == in.s_addr)
392 break;
393 IN_IFADDR_RUNLOCK(&in_ifa_tracker);
394 if (ia4 == NULL)
395 continue;
396
397 ia6 = (struct in6_ifaddr *)ia;
398
399 *addr = sin6->sin6_addr;
400 *mask = ia6->ia_prefixmask.sin6_addr;
401 return (0);
402 }
403
404 return (ENOENT);
405}
406
407static int
408stf_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,

Callers 2

stf_encapcheckFunction · 0.85
stf_outputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected