Lines Matching refs:stcb

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