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

Function sctp_asconf_iterator_stcb

freebsd/netinet/sctp_asconf.c:2099–2261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2097}
2098
2099void
2100sctp_asconf_iterator_stcb(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
2101 void *ptr, uint32_t val SCTP_UNUSED)
2102{
2103 struct sctp_asconf_iterator *asc;
2104 struct sctp_ifa *ifa;
2105 struct sctp_laddr *l;
2106 int cnt_invalid = 0;
2107 int type, status;
2108 int num_queued = 0;
2109
2110 asc = (struct sctp_asconf_iterator *)ptr;
2111 LIST_FOREACH(l, &asc->list_of_work, sctp_nxt_addr) {
2112 ifa = l->ifa;
2113 type = l->action;
2114
2115 /* address's vrf_id must be the vrf_id of the assoc */
2116 if (ifa->vrf_id != stcb->asoc.vrf_id) {
2117 continue;
2118 }
2119
2120 /* Same checks again for assoc */
2121 switch (ifa->address.sa.sa_family) {
2122#ifdef INET6
2123 case AF_INET6:
2124 {
2125 /* invalid if we're not a v6 endpoint */
2126 struct sockaddr_in6 *sin6;
2127
2128 if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) {
2129 cnt_invalid++;
2130 if (asc->cnt == cnt_invalid)
2131 return;
2132 else
2133 continue;
2134 }
2135 sin6 = &ifa->address.sin6;
2136 if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
2137 /* we skip unspecifed addresses */
2138 continue;
2139 }
2140 if (prison_check_ip6(inp->ip_inp.inp.inp_cred,
2141 &sin6->sin6_addr) != 0) {
2142 continue;
2143 }
2144 if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
2145 if (stcb->asoc.scope.local_scope == 0) {
2146 continue;
2147 }
2148 /* is it the right link local scope? */
2149 if (sctp_is_scopeid_in_nets(stcb, &ifa->address.sa) == 0) {
2150 continue;
2151 }
2152 }
2153 break;
2154 }
2155#endif
2156#ifdef INET

Callers

nothing calls this directly

Calls 9

sctp_is_scopeid_in_netsFunction · 0.85
sctp_free_ifaFunction · 0.85
sctp_is_addr_in_epFunction · 0.85
sctp_is_address_in_scopeFunction · 0.85
sctp_asconf_queue_addFunction · 0.85
sctp_send_asconfFunction · 0.85
prison_check_ip4Function · 0.70
prison_check_ip6Function · 0.50

Tested by

no test coverage detected