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

Function sctp_is_scopeid_in_nets

freebsd/netinet/sctp_asconf.c:1851–1881  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1849
1850#ifdef INET6
1851static uint32_t
1852sctp_is_scopeid_in_nets(struct sctp_tcb *stcb, struct sockaddr *sa)
1853{
1854 struct sockaddr_in6 *sin6, *net6;
1855 struct sctp_nets *net;
1856
1857 if (sa->sa_family != AF_INET6) {
1858 /* wrong family */
1859 return (0);
1860 }
1861 sin6 = (struct sockaddr_in6 *)sa;
1862 if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) == 0) {
1863 /* not link local address */
1864 return (0);
1865 }
1866 /* hunt through our destination nets list for this scope_id */
1867 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
1868 if (((struct sockaddr *)(&net->ro._l_addr))->sa_family !=
1869 AF_INET6)
1870 continue;
1871 net6 = (struct sockaddr_in6 *)&net->ro._l_addr;
1872 if (IN6_IS_ADDR_LINKLOCAL(&net6->sin6_addr) == 0)
1873 continue;
1874 if (sctp_is_same_scope(sin6, net6)) {
1875 /* found one */
1876 return (1);
1877 }
1878 }
1879 /* didn't find one */
1880 return (0);
1881}
1882#endif
1883
1884/*

Callers 2

sctp_addr_mgmt_assocFunction · 0.85

Calls 1

sctp_is_same_scopeFunction · 0.85

Tested by

no test coverage detected