Lines Matching full:asoc

75 static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p,
88 static int sctp_send_asconf(struct sctp_association *asoc,
108 static inline int sctp_wspace(struct sctp_association *asoc) in sctp_wspace() argument
110 struct sock *sk = asoc->base.sk; in sctp_wspace()
112 return asoc->ep->sndbuf_policy ? sk->sk_sndbuf - asoc->sndbuf_used in sctp_wspace()
127 struct sctp_association *asoc = chunk->asoc; in sctp_set_owner_w() local
128 struct sock *sk = asoc->base.sk; in sctp_set_owner_w()
131 sctp_association_hold(asoc); in sctp_set_owner_w()
143 asoc->sndbuf_used += chunk->skb->truesize + sizeof(struct sctp_chunk); in sctp_set_owner_w()
159 if ((clear && asoc->base.sk == c->skb->sk) || \
160 (!clear && asoc->base.sk != c->skb->sk)) \
166 static void sctp_for_each_tx_datachunk(struct sctp_association *asoc, in sctp_for_each_tx_datachunk() argument
172 struct sctp_outq *q = &asoc->outqueue; in sctp_for_each_tx_datachunk()
176 list_for_each_entry(t, &asoc->peer.transport_addr_list, transports) in sctp_for_each_tx_datachunk()
193 static void sctp_for_each_rx_skb(struct sctp_association *asoc, struct sock *sk, in sctp_for_each_rx_skb() argument
199 sctp_skb_for_each(skb, &asoc->ulpq.lobby, tmp) in sctp_for_each_rx_skb()
202 sctp_skb_for_each(skb, &asoc->ulpq.reasm, tmp) in sctp_for_each_rx_skb()
205 sctp_skb_for_each(skb, &asoc->ulpq.reasm_uo, tmp) in sctp_for_each_rx_skb()
235 struct sctp_association *asoc = NULL; in sctp_id2assoc() local
248 asoc = list_entry(sctp_sk(sk)->ep->asocs.next, in sctp_id2assoc()
250 return asoc; in sctp_id2assoc()
258 asoc = (struct sctp_association *)idr_find(&sctp_assocs_id, (int)id); in sctp_id2assoc()
259 if (asoc && (asoc->base.sk != sk || asoc->base.dead)) in sctp_id2assoc()
260 asoc = NULL; in sctp_id2assoc()
263 return asoc; in sctp_id2assoc()
468 static int sctp_send_asconf(struct sctp_association *asoc, in sctp_send_asconf() argument
476 if (asoc->addip_last_asconf) { in sctp_send_asconf()
477 list_add_tail(&chunk->list, &asoc->addip_chunk_list); in sctp_send_asconf()
483 retval = sctp_primitive_ASCONF(asoc->base.net, asoc, chunk); in sctp_send_asconf()
487 asoc->addip_last_asconf = chunk; in sctp_send_asconf()
561 struct sctp_association *asoc; in sctp_send_asconf_add_ip() local
582 list_for_each_entry(asoc, &ep->asocs, asocs) { in sctp_send_asconf_add_ip()
583 if (!asoc->peer.asconf_capable) in sctp_send_asconf_add_ip()
586 if (asoc->peer.addip_disabled_mask & SCTP_PARAM_ADD_IP) in sctp_send_asconf_add_ip()
589 if (!sctp_state(asoc, ESTABLISHED)) in sctp_send_asconf_add_ip()
606 if (sctp_assoc_lookup_laddr(asoc, addr)) in sctp_send_asconf_add_ip()
617 bp = &asoc->base.bind_addr; in sctp_send_asconf_add_ip()
620 chunk = sctp_make_asconf_update_ip(asoc, &laddr->a, addrs, in sctp_send_asconf_add_ip()
640 if (asoc->src_out_of_asoc_ok) { in sctp_send_asconf_add_ip()
644 &asoc->peer.transport_addr_list, transports) { in sctp_send_asconf_add_ip()
645 trans->cwnd = min(4*asoc->pathmtu, max_t(__u32, in sctp_send_asconf_add_ip()
646 2*asoc->pathmtu, 4380)); in sctp_send_asconf_add_ip()
647 trans->ssthresh = asoc->peer.i.a_rwnd; in sctp_send_asconf_add_ip()
648 trans->rto = asoc->rto_initial; in sctp_send_asconf_add_ip()
649 sctp_max_rto(asoc, trans); in sctp_send_asconf_add_ip()
653 sctp_sk(asoc->base.sk)); in sctp_send_asconf_add_ip()
656 retval = sctp_send_asconf(asoc, chunk); in sctp_send_asconf_add_ip()
763 struct sctp_association *asoc; in sctp_send_asconf_del_ip() local
785 list_for_each_entry(asoc, &ep->asocs, asocs) { in sctp_send_asconf_del_ip()
787 if (!asoc->peer.asconf_capable) in sctp_send_asconf_del_ip()
790 if (asoc->peer.addip_disabled_mask & SCTP_PARAM_DEL_IP) in sctp_send_asconf_del_ip()
793 if (!sctp_state(asoc, ESTABLISHED)) in sctp_send_asconf_del_ip()
810 if (!sctp_assoc_lookup_laddr(asoc, laddr)) in sctp_send_asconf_del_ip()
823 bp = &asoc->base.bind_addr; in sctp_send_asconf_del_ip()
827 if (asoc->asconf_addr_del_pending) in sctp_send_asconf_del_ip()
829 asoc->asconf_addr_del_pending = in sctp_send_asconf_del_ip()
831 if (asoc->asconf_addr_del_pending == NULL) { in sctp_send_asconf_del_ip()
835 asoc->asconf_addr_del_pending->sa.sa_family = in sctp_send_asconf_del_ip()
837 asoc->asconf_addr_del_pending->v4.sin_port = in sctp_send_asconf_del_ip()
843 asoc->asconf_addr_del_pending->v4.sin_addr.s_addr = sin->sin_addr.s_addr; in sctp_send_asconf_del_ip()
848 asoc->asconf_addr_del_pending->v6.sin6_addr = sin6->sin6_addr; in sctp_send_asconf_del_ip()
851 pr_debug("%s: keep the last address asoc:%p %pISc at %p\n", in sctp_send_asconf_del_ip()
852 __func__, asoc, &asoc->asconf_addr_del_pending->sa, in sctp_send_asconf_del_ip()
853 asoc->asconf_addr_del_pending); in sctp_send_asconf_del_ip()
855 asoc->src_out_of_asoc_ok = 1; in sctp_send_asconf_del_ip()
867 chunk = sctp_make_asconf_update_ip(asoc, laddr, addrs, addrcnt, in sctp_send_asconf_del_ip()
893 list_for_each_entry(transport, &asoc->peer.transport_addr_list, in sctp_send_asconf_del_ip()
896 sctp_sk(asoc->base.sk)); in sctp_send_asconf_del_ip()
902 retval = sctp_send_asconf(asoc, chunk); in sctp_send_asconf_del_ip()
1072 struct sctp_association *asoc; in sctp_connect_new_asoc() local
1091 asoc = sctp_association_new(ep, sk, scope, GFP_KERNEL); in sctp_connect_new_asoc()
1092 if (!asoc) in sctp_connect_new_asoc()
1095 err = sctp_assoc_set_bind_addr_from_ep(asoc, scope, GFP_KERNEL); in sctp_connect_new_asoc()
1099 *tp = sctp_assoc_add_peer(asoc, daddr, GFP_KERNEL, SCTP_UNKNOWN); in sctp_connect_new_asoc()
1111 asoc->c.sinit_num_ostreams = outcnt; in sctp_connect_new_asoc()
1113 err = sctp_stream_init(&asoc->stream, outcnt, 0, GFP_KERNEL); in sctp_connect_new_asoc()
1119 asoc->c.sinit_max_instreams = init->sinit_max_instreams; in sctp_connect_new_asoc()
1122 asoc->max_init_attempts = init->sinit_max_attempts; in sctp_connect_new_asoc()
1125 asoc->max_init_timeo = in sctp_connect_new_asoc()
1130 sctp_association_free(asoc); in sctp_connect_new_asoc()
1134 static int sctp_connect_add_peer(struct sctp_association *asoc, in sctp_connect_add_peer() argument
1137 struct sctp_endpoint *ep = asoc->ep; in sctp_connect_add_peer()
1147 if (old && old != asoc) in sctp_connect_add_peer()
1154 t = sctp_assoc_add_peer(asoc, daddr, GFP_KERNEL, SCTP_UNKNOWN); in sctp_connect_add_peer()
1172 struct sctp_association *asoc; in __sctp_connect() local
1192 asoc = sctp_endpoint_lookup_assoc(ep, daddr, &transport); in __sctp_connect()
1193 if (asoc) in __sctp_connect()
1194 return asoc->state >= SCTP_STATE_ESTABLISHED ? -EISCONN in __sctp_connect()
1200 asoc = transport->asoc; in __sctp_connect()
1214 if (asoc->peer.port != ntohs(daddr->v4.sin_port)) in __sctp_connect()
1217 err = sctp_connect_add_peer(asoc, daddr, af->sockaddr_len); in __sctp_connect()
1229 err = sctp_assoc_set_id(asoc, GFP_KERNEL); in __sctp_connect()
1234 err = sctp_primitive_ASSOCIATE(sock_net(sk), asoc, NULL); in __sctp_connect()
1239 inet_sk(sk)->inet_dport = htons(asoc->peer.port); in __sctp_connect()
1244 *assoc_id = asoc->assoc_id; in __sctp_connect()
1247 return sctp_wait_for_connect(asoc, &timeo); in __sctp_connect()
1250 pr_debug("%s: took out_free path with asoc:%p kaddrs:%p err:%d\n", in __sctp_connect()
1251 __func__, asoc, kaddrs, err); in __sctp_connect()
1252 sctp_association_free(asoc); in __sctp_connect()
1260 * sctp_assoc_t *asoc);
1487 struct sctp_association *asoc; in sctp_close() local
1505 asoc = list_entry(pos, struct sctp_association, asocs); in sctp_close()
1513 if (sctp_state(asoc, CLOSED)) { in sctp_close()
1514 sctp_association_free(asoc); in sctp_close()
1519 if (data_was_unread || !skb_queue_empty(&asoc->ulpq.lobby) || in sctp_close()
1520 !skb_queue_empty(&asoc->ulpq.reasm) || in sctp_close()
1521 !skb_queue_empty(&asoc->ulpq.reasm_uo) || in sctp_close()
1525 chunk = sctp_make_abort_user(asoc, NULL, 0); in sctp_close()
1526 sctp_primitive_ABORT(net, asoc, chunk); in sctp_close()
1528 sctp_primitive_SHUTDOWN(net, asoc, NULL); in sctp_close()
1663 struct sctp_association *asoc; in sctp_sendmsg_new_asoc() local
1696 asoc = (*tp)->asoc; in sctp_sendmsg_new_asoc()
1725 daddr->v4.sin_port = htons(asoc->peer.port); in sctp_sendmsg_new_asoc()
1736 daddr->v6.sin6_port = htons(asoc->peer.port); in sctp_sendmsg_new_asoc()
1740 err = sctp_connect_add_peer(asoc, daddr, sizeof(*daddr)); in sctp_sendmsg_new_asoc()
1748 sctp_association_free(asoc); in sctp_sendmsg_new_asoc()
1752 static int sctp_sendmsg_check_sflags(struct sctp_association *asoc, in sctp_sendmsg_check_sflags() argument
1756 struct sock *sk = asoc->base.sk; in sctp_sendmsg_check_sflags()
1759 if (sctp_state(asoc, CLOSED) && sctp_style(sk, TCP)) in sctp_sendmsg_check_sflags()
1763 !sctp_state(asoc, ESTABLISHED)) in sctp_sendmsg_check_sflags()
1767 pr_debug("%s: shutting down association:%p\n", __func__, asoc); in sctp_sendmsg_check_sflags()
1768 sctp_primitive_SHUTDOWN(net, asoc, NULL); in sctp_sendmsg_check_sflags()
1776 chunk = sctp_make_abort_user(asoc, msg, msg_len); in sctp_sendmsg_check_sflags()
1780 pr_debug("%s: aborting association:%p\n", __func__, asoc); in sctp_sendmsg_check_sflags()
1781 sctp_primitive_ABORT(net, asoc, chunk); in sctp_sendmsg_check_sflags()
1790 static int sctp_sendmsg_to_asoc(struct sctp_association *asoc, in sctp_sendmsg_to_asoc() argument
1795 struct sock *sk = asoc->base.sk; in sctp_sendmsg_to_asoc()
1804 if (sinfo->sinfo_stream >= asoc->stream.outcnt) { in sctp_sendmsg_to_asoc()
1809 if (unlikely(!SCTP_SO(&asoc->stream, sinfo->sinfo_stream)->ext)) { in sctp_sendmsg_to_asoc()
1810 err = sctp_stream_init_ext(&asoc->stream, sinfo->sinfo_stream); in sctp_sendmsg_to_asoc()
1815 if (sp->disable_fragments && msg_len > asoc->frag_point) { in sctp_sendmsg_to_asoc()
1820 if (asoc->pmtu_pending) { in sctp_sendmsg_to_asoc()
1822 sctp_assoc_sync_pmtu(asoc); in sctp_sendmsg_to_asoc()
1823 asoc->pmtu_pending = 0; in sctp_sendmsg_to_asoc()
1826 if (sctp_wspace(asoc) < (int)msg_len) in sctp_sendmsg_to_asoc()
1827 sctp_prsctp_prune(asoc, sinfo, msg_len - sctp_wspace(asoc)); in sctp_sendmsg_to_asoc()
1829 if (sctp_wspace(asoc) <= 0 || !sk_wmem_schedule(sk, msg_len)) { in sctp_sendmsg_to_asoc()
1831 err = sctp_wait_for_sndbuf(asoc, &timeo, msg_len); in sctp_sendmsg_to_asoc()
1834 if (unlikely(sinfo->sinfo_stream >= asoc->stream.outcnt)) { in sctp_sendmsg_to_asoc()
1840 if (sctp_state(asoc, CLOSED)) { in sctp_sendmsg_to_asoc()
1841 err = sctp_primitive_ASSOCIATE(net, asoc, NULL); in sctp_sendmsg_to_asoc()
1845 if (asoc->ep->intl_enable) { in sctp_sendmsg_to_asoc()
1847 err = sctp_wait_for_connect(asoc, &timeo); in sctp_sendmsg_to_asoc()
1859 datamsg = sctp_datamsg_from_user(asoc, sinfo, &msg->msg_iter); in sctp_sendmsg_to_asoc()
1865 asoc->force_delay = !!(msg->msg_flags & MSG_MORE); in sctp_sendmsg_to_asoc()
1873 err = sctp_primitive_SEND(net, asoc, datamsg); in sctp_sendmsg_to_asoc()
1885 sctp_wait_for_connect(asoc, &timeo); in sctp_sendmsg_to_asoc()
1917 static void sctp_sendmsg_update_sinfo(struct sctp_association *asoc, in sctp_sendmsg_update_sinfo() argument
1922 sinfo->sinfo_stream = asoc->default_stream; in sctp_sendmsg_update_sinfo()
1923 sinfo->sinfo_ppid = asoc->default_ppid; in sctp_sendmsg_update_sinfo()
1924 sinfo->sinfo_context = asoc->default_context; in sctp_sendmsg_update_sinfo()
1925 sinfo->sinfo_assoc_id = sctp_assoc2id(asoc); in sctp_sendmsg_update_sinfo()
1928 sinfo->sinfo_flags = asoc->default_flags; in sctp_sendmsg_update_sinfo()
1932 sinfo->sinfo_timetolive = asoc->default_timetolive; in sctp_sendmsg_update_sinfo()
1948 struct sctp_association *asoc, *tmp; in sctp_sendmsg() local
1974 list_for_each_entry_safe(asoc, tmp, &ep->asocs, asocs) { in sctp_sendmsg()
1975 err = sctp_sendmsg_check_sflags(asoc, sflags, msg, in sctp_sendmsg()
1982 sctp_sendmsg_update_sinfo(asoc, sinfo, &cmsgs); in sctp_sendmsg()
1984 err = sctp_sendmsg_to_asoc(asoc, msg, msg_len, in sctp_sendmsg()
1995 /* Get and check or create asoc */ in sctp_sendmsg()
1997 asoc = sctp_endpoint_lookup_assoc(ep, daddr, &transport); in sctp_sendmsg()
1998 if (asoc) { in sctp_sendmsg()
1999 err = sctp_sendmsg_check_sflags(asoc, sflags, msg, in sctp_sendmsg()
2009 asoc = transport->asoc; in sctp_sendmsg()
2016 asoc = sctp_id2assoc(sk, sinfo->sinfo_assoc_id); in sctp_sendmsg()
2017 if (!asoc) { in sctp_sendmsg()
2022 err = sctp_sendmsg_check_sflags(asoc, sflags, msg, msg_len); in sctp_sendmsg()
2027 /* Update snd_info with the asoc */ in sctp_sendmsg()
2028 sctp_sendmsg_update_sinfo(asoc, sinfo, &cmsgs); in sctp_sendmsg()
2030 /* Send msg to the asoc */ in sctp_sendmsg()
2031 err = sctp_sendmsg_to_asoc(asoc, msg, msg_len, transport, sinfo); in sctp_sendmsg()
2033 sctp_association_free(asoc); in sctp_sendmsg()
2178 sctp_assoc_rwnd_increase(event->asoc, copied); in sctp_recvmsg()
2224 struct sctp_association *asoc; in sctp_setsockopt_events() local
2234 list_for_each_entry(asoc, &sp->ep->asocs, asocs) in sctp_setsockopt_events()
2235 asoc->subscribe = sctp_sk(sk)->subscribe; in sctp_setsockopt_events()
2244 asoc = sctp_id2assoc(sk, 0); in sctp_setsockopt_events()
2245 if (asoc && sctp_outq_is_empty(&asoc->outqueue)) { in sctp_setsockopt_events()
2246 event = sctp_ulpevent_make_sender_dry_event(asoc, in sctp_setsockopt_events()
2251 asoc->stream.si->enqueue_event(&asoc->ulpq, event); in sctp_setsockopt_events()
2428 struct sctp_association *asoc, in sctp_apply_peer_addr_params() argument
2437 error = sctp_primitive_REQUESTHEARTBEAT(trans->asoc->base.net, in sctp_apply_peer_addr_params()
2438 trans->asoc, trans); in sctp_apply_peer_addr_params()
2462 } else if (asoc) { in sctp_apply_peer_addr_params()
2463 asoc->hbinterval = in sctp_apply_peer_addr_params()
2475 } else if (asoc) { in sctp_apply_peer_addr_params()
2476 asoc->param_flags = in sctp_apply_peer_addr_params()
2477 (asoc->param_flags & ~SPP_HB) | hb_change; in sctp_apply_peer_addr_params()
2492 sctp_assoc_sync_pmtu(asoc); in sctp_apply_peer_addr_params()
2493 } else if (asoc) { in sctp_apply_peer_addr_params()
2494 sctp_assoc_set_pmtu(asoc, params->spp_pathmtu); in sctp_apply_peer_addr_params()
2508 sctp_assoc_sync_pmtu(asoc); in sctp_apply_peer_addr_params()
2511 } else if (asoc) { in sctp_apply_peer_addr_params()
2512 asoc->param_flags = in sctp_apply_peer_addr_params()
2513 (asoc->param_flags & ~SPP_PMTUD) | pmtud_change; in sctp_apply_peer_addr_params()
2528 } else if (asoc) { in sctp_apply_peer_addr_params()
2529 asoc->sackdelay = in sctp_apply_peer_addr_params()
2541 } else if (asoc) { in sctp_apply_peer_addr_params()
2542 asoc->param_flags = in sctp_apply_peer_addr_params()
2543 (asoc->param_flags & ~SPP_SACKDELAY) | in sctp_apply_peer_addr_params()
2558 } else if (asoc) { in sctp_apply_peer_addr_params()
2559 asoc->pathmaxrxt = params->spp_pathmaxrxt; in sctp_apply_peer_addr_params()
2572 } else if (asoc) { in sctp_apply_peer_addr_params()
2575 list_for_each_entry(t, &asoc->peer.transport_addr_list, in sctp_apply_peer_addr_params()
2583 asoc->flowlabel = params->spp_ipv6_flowlabel & in sctp_apply_peer_addr_params()
2585 asoc->flowlabel |= SCTP_FLOWLABEL_SET_MASK; in sctp_apply_peer_addr_params()
2597 } else if (asoc) { in sctp_apply_peer_addr_params()
2600 list_for_each_entry(t, &asoc->peer.transport_addr_list, in sctp_apply_peer_addr_params()
2606 asoc->dscp = params->spp_dscp & SCTP_DSCP_VAL_MASK; in sctp_apply_peer_addr_params()
2607 asoc->dscp |= SCTP_DSCP_SET_MASK; in sctp_apply_peer_addr_params()
2622 struct sctp_association *asoc = NULL; in sctp_setsockopt_peer_addr_params() local
2662 asoc = sctp_id2assoc(sk, params->spp_assoc_id); in sctp_setsockopt_peer_addr_params()
2663 if (!asoc && params->spp_assoc_id != SCTP_FUTURE_ASSOC && in sctp_setsockopt_peer_addr_params()
2670 if (params->spp_flags & SPP_HB_DEMAND && !trans && !asoc) in sctp_setsockopt_peer_addr_params()
2674 error = sctp_apply_peer_addr_params(params, trans, asoc, sp, in sctp_setsockopt_peer_addr_params()
2684 if (!trans && asoc) { in sctp_setsockopt_peer_addr_params()
2685 list_for_each_entry(trans, &asoc->peer.transport_addr_list, in sctp_setsockopt_peer_addr_params()
2687 sctp_apply_peer_addr_params(params, trans, asoc, sp, in sctp_setsockopt_peer_addr_params()
2707 struct sctp_association *asoc) in sctp_apply_asoc_delayed_ack() argument
2712 asoc->sackdelay = msecs_to_jiffies(params->sack_delay); in sctp_apply_asoc_delayed_ack()
2713 asoc->param_flags = in sctp_apply_asoc_delayed_ack()
2714 sctp_spp_sackdelay_enable(asoc->param_flags); in sctp_apply_asoc_delayed_ack()
2717 asoc->param_flags = in sctp_apply_asoc_delayed_ack()
2718 sctp_spp_sackdelay_disable(asoc->param_flags); in sctp_apply_asoc_delayed_ack()
2720 asoc->sackfreq = params->sack_freq; in sctp_apply_asoc_delayed_ack()
2721 asoc->param_flags = in sctp_apply_asoc_delayed_ack()
2722 sctp_spp_sackdelay_enable(asoc->param_flags); in sctp_apply_asoc_delayed_ack()
2725 list_for_each_entry(trans, &asoc->peer.transport_addr_list, in sctp_apply_asoc_delayed_ack()
2782 struct sctp_association *asoc; in __sctp_setsockopt_delayed_ack() local
2792 asoc = sctp_id2assoc(sk, params->sack_assoc_id); in __sctp_setsockopt_delayed_ack()
2793 if (!asoc && params->sack_assoc_id > SCTP_ALL_ASSOC && in __sctp_setsockopt_delayed_ack()
2797 if (asoc) { in __sctp_setsockopt_delayed_ack()
2798 sctp_apply_asoc_delayed_ack(params, asoc); in __sctp_setsockopt_delayed_ack()
2825 list_for_each_entry(asoc, &sp->ep->asocs, asocs) in __sctp_setsockopt_delayed_ack()
2826 sctp_apply_asoc_delayed_ack(params, asoc); in __sctp_setsockopt_delayed_ack()
2908 struct sctp_association *asoc; in sctp_setsockopt_default_send_param() local
2917 asoc = sctp_id2assoc(sk, info->sinfo_assoc_id); in sctp_setsockopt_default_send_param()
2918 if (!asoc && info->sinfo_assoc_id > SCTP_ALL_ASSOC && in sctp_setsockopt_default_send_param()
2922 if (asoc) { in sctp_setsockopt_default_send_param()
2923 asoc->default_stream = info->sinfo_stream; in sctp_setsockopt_default_send_param()
2924 asoc->default_flags = info->sinfo_flags; in sctp_setsockopt_default_send_param()
2925 asoc->default_ppid = info->sinfo_ppid; in sctp_setsockopt_default_send_param()
2926 asoc->default_context = info->sinfo_context; in sctp_setsockopt_default_send_param()
2927 asoc->default_timetolive = info->sinfo_timetolive; in sctp_setsockopt_default_send_param()
2946 list_for_each_entry(asoc, &sp->ep->asocs, asocs) { in sctp_setsockopt_default_send_param()
2947 asoc->default_stream = info->sinfo_stream; in sctp_setsockopt_default_send_param()
2948 asoc->default_flags = info->sinfo_flags; in sctp_setsockopt_default_send_param()
2949 asoc->default_ppid = info->sinfo_ppid; in sctp_setsockopt_default_send_param()
2950 asoc->default_context = info->sinfo_context; in sctp_setsockopt_default_send_param()
2951 asoc->default_timetolive = info->sinfo_timetolive; in sctp_setsockopt_default_send_param()
2966 struct sctp_association *asoc; in sctp_setsockopt_default_sndinfo() local
2975 asoc = sctp_id2assoc(sk, info->snd_assoc_id); in sctp_setsockopt_default_sndinfo()
2976 if (!asoc && info->snd_assoc_id > SCTP_ALL_ASSOC && in sctp_setsockopt_default_sndinfo()
2980 if (asoc) { in sctp_setsockopt_default_sndinfo()
2981 asoc->default_stream = info->snd_sid; in sctp_setsockopt_default_sndinfo()
2982 asoc->default_flags = info->snd_flags; in sctp_setsockopt_default_sndinfo()
2983 asoc->default_ppid = info->snd_ppid; in sctp_setsockopt_default_sndinfo()
2984 asoc->default_context = info->snd_context; in sctp_setsockopt_default_sndinfo()
3002 list_for_each_entry(asoc, &sp->ep->asocs, asocs) { in sctp_setsockopt_default_sndinfo()
3003 asoc->default_stream = info->snd_sid; in sctp_setsockopt_default_sndinfo()
3004 asoc->default_flags = info->snd_flags; in sctp_setsockopt_default_sndinfo()
3005 asoc->default_ppid = info->snd_ppid; in sctp_setsockopt_default_sndinfo()
3006 asoc->default_context = info->snd_context; in sctp_setsockopt_default_sndinfo()
3044 sctp_assoc_set_primary(trans->asoc, trans); in sctp_setsockopt_primary_addr()
3082 struct sctp_association *asoc; in sctp_setsockopt_rtoinfo() local
3089 asoc = sctp_id2assoc(sk, rtoinfo->srto_assoc_id); in sctp_setsockopt_rtoinfo()
3092 if (!asoc && rtoinfo->srto_assoc_id != SCTP_FUTURE_ASSOC && in sctp_setsockopt_rtoinfo()
3100 rto_max = asoc ? msecs_to_jiffies(rto_max) : rto_max; in sctp_setsockopt_rtoinfo()
3102 rto_max = asoc ? asoc->rto_max : sp->rtoinfo.srto_max; in sctp_setsockopt_rtoinfo()
3105 rto_min = asoc ? msecs_to_jiffies(rto_min) : rto_min; in sctp_setsockopt_rtoinfo()
3107 rto_min = asoc ? asoc->rto_min : sp->rtoinfo.srto_min; in sctp_setsockopt_rtoinfo()
3112 if (asoc) { in sctp_setsockopt_rtoinfo()
3114 asoc->rto_initial = in sctp_setsockopt_rtoinfo()
3116 asoc->rto_max = rto_max; in sctp_setsockopt_rtoinfo()
3117 asoc->rto_min = rto_min; in sctp_setsockopt_rtoinfo()
3147 struct sctp_association *asoc; in sctp_setsockopt_associnfo() local
3152 asoc = sctp_id2assoc(sk, assocparams->sasoc_assoc_id); in sctp_setsockopt_associnfo()
3154 if (!asoc && assocparams->sasoc_assoc_id != SCTP_FUTURE_ASSOC && in sctp_setsockopt_associnfo()
3159 if (asoc) { in sctp_setsockopt_associnfo()
3165 list_for_each_entry(peer_addr, &asoc->peer.transport_addr_list, in sctp_setsockopt_associnfo()
3180 asoc->max_retrans = assocparams->sasoc_asocmaxrxt; in sctp_setsockopt_associnfo()
3184 asoc->cookie_life = in sctp_setsockopt_associnfo()
3257 struct sctp_association *asoc; in sctp_setsockopt_maxseg() local
3276 asoc = sctp_id2assoc(sk, assoc_id); in sctp_setsockopt_maxseg()
3277 if (!asoc && assoc_id != SCTP_FUTURE_ASSOC && in sctp_setsockopt_maxseg()
3283 __u16 datasize = asoc ? sctp_datachk_len(&asoc->stream) : in sctp_setsockopt_maxseg()
3293 if (asoc) { in sctp_setsockopt_maxseg()
3294 asoc->user_frag = val; in sctp_setsockopt_maxseg()
3295 sctp_assoc_update_frag_point(asoc); in sctp_setsockopt_maxseg()
3317 struct sctp_association *asoc = NULL; in sctp_setsockopt_peer_primary_addr() local
3330 asoc = sctp_id2assoc(sk, prim->sspp_assoc_id); in sctp_setsockopt_peer_primary_addr()
3331 if (!asoc) in sctp_setsockopt_peer_primary_addr()
3334 if (!asoc->peer.asconf_capable) in sctp_setsockopt_peer_primary_addr()
3337 if (asoc->peer.addip_disabled_mask & SCTP_PARAM_SET_PRIMARY) in sctp_setsockopt_peer_primary_addr()
3340 if (!sctp_state(asoc, ESTABLISHED)) in sctp_setsockopt_peer_primary_addr()
3350 if (!sctp_assoc_lookup_laddr(asoc, (union sctp_addr *)&prim->sspp_addr)) in sctp_setsockopt_peer_primary_addr()
3361 chunk = sctp_make_asconf_set_prim(asoc, in sctp_setsockopt_peer_primary_addr()
3366 err = sctp_send_asconf(asoc, chunk); in sctp_setsockopt_peer_primary_addr()
3404 struct sctp_association *asoc; in sctp_setsockopt_context() local
3409 asoc = sctp_id2assoc(sk, params->assoc_id); in sctp_setsockopt_context()
3410 if (!asoc && params->assoc_id > SCTP_ALL_ASSOC && in sctp_setsockopt_context()
3414 if (asoc) { in sctp_setsockopt_context()
3415 asoc->default_rcv_context = params->assoc_value; in sctp_setsockopt_context()
3429 list_for_each_entry(asoc, &sp->ep->asocs, asocs) in sctp_setsockopt_context()
3430 asoc->default_rcv_context = params->assoc_value; in sctp_setsockopt_context()
3523 struct sctp_association *asoc; in sctp_setsockopt_maxburst() local
3541 asoc = sctp_id2assoc(sk, assoc_id); in sctp_setsockopt_maxburst()
3542 if (!asoc && assoc_id > SCTP_ALL_ASSOC && sctp_style(sk, UDP)) in sctp_setsockopt_maxburst()
3545 if (asoc) { in sctp_setsockopt_maxburst()
3546 asoc->max_burst = assoc_value; in sctp_setsockopt_maxburst()
3558 list_for_each_entry(asoc, &sp->ep->asocs, asocs) in sctp_setsockopt_maxburst()
3559 asoc->max_burst = assoc_value; in sctp_setsockopt_maxburst()
3635 struct sctp_association *asoc; in sctp_setsockopt_auth_key() local
3648 asoc = sctp_id2assoc(sk, authkey->sca_assoc_id); in sctp_setsockopt_auth_key()
3649 if (!asoc && authkey->sca_assoc_id > SCTP_ALL_ASSOC && in sctp_setsockopt_auth_key()
3653 if (asoc) { in sctp_setsockopt_auth_key()
3654 ret = sctp_auth_set_key(ep, asoc, authkey); in sctp_setsockopt_auth_key()
3663 ret = sctp_auth_set_key(ep, asoc, authkey); in sctp_setsockopt_auth_key()
3672 list_for_each_entry(asoc, &ep->asocs, asocs) { in sctp_setsockopt_auth_key()
3673 int res = sctp_auth_set_key(ep, asoc, authkey); in sctp_setsockopt_auth_key()
3696 struct sctp_association *asoc; in sctp_setsockopt_active_key() local
3702 asoc = sctp_id2assoc(sk, val->scact_assoc_id); in sctp_setsockopt_active_key()
3703 if (!asoc && val->scact_assoc_id > SCTP_ALL_ASSOC && in sctp_setsockopt_active_key()
3707 if (asoc) in sctp_setsockopt_active_key()
3708 return sctp_auth_set_active_key(ep, asoc, val->scact_keynumber); in sctp_setsockopt_active_key()
3715 ret = sctp_auth_set_active_key(ep, asoc, val->scact_keynumber); in sctp_setsockopt_active_key()
3722 list_for_each_entry(asoc, &ep->asocs, asocs) { in sctp_setsockopt_active_key()
3723 int res = sctp_auth_set_active_key(ep, asoc, in sctp_setsockopt_active_key()
3744 struct sctp_association *asoc; in sctp_setsockopt_del_key() local
3750 asoc = sctp_id2assoc(sk, val->scact_assoc_id); in sctp_setsockopt_del_key()
3751 if (!asoc && val->scact_assoc_id > SCTP_ALL_ASSOC && in sctp_setsockopt_del_key()
3755 if (asoc) in sctp_setsockopt_del_key()
3756 return sctp_auth_del_key_id(ep, asoc, val->scact_keynumber); in sctp_setsockopt_del_key()
3763 ret = sctp_auth_del_key_id(ep, asoc, val->scact_keynumber); in sctp_setsockopt_del_key()
3770 list_for_each_entry(asoc, &ep->asocs, asocs) { in sctp_setsockopt_del_key()
3771 int res = sctp_auth_del_key_id(ep, asoc, in sctp_setsockopt_del_key()
3792 struct sctp_association *asoc; in sctp_setsockopt_deactivate_key() local
3798 asoc = sctp_id2assoc(sk, val->scact_assoc_id); in sctp_setsockopt_deactivate_key()
3799 if (!asoc && val->scact_assoc_id > SCTP_ALL_ASSOC && in sctp_setsockopt_deactivate_key()
3803 if (asoc) in sctp_setsockopt_deactivate_key()
3804 return sctp_auth_deact_key_id(ep, asoc, val->scact_keynumber); in sctp_setsockopt_deactivate_key()
3811 ret = sctp_auth_deact_key_id(ep, asoc, val->scact_keynumber); in sctp_setsockopt_deactivate_key()
3818 list_for_each_entry(asoc, &ep->asocs, asocs) { in sctp_setsockopt_deactivate_key()
3819 int res = sctp_auth_deact_key_id(ep, asoc, in sctp_setsockopt_deactivate_key()
3881 struct sctp_association *asoc; in sctp_setsockopt_paddr_thresholds() local
3906 asoc = sctp_id2assoc(sk, val->spt_assoc_id); in sctp_setsockopt_paddr_thresholds()
3907 if (!asoc && val->spt_assoc_id != SCTP_FUTURE_ASSOC && in sctp_setsockopt_paddr_thresholds()
3911 if (asoc) { in sctp_setsockopt_paddr_thresholds()
3912 list_for_each_entry(trans, &asoc->peer.transport_addr_list, in sctp_setsockopt_paddr_thresholds()
3922 asoc->pathmaxrxt = val->spt_pathmaxrxt; in sctp_setsockopt_paddr_thresholds()
3924 asoc->ps_retrans = val->spt_pathcpthld; in sctp_setsockopt_paddr_thresholds()
3925 asoc->pf_retrans = val->spt_pathpfthld; in sctp_setsockopt_paddr_thresholds()
3965 struct sctp_association *asoc; in sctp_setsockopt_pr_supported() local
3970 asoc = sctp_id2assoc(sk, params->assoc_id); in sctp_setsockopt_pr_supported()
3971 if (!asoc && params->assoc_id != SCTP_FUTURE_ASSOC && in sctp_setsockopt_pr_supported()
3985 struct sctp_association *asoc; in sctp_setsockopt_default_prinfo() local
3997 asoc = sctp_id2assoc(sk, info->pr_assoc_id); in sctp_setsockopt_default_prinfo()
3998 if (!asoc && info->pr_assoc_id > SCTP_ALL_ASSOC && in sctp_setsockopt_default_prinfo()
4004 if (asoc) { in sctp_setsockopt_default_prinfo()
4005 SCTP_PR_SET_POLICY(asoc->default_flags, info->pr_policy); in sctp_setsockopt_default_prinfo()
4006 asoc->default_timetolive = info->pr_value; in sctp_setsockopt_default_prinfo()
4021 list_for_each_entry(asoc, &sp->ep->asocs, asocs) { in sctp_setsockopt_default_prinfo()
4022 SCTP_PR_SET_POLICY(asoc->default_flags, in sctp_setsockopt_default_prinfo()
4024 asoc->default_timetolive = info->pr_value; in sctp_setsockopt_default_prinfo()
4036 struct sctp_association *asoc; in sctp_setsockopt_reconfig_supported() local
4042 asoc = sctp_id2assoc(sk, params->assoc_id); in sctp_setsockopt_reconfig_supported()
4043 if (!asoc && params->assoc_id != SCTP_FUTURE_ASSOC && in sctp_setsockopt_reconfig_supported()
4060 struct sctp_association *asoc; in sctp_setsockopt_enable_strreset() local
4069 asoc = sctp_id2assoc(sk, params->assoc_id); in sctp_setsockopt_enable_strreset()
4070 if (!asoc && params->assoc_id > SCTP_ALL_ASSOC && in sctp_setsockopt_enable_strreset()
4076 if (asoc) { in sctp_setsockopt_enable_strreset()
4077 asoc->strreset_enable = params->assoc_value; in sctp_setsockopt_enable_strreset()
4090 list_for_each_entry(asoc, &ep->asocs, asocs) in sctp_setsockopt_enable_strreset()
4091 asoc->strreset_enable = params->assoc_value; in sctp_setsockopt_enable_strreset()
4101 struct sctp_association *asoc; in sctp_setsockopt_reset_streams() local
4113 asoc = sctp_id2assoc(sk, params->srs_assoc_id); in sctp_setsockopt_reset_streams()
4114 if (!asoc) in sctp_setsockopt_reset_streams()
4117 return sctp_send_reset_streams(asoc, params); in sctp_setsockopt_reset_streams()
4123 struct sctp_association *asoc; in sctp_setsockopt_reset_assoc() local
4128 asoc = sctp_id2assoc(sk, *associd); in sctp_setsockopt_reset_assoc()
4129 if (!asoc) in sctp_setsockopt_reset_assoc()
4132 return sctp_send_reset_assoc(asoc); in sctp_setsockopt_reset_assoc()
4139 struct sctp_association *asoc; in sctp_setsockopt_add_streams() local
4144 asoc = sctp_id2assoc(sk, params->sas_assoc_id); in sctp_setsockopt_add_streams()
4145 if (!asoc) in sctp_setsockopt_add_streams()
4148 return sctp_send_add_streams(asoc, params); in sctp_setsockopt_add_streams()
4156 struct sctp_association *asoc; in sctp_setsockopt_scheduler() local
4165 asoc = sctp_id2assoc(sk, params->assoc_id); in sctp_setsockopt_scheduler()
4166 if (!asoc && params->assoc_id > SCTP_ALL_ASSOC && in sctp_setsockopt_scheduler()
4170 if (asoc) in sctp_setsockopt_scheduler()
4171 return sctp_sched_set_sched(asoc, params->assoc_value); in sctp_setsockopt_scheduler()
4182 list_for_each_entry(asoc, &sp->ep->asocs, asocs) { in sctp_setsockopt_scheduler()
4183 int ret = sctp_sched_set_sched(asoc, in sctp_setsockopt_scheduler()
4198 struct sctp_association *asoc; in sctp_setsockopt_scheduler_value() local
4204 asoc = sctp_id2assoc(sk, params->assoc_id); in sctp_setsockopt_scheduler_value()
4205 if (!asoc && params->assoc_id != SCTP_CURRENT_ASSOC && in sctp_setsockopt_scheduler_value()
4209 if (asoc) { in sctp_setsockopt_scheduler_value()
4210 retval = sctp_sched_set_value(asoc, params->stream_id, in sctp_setsockopt_scheduler_value()
4217 list_for_each_entry(asoc, &sctp_sk(sk)->ep->asocs, asocs) { in sctp_setsockopt_scheduler_value()
4218 int ret = sctp_sched_set_value(asoc, params->stream_id, in sctp_setsockopt_scheduler_value()
4234 struct sctp_association *asoc; in sctp_setsockopt_interleaving_supported() local
4239 asoc = sctp_id2assoc(sk, p->assoc_id); in sctp_setsockopt_interleaving_supported()
4240 if (!asoc && p->assoc_id != SCTP_FUTURE_ASSOC && sctp_style(sk, UDP)) in sctp_setsockopt_interleaving_supported()
4269 struct sctp_association *asoc) in sctp_assoc_ulpevent_type_set() argument
4273 sctp_ulpevent_type_set(&asoc->subscribe, param->se_type, param->se_on); in sctp_assoc_ulpevent_type_set()
4276 if (sctp_outq_is_empty(&asoc->outqueue)) { in sctp_assoc_ulpevent_type_set()
4277 event = sctp_ulpevent_make_sender_dry_event(asoc, in sctp_assoc_ulpevent_type_set()
4282 asoc->stream.si->enqueue_event(&asoc->ulpq, event); in sctp_assoc_ulpevent_type_set()
4293 struct sctp_association *asoc; in sctp_setsockopt_event() local
4303 asoc = sctp_id2assoc(sk, param->se_assoc_id); in sctp_setsockopt_event()
4304 if (!asoc && param->se_assoc_id > SCTP_ALL_ASSOC && in sctp_setsockopt_event()
4308 if (asoc) in sctp_setsockopt_event()
4309 return sctp_assoc_ulpevent_type_set(param, asoc); in sctp_setsockopt_event()
4321 list_for_each_entry(asoc, &sp->ep->asocs, asocs) { in sctp_setsockopt_event()
4322 int ret = sctp_assoc_ulpevent_type_set(param, asoc); in sctp_setsockopt_event()
4336 struct sctp_association *asoc; in sctp_setsockopt_asconf_supported() local
4343 asoc = sctp_id2assoc(sk, params->assoc_id); in sctp_setsockopt_asconf_supported()
4344 if (!asoc && params->assoc_id != SCTP_FUTURE_ASSOC && in sctp_setsockopt_asconf_supported()
4366 struct sctp_association *asoc; in sctp_setsockopt_auth_supported() local
4373 asoc = sctp_id2assoc(sk, params->assoc_id); in sctp_setsockopt_auth_supported()
4374 if (!asoc && params->assoc_id != SCTP_FUTURE_ASSOC && in sctp_setsockopt_auth_supported()
4400 struct sctp_association *asoc; in sctp_setsockopt_ecn_supported() local
4406 asoc = sctp_id2assoc(sk, params->assoc_id); in sctp_setsockopt_ecn_supported()
4407 if (!asoc && params->assoc_id != SCTP_FUTURE_ASSOC && in sctp_setsockopt_ecn_supported()
4422 struct sctp_association *asoc; in sctp_setsockopt_pf_expose() local
4431 asoc = sctp_id2assoc(sk, params->assoc_id); in sctp_setsockopt_pf_expose()
4432 if (!asoc && params->assoc_id != SCTP_FUTURE_ASSOC && in sctp_setsockopt_pf_expose()
4436 if (asoc) in sctp_setsockopt_pf_expose()
4437 asoc->pf_expose = params->assoc_value; in sctp_setsockopt_pf_expose()
4450 struct sctp_association *asoc; in sctp_setsockopt_encap_port() local
4475 asoc = sctp_id2assoc(sk, encap->sue_assoc_id); in sctp_setsockopt_encap_port()
4476 if (!asoc && encap->sue_assoc_id != SCTP_FUTURE_ASSOC && in sctp_setsockopt_encap_port()
4483 if (asoc) { in sctp_setsockopt_encap_port()
4484 list_for_each_entry(t, &asoc->peer.transport_addr_list, in sctp_setsockopt_encap_port()
4488 asoc->encap_port = encap_port; in sctp_setsockopt_encap_port()
4500 struct sctp_association *asoc; in sctp_setsockopt_probe_interval() local
4529 asoc = sctp_id2assoc(sk, params->spi_assoc_id); in sctp_setsockopt_probe_interval()
4530 if (!asoc && params->spi_assoc_id != SCTP_FUTURE_ASSOC && in sctp_setsockopt_probe_interval()
4537 if (asoc) { in sctp_setsockopt_probe_interval()
4538 list_for_each_entry(t, &asoc->peer.transport_addr_list, transports) { in sctp_setsockopt_probe_interval()
4543 asoc->probe_interval = msecs_to_jiffies(probe_interval); in sctp_setsockopt_probe_interval()
4859 struct sctp_association *asoc; in sctp_accept() local
4888 asoc = list_entry(ep->asocs.next, struct sctp_association, asocs); in sctp_accept()
4890 newsk = sp->pf->create_accept_sk(sk, asoc, arg->kern); in sctp_accept()
4897 * asoc to the newsk. in sctp_accept()
4899 error = sctp_sock_migrate(sk, newsk, asoc, SCTP_SOCKET_TCP); in sctp_accept()
5160 struct sctp_association *asoc; in sctp_shutdown() local
5163 asoc = list_entry(ep->asocs.next, in sctp_shutdown()
5165 sctp_primitive_SHUTDOWN(net, asoc, NULL); in sctp_shutdown()
5169 int sctp_get_sctp_info(struct sock *sk, struct sctp_association *asoc, in sctp_get_sctp_info() argument
5177 if (!asoc) { in sctp_get_sctp_info()
5192 info->sctpi_tag = asoc->c.my_vtag; in sctp_get_sctp_info()
5193 info->sctpi_state = asoc->state; in sctp_get_sctp_info()
5194 info->sctpi_rwnd = asoc->a_rwnd; in sctp_get_sctp_info()
5195 info->sctpi_unackdata = asoc->unack_data; in sctp_get_sctp_info()
5196 info->sctpi_penddata = sctp_tsnmap_pending(&asoc->peer.tsn_map); in sctp_get_sctp_info()
5197 info->sctpi_instrms = asoc->stream.incnt; in sctp_get_sctp_info()
5198 info->sctpi_outstrms = asoc->stream.outcnt; in sctp_get_sctp_info()
5199 list_for_each(pos, &asoc->base.inqueue.in_chunk_list) in sctp_get_sctp_info()
5201 list_for_each(pos, &asoc->outqueue.out_chunk_list) in sctp_get_sctp_info()
5203 info->sctpi_overall_error = asoc->overall_error_count; in sctp_get_sctp_info()
5204 info->sctpi_max_burst = asoc->max_burst; in sctp_get_sctp_info()
5205 info->sctpi_maxseg = asoc->frag_point; in sctp_get_sctp_info()
5206 info->sctpi_peer_rwnd = asoc->peer.rwnd; in sctp_get_sctp_info()
5207 info->sctpi_peer_tag = asoc->c.peer_vtag; in sctp_get_sctp_info()
5209 mask = asoc->peer.intl_capable << 1; in sctp_get_sctp_info()
5210 mask = (mask | asoc->peer.ecn_capable) << 1; in sctp_get_sctp_info()
5211 mask = (mask | asoc->peer.ipv4_address) << 1; in sctp_get_sctp_info()
5212 mask = (mask | asoc->peer.ipv6_address) << 1; in sctp_get_sctp_info()
5213 mask = (mask | asoc->peer.reconf_capable) << 1; in sctp_get_sctp_info()
5214 mask = (mask | asoc->peer.asconf_capable) << 1; in sctp_get_sctp_info()
5215 mask = (mask | asoc->peer.prsctp_capable) << 1; in sctp_get_sctp_info()
5216 mask = (mask | asoc->peer.auth_capable); in sctp_get_sctp_info()
5218 mask = asoc->peer.sack_needed << 1; in sctp_get_sctp_info()
5219 mask = (mask | asoc->peer.sack_generation) << 1; in sctp_get_sctp_info()
5220 mask = (mask | asoc->peer.zero_window_announced); in sctp_get_sctp_info()
5223 info->sctpi_isacks = asoc->stats.isacks; in sctp_get_sctp_info()
5224 info->sctpi_osacks = asoc->stats.osacks; in sctp_get_sctp_info()
5225 info->sctpi_opackets = asoc->stats.opackets; in sctp_get_sctp_info()
5226 info->sctpi_ipackets = asoc->stats.ipackets; in sctp_get_sctp_info()
5227 info->sctpi_rtxchunks = asoc->stats.rtxchunks; in sctp_get_sctp_info()
5228 info->sctpi_outofseqtsns = asoc->stats.outofseqtsns; in sctp_get_sctp_info()
5229 info->sctpi_idupchunks = asoc->stats.idupchunks; in sctp_get_sctp_info()
5230 info->sctpi_gapcnt = asoc->stats.gapcnt; in sctp_get_sctp_info()
5231 info->sctpi_ouodchunks = asoc->stats.ouodchunks; in sctp_get_sctp_info()
5232 info->sctpi_iuodchunks = asoc->stats.iuodchunks; in sctp_get_sctp_info()
5233 info->sctpi_oodchunks = asoc->stats.oodchunks; in sctp_get_sctp_info()
5234 info->sctpi_iodchunks = asoc->stats.iodchunks; in sctp_get_sctp_info()
5235 info->sctpi_octrlchunks = asoc->stats.octrlchunks; in sctp_get_sctp_info()
5236 info->sctpi_ictrlchunks = asoc->stats.ictrlchunks; in sctp_get_sctp_info()
5238 prim = asoc->peer.primary_path; in sctp_get_sctp_info()
5286 if (net_eq(t->asoc->base.net, net) && in sctp_transport_get_next()
5287 t->asoc->peer.primary_path == t) in sctp_transport_get_next()
5350 ep = transport->asoc->ep; in sctp_transport_lookup_process()
5351 if (!sctp_endpoint_hold(ep)) { /* asoc can be peeled off */ in sctp_transport_lookup_process()
5379 ep = tsp->asoc->ep; in sctp_transport_traverse_process()
5380 if (sctp_endpoint_hold(ep)) { /* asoc can be peeled off */ in sctp_transport_traverse_process()
5418 struct sctp_association *asoc = NULL; in sctp_getsockopt_sctp_status() local
5435 asoc = sctp_id2assoc(sk, associd); in sctp_getsockopt_sctp_status()
5436 if (!asoc) { in sctp_getsockopt_sctp_status()
5441 transport = asoc->peer.primary_path; in sctp_getsockopt_sctp_status()
5443 status.sstat_assoc_id = sctp_assoc2id(asoc); in sctp_getsockopt_sctp_status()
5444 status.sstat_state = sctp_assoc_to_state(asoc); in sctp_getsockopt_sctp_status()
5445 status.sstat_rwnd = asoc->peer.rwnd; in sctp_getsockopt_sctp_status()
5446 status.sstat_unackdata = asoc->unack_data; in sctp_getsockopt_sctp_status()
5448 status.sstat_penddata = sctp_tsnmap_pending(&asoc->peer.tsn_map); in sctp_getsockopt_sctp_status()
5449 status.sstat_instrms = asoc->stream.incnt; in sctp_getsockopt_sctp_status()
5450 status.sstat_outstrms = asoc->stream.outcnt; in sctp_getsockopt_sctp_status()
5451 status.sstat_fragmentation_point = asoc->frag_point; in sctp_getsockopt_sctp_status()
5452 status.sstat_primary.spinfo_assoc_id = sctp_assoc2id(transport->asoc); in sctp_getsockopt_sctp_status()
5520 transport->asoc->pf_expose == SCTP_PF_EXPOSE_DISABLE) { in sctp_getsockopt_peer_addr_info()
5525 pinfo.spinfo_assoc_id = sctp_assoc2id(transport->asoc); in sctp_getsockopt_peer_addr_info()
5631 struct sctp_association *asoc = sctp_id2assoc(sk, id); in sctp_do_peeloff() local
5640 if (!asoc) in sctp_do_peeloff()
5654 sctp_copy_sock(sock->sk, sk, asoc); in sctp_do_peeloff()
5660 sp->pf->to_sk_daddr(&asoc->peer.primary_addr, sock->sk); in sctp_do_peeloff()
5664 * asoc to the newsk. in sctp_do_peeloff()
5666 err = sctp_sock_migrate(sk, sock->sk, asoc, in sctp_do_peeloff()
5920 struct sctp_association *asoc = NULL; in sctp_getsockopt_peer_addr_params() local
5951 asoc = sctp_id2assoc(sk, params.spp_assoc_id); in sctp_getsockopt_peer_addr_params()
5952 if (!asoc && params.spp_assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_peer_addr_params()
5976 } else if (asoc) { in sctp_getsockopt_peer_addr_params()
5978 params.spp_hbinterval = jiffies_to_msecs(asoc->hbinterval); in sctp_getsockopt_peer_addr_params()
5979 params.spp_pathmtu = asoc->pathmtu; in sctp_getsockopt_peer_addr_params()
5980 params.spp_pathmaxrxt = asoc->pathmaxrxt; in sctp_getsockopt_peer_addr_params()
5981 params.spp_sackdelay = jiffies_to_msecs(asoc->sackdelay); in sctp_getsockopt_peer_addr_params()
5984 params.spp_flags = asoc->param_flags; in sctp_getsockopt_peer_addr_params()
5985 if (asoc->flowlabel & SCTP_FLOWLABEL_SET_MASK) { in sctp_getsockopt_peer_addr_params()
5986 params.spp_ipv6_flowlabel = asoc->flowlabel & in sctp_getsockopt_peer_addr_params()
5990 if (asoc->dscp & SCTP_DSCP_SET_MASK) { in sctp_getsockopt_peer_addr_params()
5991 params.spp_dscp = asoc->dscp & SCTP_DSCP_VAL_MASK; in sctp_getsockopt_peer_addr_params()
6063 struct sctp_association *asoc = NULL; in sctp_getsockopt_delayed_ack() local
6086 asoc = sctp_id2assoc(sk, params.sack_assoc_id); in sctp_getsockopt_delayed_ack()
6087 if (!asoc && params.sack_assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_delayed_ack()
6091 if (asoc) { in sctp_getsockopt_delayed_ack()
6093 if (asoc->param_flags & SPP_SACKDELAY_ENABLE) { in sctp_getsockopt_delayed_ack()
6094 params.sack_delay = jiffies_to_msecs(asoc->sackdelay); in sctp_getsockopt_delayed_ack()
6095 params.sack_freq = asoc->sackfreq; in sctp_getsockopt_delayed_ack()
6148 struct sctp_association *asoc; in sctp_getsockopt_peer_addrs() local
6166 asoc = sctp_id2assoc(sk, getaddrs.assoc_id); in sctp_getsockopt_peer_addrs()
6167 if (!asoc) in sctp_getsockopt_peer_addrs()
6173 list_for_each_entry(from, &asoc->peer.transport_addr_list, in sctp_getsockopt_peer_addrs()
6245 struct sctp_association *asoc; in sctp_getsockopt_local_addrs() local
6274 asoc = sctp_id2assoc(sk, getaddrs.assoc_id); in sctp_getsockopt_local_addrs()
6275 if (!asoc) in sctp_getsockopt_local_addrs()
6277 bp = &asoc->base.bind_addr; in sctp_getsockopt_local_addrs()
6353 struct sctp_association *asoc; in sctp_getsockopt_primary_addr() local
6364 asoc = sctp_id2assoc(sk, prim.ssp_assoc_id); in sctp_getsockopt_primary_addr()
6365 if (!asoc) in sctp_getsockopt_primary_addr()
6368 if (!asoc->peer.primary_path) in sctp_getsockopt_primary_addr()
6371 memcpy(&prim.ssp_addr, &asoc->peer.primary_path->ipaddr, in sctp_getsockopt_primary_addr()
6372 asoc->peer.primary_path->af_specific->sockaddr_len); in sctp_getsockopt_primary_addr()
6435 struct sctp_association *asoc; in sctp_getsockopt_default_send_param() local
6446 asoc = sctp_id2assoc(sk, info.sinfo_assoc_id); in sctp_getsockopt_default_send_param()
6447 if (!asoc && info.sinfo_assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_default_send_param()
6451 if (asoc) { in sctp_getsockopt_default_send_param()
6452 info.sinfo_stream = asoc->default_stream; in sctp_getsockopt_default_send_param()
6453 info.sinfo_flags = asoc->default_flags; in sctp_getsockopt_default_send_param()
6454 info.sinfo_ppid = asoc->default_ppid; in sctp_getsockopt_default_send_param()
6455 info.sinfo_context = asoc->default_context; in sctp_getsockopt_default_send_param()
6456 info.sinfo_timetolive = asoc->default_timetolive; in sctp_getsockopt_default_send_param()
6481 struct sctp_association *asoc; in sctp_getsockopt_default_sndinfo() local
6492 asoc = sctp_id2assoc(sk, info.snd_assoc_id); in sctp_getsockopt_default_sndinfo()
6493 if (!asoc && info.snd_assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_default_sndinfo()
6497 if (asoc) { in sctp_getsockopt_default_sndinfo()
6498 info.snd_sid = asoc->default_stream; in sctp_getsockopt_default_sndinfo()
6499 info.snd_flags = asoc->default_flags; in sctp_getsockopt_default_sndinfo()
6500 info.snd_ppid = asoc->default_ppid; in sctp_getsockopt_default_sndinfo()
6501 info.snd_context = asoc->default_context; in sctp_getsockopt_default_sndinfo()
6560 struct sctp_association *asoc; in sctp_getsockopt_rtoinfo() local
6570 asoc = sctp_id2assoc(sk, rtoinfo.srto_assoc_id); in sctp_getsockopt_rtoinfo()
6572 if (!asoc && rtoinfo.srto_assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_rtoinfo()
6577 if (asoc) { in sctp_getsockopt_rtoinfo()
6578 rtoinfo.srto_initial = jiffies_to_msecs(asoc->rto_initial); in sctp_getsockopt_rtoinfo()
6579 rtoinfo.srto_max = jiffies_to_msecs(asoc->rto_max); in sctp_getsockopt_rtoinfo()
6580 rtoinfo.srto_min = jiffies_to_msecs(asoc->rto_min); in sctp_getsockopt_rtoinfo()
6616 struct sctp_association *asoc; in sctp_getsockopt_associnfo() local
6628 asoc = sctp_id2assoc(sk, assocparams.sasoc_assoc_id); in sctp_getsockopt_associnfo()
6630 if (!asoc && assocparams.sasoc_assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_associnfo()
6635 if (asoc) { in sctp_getsockopt_associnfo()
6636 assocparams.sasoc_asocmaxrxt = asoc->max_retrans; in sctp_getsockopt_associnfo()
6637 assocparams.sasoc_peer_rwnd = asoc->peer.rwnd; in sctp_getsockopt_associnfo()
6638 assocparams.sasoc_local_rwnd = asoc->a_rwnd; in sctp_getsockopt_associnfo()
6639 assocparams.sasoc_cookie_life = ktime_to_ms(asoc->cookie_life); in sctp_getsockopt_associnfo()
6641 list_for_each(pos, &asoc->peer.transport_addr_list) { in sctp_getsockopt_associnfo()
6706 struct sctp_association *asoc; in sctp_getsockopt_context() local
6716 asoc = sctp_id2assoc(sk, params.assoc_id); in sctp_getsockopt_context()
6717 if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_context()
6721 params.assoc_value = asoc ? asoc->default_rcv_context in sctp_getsockopt_context()
6763 struct sctp_association *asoc; in sctp_getsockopt_maxseg() local
6779 asoc = sctp_id2assoc(sk, params.assoc_id); in sctp_getsockopt_maxseg()
6780 if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_maxseg()
6784 if (asoc) in sctp_getsockopt_maxseg()
6785 params.assoc_value = asoc->frag_point; in sctp_getsockopt_maxseg()
6858 struct sctp_association *asoc; in sctp_getsockopt_maxburst() local
6874 asoc = sctp_id2assoc(sk, params.assoc_id); in sctp_getsockopt_maxburst()
6875 if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_maxburst()
6879 params.assoc_value = asoc ? asoc->max_burst : sctp_sk(sk)->max_burst; in sctp_getsockopt_maxburst()
6934 struct sctp_association *asoc; in sctp_getsockopt_active_key() local
6943 asoc = sctp_id2assoc(sk, val.scact_assoc_id); in sctp_getsockopt_active_key()
6944 if (!asoc && val.scact_assoc_id && sctp_style(sk, UDP)) in sctp_getsockopt_active_key()
6947 if (asoc) { in sctp_getsockopt_active_key()
6948 if (!asoc->peer.auth_capable) in sctp_getsockopt_active_key()
6950 val.scact_keynumber = asoc->active_key_id; in sctp_getsockopt_active_key()
6970 struct sctp_association *asoc; in sctp_getsockopt_peer_auth_chunks() local
6982 asoc = sctp_id2assoc(sk, val.gauth_assoc_id); in sctp_getsockopt_peer_auth_chunks()
6983 if (!asoc) in sctp_getsockopt_peer_auth_chunks()
6986 if (!asoc->peer.auth_capable) in sctp_getsockopt_peer_auth_chunks()
6989 ch = asoc->peer.peer_chunks; in sctp_getsockopt_peer_auth_chunks()
7015 struct sctp_association *asoc; in sctp_getsockopt_local_auth_chunks() local
7027 asoc = sctp_id2assoc(sk, val.gauth_assoc_id); in sctp_getsockopt_local_auth_chunks()
7028 if (!asoc && val.gauth_assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_local_auth_chunks()
7032 if (asoc) { in sctp_getsockopt_local_auth_chunks()
7033 if (!asoc->peer.auth_capable) in sctp_getsockopt_local_auth_chunks()
7035 ch = (struct sctp_chunks_param *)asoc->c.auth_chunks; in sctp_getsockopt_local_auth_chunks()
7069 struct sctp_association *asoc; in sctp_getsockopt_assoc_number() local
7080 list_for_each_entry(asoc, &(sp->ep->asocs), asocs) { in sctp_getsockopt_assoc_number()
7125 struct sctp_association *asoc; in sctp_getsockopt_assoc_ids() local
7136 list_for_each_entry(asoc, &(sp->ep->asocs), asocs) { in sctp_getsockopt_assoc_ids()
7151 list_for_each_entry(asoc, &(sp->ep->asocs), asocs) { in sctp_getsockopt_assoc_ids()
7152 ids->gaids_assoc_id[num++] = asoc->assoc_id; in sctp_getsockopt_assoc_ids()
7177 struct sctp_association *asoc; in sctp_getsockopt_paddr_thresholds() local
7200 asoc = sctp_id2assoc(sk, val.spt_assoc_id); in sctp_getsockopt_paddr_thresholds()
7201 if (!asoc && val.spt_assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_paddr_thresholds()
7205 if (asoc) { in sctp_getsockopt_paddr_thresholds()
7206 val.spt_pathpfthld = asoc->pf_retrans; in sctp_getsockopt_paddr_thresholds()
7207 val.spt_pathmaxrxt = asoc->pathmaxrxt; in sctp_getsockopt_paddr_thresholds()
7208 val.spt_pathcpthld = asoc->ps_retrans; in sctp_getsockopt_paddr_thresholds()
7235 struct sctp_association *asoc = NULL; in sctp_getsockopt_assoc_stats() local
7247 asoc = sctp_id2assoc(sk, sas.sas_assoc_id); in sctp_getsockopt_assoc_stats()
7248 if (!asoc) in sctp_getsockopt_assoc_stats()
7251 sas.sas_rtxchunks = asoc->stats.rtxchunks; in sctp_getsockopt_assoc_stats()
7252 sas.sas_gapcnt = asoc->stats.gapcnt; in sctp_getsockopt_assoc_stats()
7253 sas.sas_outofseqtsns = asoc->stats.outofseqtsns; in sctp_getsockopt_assoc_stats()
7254 sas.sas_osacks = asoc->stats.osacks; in sctp_getsockopt_assoc_stats()
7255 sas.sas_isacks = asoc->stats.isacks; in sctp_getsockopt_assoc_stats()
7256 sas.sas_octrlchunks = asoc->stats.octrlchunks; in sctp_getsockopt_assoc_stats()
7257 sas.sas_ictrlchunks = asoc->stats.ictrlchunks; in sctp_getsockopt_assoc_stats()
7258 sas.sas_oodchunks = asoc->stats.oodchunks; in sctp_getsockopt_assoc_stats()
7259 sas.sas_iodchunks = asoc->stats.iodchunks; in sctp_getsockopt_assoc_stats()
7260 sas.sas_ouodchunks = asoc->stats.ouodchunks; in sctp_getsockopt_assoc_stats()
7261 sas.sas_iuodchunks = asoc->stats.iuodchunks; in sctp_getsockopt_assoc_stats()
7262 sas.sas_idupchunks = asoc->stats.idupchunks; in sctp_getsockopt_assoc_stats()
7263 sas.sas_opackets = asoc->stats.opackets; in sctp_getsockopt_assoc_stats()
7264 sas.sas_ipackets = asoc->stats.ipackets; in sctp_getsockopt_assoc_stats()
7270 sas.sas_maxrto = asoc->stats.max_obs_rto; in sctp_getsockopt_assoc_stats()
7271 memcpy(&sas.sas_obs_rto_ipaddr, &asoc->stats.obs_rto_ipaddr, in sctp_getsockopt_assoc_stats()
7275 asoc->stats.max_obs_rto = asoc->rto_min; in sctp_getsockopt_assoc_stats()
7333 struct sctp_association *asoc; in sctp_getsockopt_pr_supported() local
7345 asoc = sctp_id2assoc(sk, params.assoc_id); in sctp_getsockopt_pr_supported()
7346 if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_pr_supported()
7352 params.assoc_value = asoc ? asoc->peer.prsctp_capable in sctp_getsockopt_pr_supported()
7372 struct sctp_association *asoc; in sctp_getsockopt_default_prinfo() local
7384 asoc = sctp_id2assoc(sk, info.pr_assoc_id); in sctp_getsockopt_default_prinfo()
7385 if (!asoc && info.pr_assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_default_prinfo()
7391 if (asoc) { in sctp_getsockopt_default_prinfo()
7392 info.pr_policy = SCTP_PR_POLICY(asoc->default_flags); in sctp_getsockopt_default_prinfo()
7393 info.pr_value = asoc->default_timetolive; in sctp_getsockopt_default_prinfo()
7418 struct sctp_association *asoc; in sctp_getsockopt_pr_assocstatus() local
7436 asoc = sctp_id2assoc(sk, params.sprstat_assoc_id); in sctp_getsockopt_pr_assocstatus()
7437 if (!asoc) in sctp_getsockopt_pr_assocstatus()
7445 asoc->abandoned_unsent[policy]; in sctp_getsockopt_pr_assocstatus()
7447 asoc->abandoned_sent[policy]; in sctp_getsockopt_pr_assocstatus()
7451 asoc->abandoned_unsent[__SCTP_PR_INDEX(policy)]; in sctp_getsockopt_pr_assocstatus()
7453 asoc->abandoned_sent[__SCTP_PR_INDEX(policy)]; in sctp_getsockopt_pr_assocstatus()
7477 struct sctp_association *asoc; in sctp_getsockopt_pr_streamstatus() local
7496 asoc = sctp_id2assoc(sk, params.sprstat_assoc_id); in sctp_getsockopt_pr_streamstatus()
7497 if (!asoc || params.sprstat_sid >= asoc->stream.outcnt) in sctp_getsockopt_pr_streamstatus()
7500 streamoute = SCTP_SO(&asoc->stream, params.sprstat_sid)->ext; in sctp_getsockopt_pr_streamstatus()
7541 struct sctp_association *asoc; in sctp_getsockopt_reconfig_supported() local
7553 asoc = sctp_id2assoc(sk, params.assoc_id); in sctp_getsockopt_reconfig_supported()
7554 if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_reconfig_supported()
7560 params.assoc_value = asoc ? asoc->peer.reconf_capable in sctp_getsockopt_reconfig_supported()
7580 struct sctp_association *asoc; in sctp_getsockopt_enable_strreset() local
7592 asoc = sctp_id2assoc(sk, params.assoc_id); in sctp_getsockopt_enable_strreset()
7593 if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_enable_strreset()
7599 params.assoc_value = asoc ? asoc->strreset_enable in sctp_getsockopt_enable_strreset()
7619 struct sctp_association *asoc; in sctp_getsockopt_scheduler() local
7631 asoc = sctp_id2assoc(sk, params.assoc_id); in sctp_getsockopt_scheduler()
7632 if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_scheduler()
7638 params.assoc_value = asoc ? sctp_sched_get_sched(asoc) in sctp_getsockopt_scheduler()
7658 struct sctp_association *asoc; in sctp_getsockopt_scheduler_value() local
7670 asoc = sctp_id2assoc(sk, params.assoc_id); in sctp_getsockopt_scheduler_value()
7671 if (!asoc) { in sctp_getsockopt_scheduler_value()
7676 retval = sctp_sched_get_value(asoc, params.stream_id, in sctp_getsockopt_scheduler_value()
7700 struct sctp_association *asoc; in sctp_getsockopt_interleaving_supported() local
7712 asoc = sctp_id2assoc(sk, params.assoc_id); in sctp_getsockopt_interleaving_supported()
7713 if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_interleaving_supported()
7719 params.assoc_value = asoc ? asoc->peer.intl_capable in sctp_getsockopt_interleaving_supported()
7757 struct sctp_association *asoc; in sctp_getsockopt_event() local
7772 asoc = sctp_id2assoc(sk, param.se_assoc_id); in sctp_getsockopt_event()
7773 if (!asoc && param.se_assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_event()
7777 subscribe = asoc ? asoc->subscribe : sctp_sk(sk)->subscribe; in sctp_getsockopt_event()
7794 struct sctp_association *asoc; in sctp_getsockopt_asconf_supported() local
7806 asoc = sctp_id2assoc(sk, params.assoc_id); in sctp_getsockopt_asconf_supported()
7807 if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_asconf_supported()
7813 params.assoc_value = asoc ? asoc->peer.asconf_capable in sctp_getsockopt_asconf_supported()
7833 struct sctp_association *asoc; in sctp_getsockopt_auth_supported() local
7845 asoc = sctp_id2assoc(sk, params.assoc_id); in sctp_getsockopt_auth_supported()
7846 if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_auth_supported()
7852 params.assoc_value = asoc ? asoc->peer.auth_capable in sctp_getsockopt_auth_supported()
7872 struct sctp_association *asoc; in sctp_getsockopt_ecn_supported() local
7884 asoc = sctp_id2assoc(sk, params.assoc_id); in sctp_getsockopt_ecn_supported()
7885 if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_ecn_supported()
7891 params.assoc_value = asoc ? asoc->peer.ecn_capable in sctp_getsockopt_ecn_supported()
7911 struct sctp_association *asoc; in sctp_getsockopt_pf_expose() local
7923 asoc = sctp_id2assoc(sk, params.assoc_id); in sctp_getsockopt_pf_expose()
7924 if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_pf_expose()
7930 params.assoc_value = asoc ? asoc->pf_expose in sctp_getsockopt_pf_expose()
7948 struct sctp_association *asoc; in sctp_getsockopt_encap_port() local
7979 asoc = sctp_id2assoc(sk, encap.sue_assoc_id); in sctp_getsockopt_encap_port()
7980 if (!asoc && encap.sue_assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_encap_port()
7986 if (asoc) { in sctp_getsockopt_encap_port()
7987 encap_port = asoc->encap_port; in sctp_getsockopt_encap_port()
8009 struct sctp_association *asoc; in sctp_getsockopt_probe_interval() local
8039 asoc = sctp_id2assoc(sk, params.spi_assoc_id); in sctp_getsockopt_probe_interval()
8040 if (!asoc && params.spi_assoc_id != SCTP_FUTURE_ASSOC && in sctp_getsockopt_probe_interval()
8046 if (asoc) { in sctp_getsockopt_probe_interval()
8047 probe_interval = jiffies_to_msecs(asoc->probe_interval); in sctp_getsockopt_probe_interval()
9085 static void __sctp_write_space(struct sctp_association *asoc) in __sctp_write_space() argument
9087 struct sock *sk = asoc->base.sk; in __sctp_write_space()
9089 if (sctp_wspace(asoc) <= 0) in __sctp_write_space()
9092 if (waitqueue_active(&asoc->wait)) in __sctp_write_space()
9093 wake_up_interruptible(&asoc->wait); in __sctp_write_space()
9116 struct sctp_association *asoc) in sctp_wake_up_waiters() argument
9118 struct sctp_association *tmp = asoc; in sctp_wake_up_waiters()
9123 if (asoc->ep->sndbuf_policy) in sctp_wake_up_waiters()
9124 return __sctp_write_space(asoc); in sctp_wake_up_waiters()
9129 if (asoc->base.dead) in sctp_wake_up_waiters()
9150 if (tmp == asoc) in sctp_wake_up_waiters()
9162 struct sctp_association *asoc = chunk->asoc; in sctp_wfree() local
9163 struct sock *sk = asoc->base.sk; in sctp_wfree()
9167 asoc->sndbuf_used -= skb->truesize + sizeof(struct sctp_chunk); in sctp_wfree()
9182 ev = sctp_ulpevent_make_authkey(asoc, shkey->key_id, in sctp_wfree()
9186 asoc->stream.si->enqueue_event(&asoc->ulpq, ev); in sctp_wfree()
9192 sctp_wake_up_waiters(sk, asoc); in sctp_wfree()
9194 sctp_association_put(asoc); in sctp_wfree()
9217 static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, in sctp_wait_for_sndbuf() argument
9220 struct sock *sk = asoc->base.sk; in sctp_wait_for_sndbuf()
9225 pr_debug("%s: asoc:%p, timeo:%ld, msg_len:%zu\n", __func__, asoc, in sctp_wait_for_sndbuf()
9229 sctp_association_hold(asoc); in sctp_wait_for_sndbuf()
9233 prepare_to_wait_exclusive(&asoc->wait, &wait, in sctp_wait_for_sndbuf()
9235 if (asoc->base.dead) in sctp_wait_for_sndbuf()
9239 if (sk->sk_err || asoc->state >= SCTP_STATE_SHUTDOWN_PENDING) in sctp_wait_for_sndbuf()
9243 if ((int)msg_len <= sctp_wspace(asoc) && in sctp_wait_for_sndbuf()
9253 if (sk != asoc->base.sk) in sctp_wait_for_sndbuf()
9260 finish_wait(&asoc->wait, &wait); in sctp_wait_for_sndbuf()
9263 sctp_association_put(asoc); in sctp_wait_for_sndbuf()
9302 struct sctp_association *asoc; in sctp_write_space() local
9305 list_for_each_entry(asoc, &((sctp_sk(sk))->ep->asocs), asocs) { in sctp_write_space()
9306 __sctp_write_space(asoc); in sctp_write_space()
9329 static int sctp_wait_for_connect(struct sctp_association *asoc, long *timeo_p) in sctp_wait_for_connect() argument
9331 struct sock *sk = asoc->base.sk; in sctp_wait_for_connect()
9336 pr_debug("%s: asoc:%p, timeo:%ld\n", __func__, asoc, *timeo_p); in sctp_wait_for_connect()
9339 sctp_association_hold(asoc); in sctp_wait_for_connect()
9342 prepare_to_wait_exclusive(&asoc->wait, &wait, in sctp_wait_for_connect()
9348 if (sk->sk_err || asoc->state >= SCTP_STATE_SHUTDOWN_PENDING || in sctp_wait_for_connect()
9349 asoc->base.dead) in sctp_wait_for_connect()
9354 if (sctp_state(asoc, ESTABLISHED)) in sctp_wait_for_connect()
9368 finish_wait(&asoc->wait, &wait); in sctp_wait_for_connect()
9371 sctp_association_put(asoc); in sctp_wait_for_connect()
9376 if (asoc->init_err_counter + 1 > asoc->max_init_attempts) in sctp_wait_for_connect()
9465 struct sctp_association *asoc) in sctp_copy_sock() argument
9500 newinet->inet_dport = htons(asoc->peer.port); in sctp_copy_sock()
9514 * security attribute from asoc. in sctp_copy_sock()
9516 security_sctp_sk_clone(asoc, sk, newsk); in sctp_copy_sock()
9594 if (event->asoc == assoc) { in sctp_sock_migrate()
9623 if (event->asoc == assoc) { in sctp_sock_migrate()