Lines Matching +full:build +full:- +full:only +full:- +full:delayed +full:- +full:rules

1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Copyright (c) 1999-2000 Cisco, Inc.
5 * Copyright (c) 1999-2001 Motorola, Inc.
15 * lksctp developers <linux-sctp@vger.kernel.org>
65 asoc->ep = (struct sctp_endpoint *)ep;
66 asoc->base.sk = (struct sock *)sk;
67 asoc->base.net = sock_net(sk);
69 sctp_endpoint_hold(asoc->ep);
70 sock_hold(asoc->base.sk);
73 asoc->base.type = SCTP_EP_TYPE_ASSOCIATION;
76 refcount_set(&asoc->base.refcnt, 1);
79 sctp_bind_addr_init(&asoc->base.bind_addr, ep->base.bind_addr.port);
81 asoc->state = SCTP_STATE_CLOSED;
82 asoc->cookie_life = ms_to_ktime(sp->assocparams.sasoc_cookie_life);
83 asoc->user_frag = sp->user_frag;
88 asoc->max_retrans = sp->assocparams.sasoc_asocmaxrxt;
89 asoc->pf_retrans = sp->pf_retrans;
90 asoc->ps_retrans = sp->ps_retrans;
91 asoc->pf_expose = sp->pf_expose;
93 asoc->rto_initial = msecs_to_jiffies(sp->rtoinfo.srto_initial);
94 asoc->rto_max = msecs_to_jiffies(sp->rtoinfo.srto_max);
95 asoc->rto_min = msecs_to_jiffies(sp->rtoinfo.srto_min);
100 asoc->hbinterval = msecs_to_jiffies(sp->hbinterval);
101 asoc->probe_interval = msecs_to_jiffies(sp->probe_interval);
103 asoc->encap_port = sp->encap_port;
106 asoc->pathmaxrxt = sp->pathmaxrxt;
108 asoc->flowlabel = sp->flowlabel;
109 asoc->dscp = sp->dscp;
112 asoc->sackdelay = msecs_to_jiffies(sp->sackdelay);
113 asoc->sackfreq = sp->sackfreq;
118 asoc->param_flags = sp->param_flags;
123 asoc->max_burst = sp->max_burst;
125 asoc->subscribe = sp->subscribe;
128 asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_COOKIE] = asoc->rto_initial;
129 asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT] = asoc->rto_initial;
130 asoc->timeouts[SCTP_EVENT_TIMEOUT_T2_SHUTDOWN] = asoc->rto_initial;
133 * If the 'T5-shutdown-guard' timer is used, it SHOULD be set to the
136 asoc->timeouts[SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD]
137 = 5 * asoc->rto_max;
139 asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay;
140 asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] =
141 (unsigned long)sp->autoclose * HZ;
145 timer_setup(&asoc->timers[i], sctp_timer_events[i], 0);
151 asoc->c.sinit_max_instreams = sp->initmsg.sinit_max_instreams;
152 asoc->c.sinit_num_ostreams = sp->initmsg.sinit_num_ostreams;
153 asoc->max_init_attempts = sp->initmsg.sinit_max_attempts;
155 asoc->max_init_timeo =
156 msecs_to_jiffies(sp->initmsg.sinit_max_init_timeo);
160 * RFC 6 - A SCTP receiver MUST be able to receive a minimum of
163 if ((sk->sk_rcvbuf/2) < SCTP_DEFAULT_MINWINDOW)
164 asoc->rwnd = SCTP_DEFAULT_MINWINDOW;
166 asoc->rwnd = sk->sk_rcvbuf/2;
168 asoc->a_rwnd = asoc->rwnd;
171 asoc->peer.rwnd = SCTP_DEFAULT_MAXWINDOW;
174 atomic_set(&asoc->rmem_alloc, 0);
176 init_waitqueue_head(&asoc->wait);
178 asoc->c.my_vtag = sctp_generate_tag(ep);
179 asoc->c.my_port = ep->base.bind_addr.port;
181 asoc->c.initial_tsn = sctp_generate_tsn(ep);
183 asoc->next_tsn = asoc->c.initial_tsn;
185 asoc->ctsn_ack_point = asoc->next_tsn - 1;
186 asoc->adv_peer_ack_point = asoc->ctsn_ack_point;
187 asoc->highest_sacked = asoc->ctsn_ack_point;
188 asoc->last_cwr_tsn = asoc->ctsn_ack_point;
200 asoc->addip_serial = asoc->c.initial_tsn;
201 asoc->strreset_outseq = asoc->c.initial_tsn;
203 INIT_LIST_HEAD(&asoc->addip_chunk_list);
204 INIT_LIST_HEAD(&asoc->asconf_ack_list);
207 INIT_LIST_HEAD(&asoc->peer.transport_addr_list);
220 asoc->peer.sack_needed = 1;
221 asoc->peer.sack_generation = 1;
224 sctp_inq_init(&asoc->base.inqueue);
225 sctp_inq_set_th_handler(&asoc->base.inqueue, sctp_assoc_bh_rcv);
228 sctp_outq_init(asoc, &asoc->outqueue);
230 sctp_ulpq_init(&asoc->ulpq, asoc);
232 if (sctp_stream_init(&asoc->stream, asoc->c.sinit_num_ostreams, 0, gfp))
236 asoc->pathmtu = sp->pathmtu;
242 asoc->peer.ipv4_address = 1;
243 if (asoc->base.sk->sk_family == PF_INET6)
244 asoc->peer.ipv6_address = 1;
245 INIT_LIST_HEAD(&asoc->asocs);
247 asoc->default_stream = sp->default_stream;
248 asoc->default_ppid = sp->default_ppid;
249 asoc->default_flags = sp->default_flags;
250 asoc->default_context = sp->default_context;
251 asoc->default_timetolive = sp->default_timetolive;
252 asoc->default_rcv_context = sp->default_rcv_context;
255 INIT_LIST_HEAD(&asoc->endpoint_shared_keys);
259 asoc->active_key_id = ep->active_key_id;
260 asoc->strreset_enable = ep->strreset_enable;
263 if (ep->auth_hmacs_list)
264 memcpy(asoc->c.auth_hmacs, ep->auth_hmacs_list,
265 ntohs(ep->auth_hmacs_list->param_hdr.length));
266 if (ep->auth_chunk_list)
267 memcpy(asoc->c.auth_chunks, ep->auth_chunk_list,
268 ntohs(ep->auth_chunk_list->param_hdr.length));
271 p = (struct sctp_paramhdr *)asoc->c.auth_random;
272 p->type = SCTP_PARAM_RANDOM;
273 p->length = htons(sizeof(*p) + SCTP_AUTH_RANDOM_LENGTH);
279 sctp_stream_free(&asoc->stream);
280 sock_put(asoc->base.sk);
281 sctp_endpoint_put(asoc->ep);
312 * the actual deallocation may be delayed.
316 struct sock *sk = asoc->base.sk;
321 /* Only real associations count against the endpoint, so
324 if (!list_empty(&asoc->asocs)) {
325 list_del(&asoc->asocs);
327 /* Decrement the backlog value for a TCP-style listening
337 asoc->base.dead = true;
340 sctp_outq_free(&asoc->outqueue);
343 sctp_ulpq_free(&asoc->ulpq);
346 sctp_inq_free(&asoc->base.inqueue);
348 sctp_tsnmap_free(&asoc->peer.tsn_map);
351 sctp_stream_free(&asoc->stream);
353 if (asoc->strreset_chunk)
354 sctp_chunk_free(asoc->strreset_chunk);
357 sctp_bind_addr_free(&asoc->base.bind_addr);
365 if (timer_delete(&asoc->timers[i]))
370 kfree(asoc->peer.cookie);
371 kfree(asoc->peer.peer_random);
372 kfree(asoc->peer.peer_chunks);
373 kfree(asoc->peer.peer_hmacs);
376 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
383 asoc->peer.transport_count = 0;
388 kfree(asoc->asconf_addr_del_pending);
390 /* AUTH - Free the endpoint shared keys */
391 sctp_auth_destroy_keys(&asoc->endpoint_shared_keys);
393 /* AUTH - Free the association shared key */
394 sctp_auth_key_put(asoc->asoc_shared_key);
402 if (unlikely(!asoc->base.dead)) {
407 sctp_endpoint_put(asoc->ep);
408 sock_put(asoc->base.sk);
410 if (asoc->assoc_id != 0) {
412 idr_remove(&sctp_assocs_id, asoc->assoc_id);
416 WARN_ON(atomic_read(&asoc->rmem_alloc));
428 /* it's a changeover only if we already have a primary path
431 if (asoc->peer.primary_path != NULL &&
432 asoc->peer.primary_path != transport)
435 asoc->peer.primary_path = transport;
440 memcpy(&asoc->peer.primary_addr, &transport->ipaddr,
446 if ((transport->state == SCTP_ACTIVE) ||
447 (transport->state == SCTP_UNKNOWN))
448 asoc->peer.active_path = transport;
451 * SFR-CACC algorithm:
461 * Really, only bother is we have data queued or outstanding on
464 if (!asoc->outqueue.outstanding_bytes && !asoc->outqueue.out_qlen)
467 if (transport->cacc.changeover_active)
468 transport->cacc.cycling_changeover = changeover;
473 transport->cacc.changeover_active = changeover;
478 transport->cacc.next_tsn_at_change = asoc->next_tsn;
490 __func__, asoc, &peer->ipaddr.sa);
495 if (asoc->peer.retran_path == peer)
499 list_del_rcu(&peer->transports);
504 pos = asoc->peer.transport_addr_list.next;
508 if (asoc->peer.primary_path == peer)
510 if (asoc->peer.active_path == peer)
511 asoc->peer.active_path = transport;
512 if (asoc->peer.retran_path == peer)
513 asoc->peer.retran_path = transport;
514 if (asoc->peer.last_data_from == peer)
515 asoc->peer.last_data_from = transport;
517 if (asoc->strreset_chunk &&
518 asoc->strreset_chunk->transport == peer) {
519 asoc->strreset_chunk->transport = transport;
528 if (asoc->init_last_sent_to == peer)
529 asoc->init_last_sent_to = NULL;
536 if (asoc->shutdown_last_sent_to == peer)
537 asoc->shutdown_last_sent_to = NULL;
542 if (asoc->addip_last_asconf &&
543 asoc->addip_last_asconf->transport == peer)
544 asoc->addip_last_asconf->transport = NULL;
549 if (!list_empty(&peer->transmitted)) {
550 struct sctp_transport *active = asoc->peer.active_path;
553 list_for_each_entry(ch, &peer->transmitted,
555 ch->transport = NULL;
556 ch->rtt_in_progress = 0;
559 list_splice_tail_init(&peer->transmitted,
560 &active->transmitted);
566 if (!timer_pending(&active->T3_rtx_timer))
567 if (!mod_timer(&active->T3_rtx_timer,
568 jiffies + active->rto))
572 list_for_each_entry(ch, &asoc->outqueue.out_chunk_list, list)
573 if (ch->transport == peer)
574 ch->transport = NULL;
576 asoc->peer.transport_count--;
592 sp = sctp_sk(asoc->base.sk);
595 port = ntohs(addr->v4.sin_port);
598 asoc, &addr->sa, peer_state);
601 if (0 == asoc->peer.port)
602 asoc->peer.port = port;
607 /* An UNKNOWN state is only set on transports added by
611 if (peer->state == SCTP_UNKNOWN) {
612 peer->state = SCTP_ACTIVE;
617 peer = sctp_transport_new(asoc->base.net, addr, gfp);
626 peer->hbinterval = asoc->hbinterval;
627 peer->probe_interval = asoc->probe_interval;
629 peer->encap_port = asoc->encap_port;
632 peer->pathmaxrxt = asoc->pathmaxrxt;
635 peer->pf_retrans = asoc->pf_retrans;
637 peer->ps_retrans = asoc->ps_retrans;
642 peer->sackdelay = asoc->sackdelay;
643 peer->sackfreq = asoc->sackfreq;
645 if (addr->sa.sa_family == AF_INET6) {
646 __be32 info = addr->v6.sin6_flowinfo;
649 peer->flowlabel = ntohl(info & IPV6_FLOWLABEL_MASK);
650 peer->flowlabel |= SCTP_FLOWLABEL_SET_MASK;
652 peer->flowlabel = asoc->flowlabel;
655 peer->dscp = asoc->dscp;
660 peer->param_flags = asoc->param_flags;
670 sctp_assoc_set_pmtu(asoc, asoc->pathmtu ?
671 min_t(int, peer->pathmtu, asoc->pathmtu) :
672 peer->pathmtu);
674 peer->pmtu_pending = 0;
676 /* The asoc->peer.port might not be meaningful yet, but
679 sctp_packet_init(&peer->packet, peer, asoc->base.bind_addr.port,
680 asoc->peer.port);
682 /* 7.2.1 Slow-Start
692 peer->cwnd = min(4*asoc->pathmtu, max_t(__u32, 2*asoc->pathmtu, 4380));
698 peer->ssthresh = SCTP_DEFAULT_MAXWINDOW;
700 peer->partial_bytes_acked = 0;
701 peer->flight_size = 0;
702 peer->burst_limited = 0;
705 peer->rto = asoc->rto_initial;
709 peer->state = peer_state;
720 list_add_tail_rcu(&peer->transports, &asoc->peer.transport_addr_list);
721 asoc->peer.transport_count++;
726 if (!asoc->peer.primary_path) {
728 asoc->peer.retran_path = peer;
731 if (asoc->peer.active_path == asoc->peer.retran_path &&
732 peer->state != SCTP_UNCONFIRMED) {
733 asoc->peer.retran_path = peer;
748 list_for_each_entry(t, &asoc->peer.transport_addr_list,
750 if (sctp_cmp_addr_exact(address, &t->ipaddr))
764 list_for_each_entry_safe(t, temp, &asoc->peer.transport_addr_list,
791 if (transport->state == SCTP_PF &&
792 asoc->pf_expose != SCTP_PF_EXPOSE_ENABLE)
794 else if (transport->state == SCTP_UNCONFIRMED &&
798 transport->state = SCTP_ACTIVE;
807 if (transport->state != SCTP_UNCONFIRMED) {
808 transport->state = SCTP_INACTIVE;
818 transport->state = SCTP_PF;
819 if (asoc->pf_expose != SCTP_PF_EXPOSE_ENABLE)
843 refcount_inc(&asoc->base.refcnt);
851 if (refcount_dec_and_test(&asoc->base.refcnt))
862 * 2**32 - 1. That is, the next TSN a DATA chunk MUST use
863 * after transmitting TSN = 2*32 - 1 is TSN = 0.
865 __u32 retval = asoc->next_tsn;
866 asoc->next_tsn++;
867 asoc->unack_data++;
873 * only match themselves.
880 af = sctp_get_af_specific(ss1->sa.sa_family);
884 return af->cmp_addr(ss1, ss2);
893 if (!asoc->need_ecne)
899 return sctp_make_ecne(asoc, asoc->last_ecne_tsn);
926 * Another optimization would be to know if there is only one
931 active = asoc->peer.active_path;
933 list_for_each_entry(chunk, &active->transmitted,
936 if (key == chunk->subh.data_hdr->tsn) {
943 list_for_each_entry(transport, &asoc->peer.transport_addr_list,
948 list_for_each_entry(chunk, &transport->transmitted,
950 if (key == chunk->subh.data_hdr->tsn) {
960 /* Do delayed input processing. This is scheduled by sctp_rcv(). */
966 struct net *net = asoc->base.net;
976 ep = asoc->ep;
978 inqueue = &asoc->base.inqueue;
981 state = asoc->state;
982 subtype = SCTP_ST_CHUNK(chunk->chunk_hdr->type);
985 * processing specified in Section 6.3 of SCTP-AUTH spec
994 /* If the next chunk is COOKIE-ECHO, skip the AUTH
996 * Authentication later (during cookie-echo
999 if (next_hdr->type == SCTP_CID_COOKIE_ECHO) {
1000 chunk->auth_chunk = skb_clone(chunk->skb,
1002 chunk->auth = 1;
1008 /* SCTP-AUTH, Section 6.3:
1010 * to be received only after an AUTH-chunk. This list has
1015 if (sctp_auth_recv_cid(subtype.chunk, asoc) && !chunk->auth)
1022 asoc->peer.last_data_from = chunk->transport;
1025 asoc->stats.ictrlchunks++;
1026 if (chunk->chunk_hdr->type == SCTP_CID_SACK)
1027 asoc->stats.isacks++;
1030 if (chunk->transport)
1031 chunk->transport->last_time_heard = ktime_get();
1040 if (asoc->base.dead)
1045 chunk->pdiscard = 1;
1057 struct sock *oldsk = assoc->base.sk;
1062 list_del_init(&assoc->asocs);
1064 /* Decrement the backlog value for a TCP-style socket. */
1069 sctp_endpoint_put(assoc->ep);
1070 sock_put(assoc->base.sk);
1073 assoc->ep = newsp->ep;
1074 sctp_endpoint_hold(assoc->ep);
1077 assoc->base.sk = newsk;
1078 sock_hold(assoc->base.sk);
1081 sctp_endpoint_add_asoc(newsp->ep, assoc);
1084 /* Update an association (possibly from unexpected COOKIE-ECHO processing). */
1092 asoc->c = new->c;
1093 asoc->peer.rwnd = new->peer.rwnd;
1094 asoc->peer.sack_needed = new->peer.sack_needed;
1095 asoc->peer.auth_capable = new->peer.auth_capable;
1096 asoc->peer.i = new->peer.i;
1098 if (!sctp_tsnmap_init(&asoc->peer.tsn_map, SCTP_TSN_MAP_INITIAL,
1099 asoc->peer.i.initial_tsn, GFP_ATOMIC))
1100 return -ENOMEM;
1103 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
1105 if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr)) {
1110 if (asoc->state >= SCTP_STATE_ESTABLISHED)
1119 if (asoc->state >= SCTP_STATE_ESTABLISHED) {
1120 asoc->next_tsn = new->next_tsn;
1121 asoc->ctsn_ack_point = new->ctsn_ack_point;
1122 asoc->adv_peer_ack_point = new->adv_peer_ack_point;
1127 sctp_stream_clear(&asoc->stream);
1133 sctp_ulpq_flush(&asoc->ulpq);
1139 asoc->overall_error_count = 0;
1143 list_for_each_entry(trans, &new->peer.transport_addr_list,
1145 if (!sctp_assoc_add_peer(asoc, &trans->ipaddr,
1146 GFP_ATOMIC, trans->state))
1147 return -ENOMEM;
1149 asoc->ctsn_ack_point = asoc->next_tsn - 1;
1150 asoc->adv_peer_ack_point = asoc->ctsn_ack_point;
1153 sctp_stream_update(&asoc->stream, &new->stream);
1157 return -ENOMEM;
1160 /* SCTP-AUTH: Save the peer parameters from the new associations
1163 kfree(asoc->peer.peer_random);
1164 asoc->peer.peer_random = new->peer.peer_random;
1165 new->peer.peer_random = NULL;
1167 kfree(asoc->peer.peer_chunks);
1168 asoc->peer.peer_chunks = new->peer.peer_chunks;
1169 new->peer.peer_chunks = NULL;
1171 kfree(asoc->peer.peer_hmacs);
1172 asoc->peer.peer_hmacs = new->peer.peer_hmacs;
1173 new->peer.peer_hmacs = NULL;
1179 * See also RFC4960, 6.4. Multi-Homed SCTP Endpoints:
1190 * is multihomed, it should consider each source-destination
1192 * When retransmitting timed-out data, the endpoint should
1193 * attempt to pick the most divergent source-destination
1194 * pair from the original source-destination pair to which
1197 * Note: Rules for picking the most divergent source-destination
1201 * Our basic strategy is to round-robin transports in priorities
1203 * transport with state SCTP_ACTIVE exists, round-robin through
1208 switch (trans->state) {
1223 if (trans1->error_count > trans2->error_count) {
1225 } else if (trans1->error_count == trans2->error_count &&
1226 ktime_after(trans2->last_time_heard,
1227 trans1->last_time_heard)) {
1245 /* First, try a score-based selection if both transport states
1259 struct sctp_transport *trans = asoc->peer.retran_path;
1262 /* We're done as we only have the one and only path. */
1263 if (asoc->peer.transport_count == 1)
1266 * then this is the only active path. Use it.
1268 if (asoc->peer.active_path == asoc->peer.retran_path &&
1269 asoc->peer.active_path->state == SCTP_ACTIVE)
1276 if (&trans->transports == &asoc->peer.transport_addr_list)
1278 if (trans->state == SCTP_UNCONFIRMED)
1282 if (trans_next->state == SCTP_ACTIVE)
1285 if (trans == asoc->peer.retran_path)
1289 asoc->peer.retran_path = trans_next;
1292 __func__, asoc, &asoc->peer.retran_path->ipaddr.sa);
1301 list_for_each_entry(trans, &asoc->peer.transport_addr_list,
1304 if (trans->state == SCTP_INACTIVE ||
1305 trans->state == SCTP_UNCONFIRMED)
1310 if (trans->state == SCTP_PF) {
1316 ktime_after(trans->last_time_heard,
1317 trans_pri->last_time_heard)) {
1321 ktime_after(trans->last_time_heard,
1322 trans_sec->last_time_heard)) {
1327 /* RFC 2960 6.4 Multi-Homed SCTP Endpoints
1335 if ((asoc->peer.primary_path->state == SCTP_ACTIVE ||
1336 asoc->peer.primary_path->state == SCTP_UNKNOWN) &&
1337 asoc->peer.primary_path != trans_pri) {
1339 trans_pri = asoc->peer.primary_path;
1353 trans_pri = sctp_trans_elect_best(asoc->peer.active_path, trans_pf);
1358 asoc->peer.active_path = trans_pri;
1359 asoc->peer.retran_path = trans_sec;
1371 return asoc->peer.active_path;
1373 if (last_sent_to == asoc->peer.retran_path)
1376 return asoc->peer.retran_path;
1382 int frag = sctp_mtu_payload(sctp_sk(asoc->base.sk), asoc->pathmtu,
1383 sctp_datachk_len(&asoc->stream));
1385 if (asoc->user_frag)
1386 frag = min_t(int, frag, asoc->user_frag);
1388 frag = min_t(int, frag, SCTP_MAX_CHUNK_LEN -
1389 sctp_datachk_len(&asoc->stream));
1391 asoc->frag_point = SCTP_TRUNC4(frag);
1396 if (asoc->pathmtu != pmtu) {
1397 asoc->pathmtu = pmtu;
1402 asoc->pathmtu, asoc->frag_point);
1417 list_for_each_entry(t, &asoc->peer.transport_addr_list, transports) {
1418 if (t->pmtu_pending && t->dst) {
1420 atomic_read(&t->mtu_info));
1421 t->pmtu_pending = 0;
1423 if (!pmtu || (t->pathmtu < pmtu))
1424 pmtu = t->pathmtu;
1433 struct net *net = asoc->base.net;
1435 switch (asoc->state) {
1440 if ((asoc->rwnd > asoc->a_rwnd) &&
1441 ((asoc->rwnd - asoc->a_rwnd) >= max_t(__u32,
1442 (asoc->base.sk->sk_rcvbuf >> net->sctp.rwnd_upd_shift),
1443 asoc->pathmtu)))
1458 if (asoc->rwnd_over) {
1459 if (asoc->rwnd_over >= len) {
1460 asoc->rwnd_over -= len;
1462 asoc->rwnd += (len - asoc->rwnd_over);
1463 asoc->rwnd_over = 0;
1466 asoc->rwnd += len;
1474 if (asoc->rwnd_press) {
1475 int change = min(asoc->pathmtu, asoc->rwnd_press);
1476 asoc->rwnd += change;
1477 asoc->rwnd_press -= change;
1480 pr_debug("%s: asoc:%p rwnd increased by %d to (%u, %u) - %u\n",
1481 __func__, asoc, len, asoc->rwnd, asoc->rwnd_over,
1482 asoc->a_rwnd);
1490 asoc->a_rwnd = asoc->rwnd;
1492 pr_debug("%s: sending window update SACK- asoc:%p rwnd:%u "
1493 "a_rwnd:%u\n", __func__, asoc, asoc->rwnd,
1494 asoc->a_rwnd);
1500 asoc->peer.sack_needed = 0;
1502 sctp_outq_tail(&asoc->outqueue, sack, GFP_ATOMIC);
1505 timer = &asoc->timers[SCTP_EVENT_TIMEOUT_SACK];
1517 if (unlikely(!asoc->rwnd || asoc->rwnd_over))
1518 pr_debug("%s: association:%p has asoc->rwnd:%u, "
1519 "asoc->rwnd_over:%u!\n", __func__, asoc,
1520 asoc->rwnd, asoc->rwnd_over);
1522 if (asoc->ep->rcvbuf_policy)
1523 rx_count = atomic_read(&asoc->rmem_alloc);
1525 rx_count = atomic_read(&asoc->base.sk->sk_rmem_alloc);
1532 if (rx_count >= asoc->base.sk->sk_rcvbuf)
1535 if (asoc->rwnd >= len) {
1536 asoc->rwnd -= len;
1538 asoc->rwnd_press += asoc->rwnd;
1539 asoc->rwnd = 0;
1542 asoc->rwnd_over += len - asoc->rwnd;
1543 asoc->rwnd = 0;
1547 __func__, asoc, len, asoc->rwnd, asoc->rwnd_over,
1548 asoc->rwnd_press);
1551 /* Build the bind address list for the association based on info from the
1557 struct sock *sk = asoc->base.sk;
1560 /* Use scoping rules to determine the subset of addresses from
1563 flags = (PF_INET6 == sk->sk_family) ? SCTP_ADDR6_ALLOWED : 0;
1566 if (asoc->peer.ipv4_address)
1568 if (asoc->peer.ipv6_address)
1571 return sctp_bind_addr_copy(asoc->base.net,
1572 &asoc->base.bind_addr,
1573 &asoc->ep->base.bind_addr,
1577 /* Build the association's bind address list from the cookie. */
1583 int var_size2 = ntohs(peer_init->chunk_hdr.length);
1584 int var_size3 = cookie->raw_addr_list_len;
1587 return sctp_raw_to_bind_addrs(&asoc->base.bind_addr, raw, var_size3,
1588 asoc->ep->base.bind_addr.port, gfp);
1597 if ((asoc->base.bind_addr.port == ntohs(laddr->v4.sin_port)) &&
1598 sctp_bind_addr_match(&asoc->base.bind_addr, laddr,
1599 sctp_sk(asoc->base.sk)))
1612 if (asoc->assoc_id)
1629 asoc->assoc_id = (sctp_assoc_t)ret;
1639 list_for_each_entry_safe(asconf, tmp, &asoc->addip_chunk_list, list) {
1640 list_del_init(&asconf->list);
1651 list_for_each_entry_safe(ack, tmp, &asoc->asconf_ack_list,
1653 list_del_init(&ack->transmitted_list);
1665 * the "Peer-Sequence-Number".
1667 list_for_each_entry_safe(ack, tmp, &asoc->asconf_ack_list,
1669 if (ack->subh.addip_hdr->serial ==
1670 htonl(asoc->peer.addip_serial))
1673 list_del_init(&ack->transmitted_list);
1685 /* Walk through the list of cached ASCONF-ACKs and find the
1688 list_for_each_entry(ack, &asoc->asconf_ack_list, transmitted_list) {
1691 if (ack->subh.addip_hdr->serial == serial) {
1709 if (asoc->addip_last_asconf)
1710 sctp_chunk_free(asoc->addip_last_asconf);