Home | History | Annotate | Download | only in netinet

Lines Matching defs:stcb

99     struct sctp_tcb *stcb, struct sctp_nets *net)
105 printf("sctp_handle_init: handling INIT tcb:%p\n", stcb);
113 sctp_abort_association(inp, stcb, m, iphlen, sh, op_err);
119 sctp_abort_association(inp, stcb, m, iphlen, sh, op_err);
126 sctp_abort_association(inp, stcb, m, iphlen, sh, op_err);
132 sctp_abort_association(inp, stcb, m, iphlen, sh, op_err);
138 sctp_abort_association(inp, stcb, m, iphlen, sh, op_err);
144 sctp_abort_association(inp, stcb, m, iphlen, sh, op_err);
155 sctp_send_initiate_ack(inp, stcb, m, iphlen, offset, sh, cp);
164 sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb,
173 asoc = &stcb->asoc;
202 stcb, SCTP_NOTIFY_DATAGRAM_UNSENT,
295 struct sctphdr *sh, struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb,
318 sctp_abort_notification(stcb, 0);
323 sctp_free_assoc(stcb->sctp_ep, stcb);
327 asoc = &stcb->asoc;
329 retval = sctp_process_init((struct sctp_init_chunk *)cp, stcb, net);
336 if (sctp_load_addresses_from_init(stcb, m, iphlen,
340 sctp_abort_notification(stcb, 0);
341 sctp_free_assoc(stcb->sctp_ep, stcb);
345 sctp_queue_op_err(stcb, op_err);
350 stcb->asoc.overall_error_count = 0;
352 retval = sctp_send_cookie_echo(m, offset, stcb, net);
380 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen,
392 sctp_timer_stop(SCTP_TIMER_TYPE_INIT, stcb->sctp_ep, stcb,
396 net->RTO = sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered);
403 struct sctp_tcb *stcb, struct sctp_nets *net)
424 sin->sin_port = stcb->rport;
431 sin6->sin6_port = stcb->rport;
442 r_net = sctp_findnet(stcb, (struct sockaddr *)sin);
460 stcb, 0, (void *)r_net);
468 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb,
473 sctp_set_primary_addr(stcb, (struct sockaddr *)NULL, r_net);
477 r_net->RTO = sctp_calculate_rto(stcb, &stcb->asoc, r_net, &tv);
482 struct sctp_tcb *stcb, struct sctp_nets *net)
490 if (stcb == NULL)
496 sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, net);
498 sctp_abort_notification(stcb, 0);
500 sctp_free_assoc(stcb->sctp_ep, stcb);
510 struct sctp_tcb *stcb, struct sctp_nets *net, int *abort_flag)
520 if (stcb == NULL)
523 if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_WAIT) ||
524 (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_ECHOED)) {
539 sctp_update_acked(stcb, cp, net, abort_flag);
541 asoc = &stcb->asoc;
552 sctp_ulp_notify(SCTP_NOTIFY_PEER_SHUTDOWN, stcb, 0, NULL);
554 if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
555 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) {
562 stcb->sctp_ep->sctp_socket->so_rcv.sb_state |= SBS_CANTSENDMORE;
564 stcb->sctp_ep->sctp_socket->so_state |= SS_CANTSENDMORE;
575 sctp_timer_stop(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, net);
605 sctp_send_shutdown_ack(stcb, stcb->asoc.primary_destination);
614 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK, stcb->sctp_ep,
615 stcb, net);
621 struct sctp_tcb *stcb, struct sctp_nets *net)
630 if (stcb == NULL)
633 asoc = &stcb->asoc;
644 sctp_report_all_outbound(stcb);
647 sctp_timer_stop(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, net);
649 sctp_send_shutdown_complete(stcb, net);
651 sctp_ulp_notify(SCTP_NOTIFY_ASSOC_DOWN, stcb, 0, NULL);
652 if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
653 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) {
654 stcb->sctp_ep->sctp_flags &= ~SCTP_PCB_FLAGS_CONNECTED;
656 stcb->sctp_ep->sctp_socket->so_snd.sb_cc = 0;
657 stcb->sctp_ep->sctp_socket->so_snd.sb_mbcnt = 0;
658 soisdisconnected(stcb->sctp_ep->sctp_socket);
661 sctp_free_assoc(stcb->sctp_ep, stcb);
670 sctp_process_unrecog_chunk(struct sctp_tcb *stcb, struct sctp_paramhdr *phdr,
690 sctp_asconf_cleanup(stcb, net);
693 stcb->asoc.peer_supports_prsctp = 0;
712 sctp_process_unrecog_param(struct sctp_tcb *stcb, struct sctp_paramhdr *phdr)
720 stcb->asoc.peer_supports_prsctp = 0;
726 stcb->asoc.peer_supports_ecn_nonce = 0;
727 stcb->asoc.ecn_nonce_allowed = 0;
728 stcb->asoc.ecn_allowed = 0;
732 stcb->asoc.peer_supports_asconf = 0;
735 stcb->asoc.peer_supports_asconf_setprim = 0;
745 stcb->asoc.peer_supports_asconf = 0;
746 stcb->asoc.peer_supports_asconf_setprim = 0;
761 struct sctp_tcb *stcb, struct sctp_nets *net)
771 asoc = &stcb->asoc;
811 sctp_abort_notification(stcb, 0);
813 sctp_free_assoc(stcb->sctp_ep, stcb);
820 stcb->sctp_ep, stcb, net);
821 sctp_send_initiate(stcb->sctp_ep, stcb);
838 sctp_process_unrecog_chunk(stcb, phdr, net);
841 sctp_process_unrecog_param(stcb, phdr);
890 struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb,
902 if (stcb == NULL) {
913 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh,
922 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh,
929 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh,
936 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh,
943 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh,
949 state = &stcb->asoc.state;
954 if (stcb->asoc.primary_destination->dest_state &
962 stcb->asoc.primary_destination->dest_state &=
965 stcb, 0, (void *)stcb->asoc.primary_destination);
967 if (sctp_process_init_ack(m, iphlen, offset, sh, cp, stcb, net
991 stcb->asoc.overall_error_count = 0;
992 SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered);
996 sctp_timer_start(SCTP_TIMER_TYPE_COOKIE, stcb->sctp_ep,
997 stcb, net);
1042 struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets *net,
1053 asoc = &stcb->asoc;
1060 sctp_send_shutdown_ack(stcb, stcb->asoc.primary_destination);
1151 retval = sctp_process_init(init_cp, stcb, net);
1164 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb,
1166 sctp_timer_stop(SCTP_TIMER_TYPE_INIT, inp, stcb, net);
1167 sctp_timer_stop(SCTP_TIMER_TYPE_COOKIE, inp, stcb,
1177 if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1178 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) &&
1179 (!(stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_ACCEPTING))) {
1186 stcb->sctp_ep->sctp_flags |=
1188 soisconnected(stcb->sctp_ep->sctp_socket);
1192 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb,
1200 if (stcb->asoc.sctp_autoclose_ticks &&
1203 inp, stcb, NULL);
1219 if (sctp_load_addresses_from_init(stcb, m, iphlen,
1231 sctp_send_cookie_ack(stcb);
1232 return (stcb);
1251 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
1252 sctp_timer_stop(SCTP_TIMER_TYPE_INIT, inp, stcb, net);
1253 sctp_timer_stop(SCTP_TIMER_TYPE_COOKIE, inp, stcb, net);
1254 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
1259 if (stcb->asoc.sctp_autoclose_ticks &&
1261 sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb,
1277 retval = sctp_process_init(init_cp, stcb, net);
1286 if (sctp_load_addresses_from_init(stcb, m, iphlen,
1301 if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1302 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) &&
1303 !(stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_ACCEPTING)) {
1304 stcb->sctp_ep->sctp_flags |=
1306 soisconnected(stcb->sctp_ep->sctp_socket);
1315 sctp_send_cookie_ack(stcb);
1316 return (stcb);
1327 sctp_timer_stop(SCTP_TIMER_TYPE_INIT, inp, stcb, net);
1328 sctp_timer_stop(SCTP_TIMER_TYPE_COOKIE, inp, stcb, net);
1329 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
1335 sctp_report_all_outbound(stcb);
1355 retval = sctp_process_init(init_cp, stcb, net);
1365 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
1371 if (sctp_load_addresses_from_init(stcb, m, iphlen,
1390 sctp_send_cookie_ack(stcb);
1392 return (stcb);
1413 struct sctp_tcb *stcb;
1490 stcb = sctp_aloc_assoc(inp, init_src, 0, &error, ntohl(initack_cp->init.initiate_tag));
1491 if (stcb == NULL) {
1506 *netp = sctp_findnet(stcb, init_src);
1507 asoc = &stcb->asoc;
1541 retval = sctp_process_init(init_cp, stcb, *netp);
1548 sctp_free_assoc(inp, stcb);
1552 if (sctp_load_addresses_from_init(stcb, m, iphlen,
1555 sctp_free_assoc(inp, stcb);
1571 (*netp)->RTO = sctp_calculate_rto(stcb, asoc, *netp,
1602 sctp_free_assoc(inp, stcb);
1606 sctp_check_address_list(stcb, m, initack_offset +
1614 if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1615 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) &&
1616 !(stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_ACCEPTING)) {
1626 stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED;
1627 soisconnected(stcb->sctp_ep->sctp_socket);
1628 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, *netp);
1629 } else if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
1630 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_ACCEPTING)) {
1638 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, *netp);
1643 if (stcb->asoc.sctp_autoclose_ticks &&
1645 sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, NULL);
1649 sctp_send_cookie_ack(stcb);
1651 return (stcb);
1657 * stcb: modified to either a new or left as existing (non-NULL) TCB
1662 struct sctp_inpcb **inp_p, struct sctp_tcb **stcb, struct sctp_nets **netp)
1667 struct sctp_tcb *l_stcb=*stcb;
1989 if ((*stcb == NULL) && to) {
1991 *stcb = sctp_findassociation_ep_addr(inp_p, to, netp, localep_sa, NULL);
1992 if (*stcb == NULL) {
2004 if (*stcb == NULL) {
2011 *stcb = sctp_process_cookie_new(m, iphlen, offset, sh, cookie,
2024 *stcb = sctp_process_cookie_existing(m, iphlen, offset, sh,
2025 cookie, cookie_len, *inp_p, *stcb, *netp, to, &notification);
2028 if (*stcb == NULL) {
2042 netl = sctp_findnet(*stcb, to);
2049 sctp_add_remote_addr(*stcb, to, 0, 100);
2050 netl = sctp_findnet(*stcb, to);
2055 sctp_set_primary_addr((*stcb), (struct sockaddr *)NULL,
2058 (*stcb), 0, (void *)netl);
2082 sctp_ulp_notify(notification, *stcb, 0, NULL);
2086 SCTP_TCB_UNLOCK((*stcb));
2088 SCTP_INP_WLOCK((*stcb)->sctp_ep);
2089 SCTP_TCB_LOCK((*stcb));
2090 SCTP_INP_WUNLOCK((*stcb)->sctp_ep);
2102 sctp_free_assoc(*inp_p, *stcb);
2117 sctp_move_pcb_and_assoc(*inp_p, inp, *stcb);
2123 *stcb, *netp);
2125 sctp_ulp_notify(notification, *stcb, 0, NULL);
2130 sctp_ulp_notify(notification, *stcb, 0, NULL);
2137 struct sctp_tcb *stcb, struct sctp_nets *net)
2147 if (stcb == NULL)
2150 asoc = &stcb->asoc;
2152 sctp_timer_stop(SCTP_TIMER_TYPE_COOKIE, stcb->sctp_ep, stcb, net);
2170 net->RTO = sctp_calculate_rto(stcb, asoc, net,
2174 sctp_ulp_notify(SCTP_NOTIFY_ASSOC_UP, stcb, 0, NULL);
2175 if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2176 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) {
2177 stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED;
2178 soisconnected(stcb->sctp_ep->sctp_socket);
2180 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep,
2181 stcb, net);
2185 if (stcb->asoc.sctp_autoclose_ticks &&
2186 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_AUTOCLOSE)) {
2188 stcb->sctp_ep, stcb, NULL);
2195 if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_DO_ASCONF) &&
2196 (stcb->asoc.peer_supports_asconf) &&
2197 (!TAILQ_EMPTY(&stcb->asoc.asconf_queue))) {
2199 stcb->sctp_ep, stcb,
2200 stcb->asoc.primary_destination);
2211 sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep,
2212 stcb, chk->whoTo);
2220 struct sctp_tcb *stcb)
2232 lchk = TAILQ_FIRST(&stcb->asoc.send_queue);
2234 stcb->asoc.nonce_resync_tsn = stcb->asoc.sending_seq;
2236 stcb->asoc.nonce_resync_tsn = lchk->rec.data.TSN_seq;
2238 stcb->asoc.nonce_wait_for_ecne = 0;
2239 stcb->asoc.nonce_sum_check = 0;
2243 lchk = TAILQ_FIRST(&stcb->asoc.sent_queue);
2255 net = stcb->asoc.primary_destination;
2257 if (compare_with_wrap(tsn, stcb->asoc.last_cwr_tsn, MAX_TSN)) {
2278 stcb->asoc.last_cwr_tsn = stcb->asoc.nonce_resync_tsn;
2285 sctp_send_cwr(stcb, net, tsn);
2289 sctp_handle_ecn_cwr(struct sctp_cwr_chunk *cp, struct sctp_tcb *stcb)
2298 TAILQ_FOREACH(chk, &stcb->asoc.control_send_queue, sctp_next) {
2311 TAILQ_REMOVE(&stcb->asoc.control_send_queue, chk,
2315 stcb->asoc.ctrl_queue_cnt--;
2330 struct sctp_tcb *stcb, struct sctp_nets *net)
2339 if (stcb == NULL)
2342 asoc = &stcb->asoc;
2349 sctp_ulp_notify(SCTP_NOTIFY_ASSOC_DOWN, stcb, 0, NULL);
2350 if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2351 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) {
2352 stcb->sctp_ep->sctp_flags &= ~SCTP_PCB_FLAGS_CONNECTED;
2353 stcb->sctp_ep->sctp_socket->so_snd.sb_cc = 0;
2354 stcb->sctp_ep->sctp_socket->so_snd.sb_mbcnt = 0;
2355 soisdisconnected(stcb->sctp_ep->sctp_socket);
2361 sctp_report_all_outbound(stcb);
2364 sctp_timer_stop(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, net);
2366 sctp_free_assoc(stcb->sctp_ep, stcb);
2371 process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc,
2381 tp1 = TAILQ_FIRST(&stcb->asoc.sent_queue);
2398 tp1 = TAILQ_FIRST(&stcb->asoc.sent_queue);
2417 if (stcb->asoc.peers_rwnd == 0 &&
2435 stcb->asoc.sent_queue_retran_cnt++;
2459 if (TAILQ_EMPTY(&stcb->asoc.send_queue) ) {
2460 tp1->rec.data.fast_retran_tsn = stcb->asoc.sending_seq;
2462 tp1->rec.data.fast_retran_tsn = (TAILQ_FIRST(&stcb->asoc.send_queue))->rec.data.TSN_seq;
2466 sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep,
2467 stcb, tp1->whoTo);
2468 sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep,
2469 stcb, tp1->whoTo);
2473 sctp_total_flight_decrease(stcb, tp1);
2480 TAILQ_FOREACH(tp1, &stcb->asoc.sent_queue, sctp_next) {
2484 TAILQ_FOREACH(tp1, &stcb->asoc.control_send_queue,
2489 if (audit != stcb->asoc.sent_queue_retran_cnt) {
2491 audit, stcb->asoc.sent_queue_retran_cnt);
2493 stcb->asoc.sent_queue_retran_cnt = audit;
2502 TAILQ_FOREACH(asconf, &stcb->asoc.control_send_queue,
2510 stcb->asoc.sent_queue_retran_cnt++;
2518 stcb->asoc.dropped_special_cnt++;
2519 if (stcb->asoc.dropped_special_cnt < SCTP_RETRY_DROPPED_THRESH) {
2524 sctp_timer_stop(SCTP_TIMER_TYPE_INIT, stcb->sctp_ep,
2525 stcb, net);
2526 sctp_send_initiate(stcb->sctp_ep, stcb);
2531 sctp_send_sack(stcb);
2535 sctp_send_hb(stcb, 1, net);
2546 sctp_send_shutdown(stcb, net);
2549 sctp_send_shutdown_ack(stcb, net);
2555 TAILQ_FOREACH(cookie, &stcb->asoc.control_send_queue,
2563 stcb->asoc.sent_queue_retran_cnt++;
2565 sctp_timer_stop(SCTP_TIMER_TYPE_COOKIE, stcb->sctp_ep, stcb, net);
2570 sctp_send_cookie_ack(stcb);
2574 sctp_send_asconf_ack(stcb, 1);
2577 send_forward_tsn(stcb, &stcb->asoc);
2595 sctp_reset_in_stream(struct sctp_tcb *stcb,
2611 if (list[i] >= stcb->asoc.streamincnt) {
2615 stcb->asoc.strmin[(list[i])].last_sequence_delivered = 0xffff;
2619 for (i = 0; i < stcb->asoc.streamincnt; i++) {
2620 stcb->asoc.strmin[i].last_sequence_delivered = 0xffff;
2623 sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_RECV, stcb, number_entries, (void *)list);
2628 sctp_clean_up_stream_reset(struct sctp_tcb *stcb)
2633 asoc = &stcb->asoc;
2649 sctp_timer_stop(SCTP_TIMER_TYPE_STRRESET, stcb->sctp_ep, stcb, chk->whoTo);
2671 sctp_handle_stream_reset_response(struct sctp_tcb *stcb,
2679 if (seq == stcb->asoc.str_reset_seq_out) {
2680 sctp_clean_up_stream_reset(stcb);
2681 stcb->asoc.str_reset_seq_out++;
2682 stcb->asoc.stream_reset_outstanding = 0;
2686 if ((tsn == stcb->asoc.cumulative_tsn) ||
2687 (compare_with_wrap(stcb->asoc.cumulative_tsn, tsn, MAX_TSN))) {
2689 sctp_reset_in_stream(stcb, resp, number_entries);
2696 if (stcb->asoc.pending_reply != NULL) {
2704 free(stcb->asoc.pending_reply, M_PCB);
2706 stcb->asoc.pending_reply = malloc(param_length,
2708 memcpy(stcb->asoc.pending_reply, resp, param_length);
2715 stcb->asoc.str_reset_seq_out, seq);
2722 sctp_handle_stream_reset(struct sctp_tcb *stcb, struct sctp_stream_reset_req *sr_req)
2737 sctp_send_str_reset_ack(stcb, req);
2746 sctp_handle_stream_reset_response(stcb, resp);
2762 struct sctp_tcb *stcb, struct sctp_nets *net)
2802 stcb->asoc.peers_rwnd = 0;
2804 if (a_rwnd > stcb->asoc.total_flight) {
2805 stcb->asoc.peers_rwnd =
2806 a_rwnd - stcb->asoc.total_flight;
2808 stcb->asoc.peers_rwnd = 0;
2810 if (stcb->asoc.peers_rwnd <
2811 stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
2813 stcb->asoc.peers_rwnd = 0;
2877 if (process_chunk_drop(stcb, &desc, net, cp->ch.chunk_flags)) {
2894 (stcb->asoc.sat_t3_loss_recovery == 0) &&
2895 (stcb->asoc.sat_network)) {
2944 if (stcb->asoc.seen_a_sack_this_pkt) {
2988 (int)stcb->asoc.max_burst * (int)net->mtu);
3015 * - stcb: is the tcb found for this packet
3027 struct sctp_tcb *stcb, struct sctp_nets **netp, int *fwd_tsn_seen)
3041 struct sctp_tcb *locked_tcb = stcb;
3045 printf("sctp_process_control: iphlen=%u, offset=%u, length=%u stcb:%p\n",
3046 iphlen, *offset, length, stcb);
3083 if (ch->chunk_type == SCTP_ASCONF && stcb == NULL) {
3084 stcb = sctp_findassociation_ep_asconf(m, iphlen,
3087 if (stcb == NULL) {
3102 asoc = &stcb->asoc;
3166 (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_ECHOED)) {
3168 stcb->asoc.overall_error_count = 0;
3169 sctp_handle_cookie_ack((struct sctp_cookie_ack_chunk *)ch, stcb, *netp);
3228 sctp_queue_op_err(stcb, oper);
3249 if ((*netp) && stcb) {
3250 stcb->asoc.last_control_chunk_from = *netp;
3283 if ((stcb != NULL) &&
3284 (SCTP_GET_STATE(&stcb->asoc) ==
3286 sctp_send_shutdown_ack(stcb,
3287 stcb->asoc.primary_destination);
3295 (struct sctp_init_chunk *)ch, inp, stcb, *netp);
3315 if (stcb) {
3316 sctp_free_assoc(inp, stcb);
3341 (struct sctp_init_ack_chunk *)ch, stcb, *netp);
3346 if ((stcb) && ret == 0)
3347 sctp_chunk_output(stcb->sctp_ep, stcb, 2);
3368 stcb->asoc.seen_a_sack_this_pkt = 1;
3370 stcb, *netp, &abort_now);
3385 sctp_send_heartbeat_ack(stcb, m, *offset, chk_length,
3389 stcb->asoc.overall_error_count = 0;
3399 stcb->asoc.overall_error_count = 0;
3403 stcb, *netp);
3412 stcb, *netp);
3425 stcb, *netp, &abort_flag);
3438 sctp_handle_shutdown_ack((struct sctp_shutdown_ack_chunk *)ch, stcb, *netp);
3448 if (sctp_handle_error(ch, stcb, *netp) < 0) {
3456 printf("SCTP_COOKIE-ECHO stcb is %p\n", stcb);
3462 if (stcb) {
3463 sctp_free_assoc(inp, stcb);
3481 sctp_abort_association(inp, stcb, m, iphlen, sh,
3505 sctp_abort_association(inp, stcb, m,
3516 &stcb, netp);
3536 if (!TAILQ_EMPTY(&stcb->asoc.sent_queue)) {
3542 chk = TAILQ_FIRST(&stcb->asoc.sent_queue);
3545 stcb->sctp_ep, stcb,
3560 sctp_free_assoc(inp, stcb);
3565 stcb->asoc.overall_error_count = 0;
3567 stcb, *netp);
3576 stcb->asoc.overall_error_count = 0;
3578 stcb);
3587 stcb->asoc.overall_error_count = 0;
3589 sctp_handle_ecn_cwr((struct sctp_cwr_chunk *)ch, stcb);
3607 stcb, *netp);
3618 stcb->asoc.overall_error_count = 0;
3621 (struct sctp_asconf_chunk *)ch, stcb, *netp);
3630 stcb->asoc.overall_error_count = 0;
3633 (struct sctp_asconf_ack_chunk *)ch, stcb, *netp);
3644 stcb->asoc.overall_error_count = 0;
3646 sctp_handle_forward_tsn(stcb,
3652 stcb->asoc.overall_error_count = 0;
3665 if (stcb->asoc.peer_supports_strreset == 0) {
3670 stcb->asoc.peer_supports_strreset = 1;
3672 sctp_handle_stream_reset(stcb, (struct sctp_stream_reset_req *)ch);
3685 stcb, *netp);
3691 if ((ch->chunk_type & 0x40) && (stcb != NULL)) {
3715 sctp_queue_op_err(stcb, mm);
3738 return (stcb);
3758 return (stcb);
3767 sctp_process_ecn_marked_a(struct sctp_tcb *stcb, struct sctp_nets *net,
3780 stcb->asoc.receiver_nonce_sum++;
3781 stcb->asoc.receiver_nonce_sum &= SCTP_SACK_NONCE_SUM;
3788 if (compare_with_wrap(stcb->asoc.cumulative_tsn,
3789 stcb->asoc.last_echo_tsn, MAX_TSN)) {
3790 stcb->asoc.last_echo_tsn = stcb->asoc.cumulative_tsn;
3798 if (compare_with_wrap(stcb->asoc.cumulative_tsn,
3799 stcb->asoc.last_echo_tsn, MAX_TSN)) {
3800 stcb->asoc.last_echo_tsn = stcb->asoc.cumulative_tsn;
3806 sctp_process_ecn_marked_b(struct sctp_tcb *stcb, struct sctp_nets *net,
3816 if (compare_with_wrap(high_tsn, stcb->asoc.last_echo_tsn,
3819 sctp_send_ecn_echo(stcb, net, high_tsn);
3820 stcb->asoc.last_echo_tsn = high_tsn;
3831 struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets *net,
3845 sctp_auditing(0, inp, stcb, net);
3862 stcb = sctp_process_control(m, iphlen, &offset, length, sh, ch,
3863 inp, stcb, &net, &fwd_tsn_seen);
3875 if (stcb == NULL) {
3880 if (stcb->asoc.my_vtag != ntohl(sh->v_tag)) {
3883 SCTP_TCB_UNLOCK(stcb);
3887 if (stcb == NULL) {
3906 stcb->asoc.seen_a_sack_this_pkt = 0;
3916 switch (SCTP_GET_STATE(&stcb->asoc)) {
3923 stcb->asoc.overall_error_count = 0;
3925 (struct sctp_cookie_ack_chunk *)ch, stcb, net);
3932 SCTP_TCB_UNLOCK(stcb);
3942 printf("Got data in invalid state %d.. dropping\n", stcb->asoc.state);
3945 SCTP_TCB_UNLOCK(stcb);
3953 if (stcb->asoc.ecn_allowed &&
3955 sctp_process_ecn_marked_a(stcb, net, ecn_bits);
3959 inp, stcb, net, &high_tsn);
3970 if (stcb->asoc.ecn_allowed && (ecn_bits & (SCTP_ECT0_BIT|SCTP_ECT1_BIT)) ) {
3971 sctp_process_ecn_marked_b(stcb, net, high_tsn, ecn_bits);
3983 if (compare_with_wrap(stcb->asoc.highest_tsn_inside_map,
3984 stcb->asoc.cumulative_tsn, MAX_TSN)) {
3988 sctp_sack_check(stcb, 1, was_a_gap, &abort_flag);
3997 sctp_auditing(1, inp, stcb, net);
4002 stcb->asoc.peers_rwnd,
4003 TAILQ_EMPTY(&stcb->asoc.control_send_queue),
4004 stcb->asoc.total_flight);
4007 if (stcb->asoc.peers_rwnd > 0 ||
4008 !TAILQ_EMPTY(&stcb->asoc.control_send_queue) ||
4009 (stcb->asoc.peers_rwnd <= 0 && stcb->asoc.total_flight == 0)) {
4015 sctp_chunk_output(inp, stcb, 3);
4025 sctp_auditing(2, inp, stcb, net);
4027 SCTP_TCB_UNLOCK(stcb);
4063 struct sctp_tcb *stcb = NULL;
4150 stcb = sctp_findassociation_addr(m, iphlen,
4153 if ((inp) && (stcb)) {
4154 sctp_send_packet_dropped(stcb, net, m, iphlen,
4156 sctp_chunk_output(inp, stcb, 2);
4157 } else if ((inp != NULL) && (stcb == NULL)) {
4188 stcb = sctp_findassociation_addr(m, iphlen, offset - sizeof(*ch),
4190 /* inp's ref-count increased && stcb locked */
4222 } else if (stcb == NULL) {
4257 inp, stcb, net, ecn_bits);
4258 /* inp's ref-count reduced && stcb unlocked */
4271 if (stcb) {
4272 SCTP_TCB_UNLOCK(stcb);