sctp_input.c (179157) | sctp_input.c (179783) |
---|---|
1/*- 2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * a) Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. --- 17 unchanged lines hidden (view full) --- 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31/* $KAME: sctp_input.c,v 1.27 2005/03/06 16:04:17 itojun Exp $ */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * a) Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. --- 17 unchanged lines hidden (view full) --- 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31/* $KAME: sctp_input.c,v 1.27 2005/03/06 16:04:17 itojun Exp $ */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 179157 2008-05-20 13:47:46Z rrs $"); | 34__FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 179783 2008-06-14 07:58:05Z rrs $"); |
35 36#include <netinet/sctp_os.h> 37#include <netinet/sctp_var.h> 38#include <netinet/sctp_sysctl.h> 39#include <netinet/sctp_pcb.h> 40#include <netinet/sctp_header.h> 41#include <netinet/sctputil.h> 42#include <netinet/sctp_output.h> --- 219 unchanged lines hidden (view full) --- 262 /* save off parameters */ 263 asoc->peer_vtag = ntohl(init->initiate_tag); 264 asoc->peers_rwnd = ntohl(init->a_rwnd); 265 if (TAILQ_FIRST(&asoc->nets)) { 266 /* update any ssthresh's that may have a default */ 267 TAILQ_FOREACH(lnet, &asoc->nets, sctp_next) { 268 lnet->ssthresh = asoc->peers_rwnd; 269 | 35 36#include <netinet/sctp_os.h> 37#include <netinet/sctp_var.h> 38#include <netinet/sctp_sysctl.h> 39#include <netinet/sctp_pcb.h> 40#include <netinet/sctp_header.h> 41#include <netinet/sctputil.h> 42#include <netinet/sctp_output.h> --- 219 unchanged lines hidden (view full) --- 262 /* save off parameters */ 263 asoc->peer_vtag = ntohl(init->initiate_tag); 264 asoc->peers_rwnd = ntohl(init->a_rwnd); 265 if (TAILQ_FIRST(&asoc->nets)) { 266 /* update any ssthresh's that may have a default */ 267 TAILQ_FOREACH(lnet, &asoc->nets, sctp_next) { 268 lnet->ssthresh = asoc->peers_rwnd; 269 |
270 if (sctp_logging_level & (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) { | 270 if (SCTP_BASE_SYSCTL(sctp_logging_level) & (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) { |
271 sctp_log_cwnd(stcb, lnet, 0, SCTP_CWND_INITIALIZATION); 272 } 273 } 274 } 275 SCTP_TCB_SEND_LOCK(stcb); 276 if (asoc->pre_open_streams > ntohs(init->num_inbound_streams)) { 277 unsigned int newcnt; 278 struct sctp_stream_out *outs; --- 32 unchanged lines hidden (view full) --- 311 } 312 /* cut back the count and abandon the upper streams */ 313 asoc->pre_open_streams = newcnt; 314 } 315 SCTP_TCB_SEND_UNLOCK(stcb); 316 asoc->streamoutcnt = asoc->pre_open_streams; 317 /* init tsn's */ 318 asoc->highest_tsn_inside_map = asoc->asconf_seq_in = ntohl(init->initial_tsn) - 1; | 271 sctp_log_cwnd(stcb, lnet, 0, SCTP_CWND_INITIALIZATION); 272 } 273 } 274 } 275 SCTP_TCB_SEND_LOCK(stcb); 276 if (asoc->pre_open_streams > ntohs(init->num_inbound_streams)) { 277 unsigned int newcnt; 278 struct sctp_stream_out *outs; --- 32 unchanged lines hidden (view full) --- 311 } 312 /* cut back the count and abandon the upper streams */ 313 asoc->pre_open_streams = newcnt; 314 } 315 SCTP_TCB_SEND_UNLOCK(stcb); 316 asoc->streamoutcnt = asoc->pre_open_streams; 317 /* init tsn's */ 318 asoc->highest_tsn_inside_map = asoc->asconf_seq_in = ntohl(init->initial_tsn) - 1; |
319 if (sctp_logging_level & SCTP_MAP_LOGGING_ENABLE) { | 319 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { |
320 sctp_log_map(0, 5, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT); 321 } 322 /* This is the next one we expect */ 323 asoc->str_reset_seq_in = asoc->asconf_seq_in + 1; 324 325 asoc->mapping_array_base_tsn = ntohl(init->initial_tsn); 326 asoc->cumulative_tsn = asoc->asconf_seq_in; 327 asoc->last_echo_tsn = asoc->asconf_seq_in; --- 113 unchanged lines hidden (view full) --- 441 stcb->asoc.peer_hmac_id = sctp_negotiate_hmacid(stcb->asoc.peer_hmacs, 442 stcb->asoc.local_hmacs); 443 if (op_err) { 444 sctp_queue_op_err(stcb, op_err); 445 /* queuing will steal away the mbuf chain to the out queue */ 446 op_err = NULL; 447 } 448 /* extract the cookie and queue it to "echo" it back... */ | 320 sctp_log_map(0, 5, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT); 321 } 322 /* This is the next one we expect */ 323 asoc->str_reset_seq_in = asoc->asconf_seq_in + 1; 324 325 asoc->mapping_array_base_tsn = ntohl(init->initial_tsn); 326 asoc->cumulative_tsn = asoc->asconf_seq_in; 327 asoc->last_echo_tsn = asoc->asconf_seq_in; --- 113 unchanged lines hidden (view full) --- 441 stcb->asoc.peer_hmac_id = sctp_negotiate_hmacid(stcb->asoc.peer_hmacs, 442 stcb->asoc.local_hmacs); 443 if (op_err) { 444 sctp_queue_op_err(stcb, op_err); 445 /* queuing will steal away the mbuf chain to the out queue */ 446 op_err = NULL; 447 } 448 /* extract the cookie and queue it to "echo" it back... */ |
449 if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { | 449 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { |
450 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 451 stcb->asoc.overall_error_count, 452 0, 453 SCTP_FROM_SCTP_INPUT, 454 __LINE__); 455 } 456 stcb->asoc.overall_error_count = 0; 457 net->error_count = 0; --- 133 unchanged lines hidden (view full) --- 591 } 592 /* 593 * JRS 5/14/07 - If CMT PF is on and the destination is in PF state, 594 * set the destination to active state and set the cwnd to one or 595 * two MTU's based on whether PF1 or PF2 is being used. If a T3 596 * timer is running, for the destination, stop the timer because a 597 * PF-heartbeat was received. 598 */ | 450 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 451 stcb->asoc.overall_error_count, 452 0, 453 SCTP_FROM_SCTP_INPUT, 454 __LINE__); 455 } 456 stcb->asoc.overall_error_count = 0; 457 net->error_count = 0; --- 133 unchanged lines hidden (view full) --- 591 } 592 /* 593 * JRS 5/14/07 - If CMT PF is on and the destination is in PF state, 594 * set the destination to active state and set the cwnd to one or 595 * two MTU's based on whether PF1 or PF2 is being used. If a T3 596 * timer is running, for the destination, stop the timer because a 597 * PF-heartbeat was received. 598 */ |
599 if (sctp_cmt_on_off && sctp_cmt_pf && (net->dest_state & SCTP_ADDR_PF) == 600 SCTP_ADDR_PF) { | 599 if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && 600 SCTP_BASE_SYSCTL(sctp_cmt_pf) && 601 (net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF) { |
601 if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { 602 sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, 603 stcb, net, 604 SCTP_FROM_SCTP_INPUT + SCTP_LOC_5); 605 } 606 net->dest_state &= ~SCTP_ADDR_PF; | 602 if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { 603 sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, 604 stcb, net, 605 SCTP_FROM_SCTP_INPUT + SCTP_LOC_5); 606 } 607 net->dest_state &= ~SCTP_ADDR_PF; |
607 net->cwnd = net->mtu * sctp_cmt_pf; | 608 net->cwnd = net->mtu * SCTP_BASE_SYSCTL(sctp_cmt_pf); |
608 SCTPDBG(SCTP_DEBUG_INPUT1, "Destination %p moved from PF to reachable with cwnd %d.\n", 609 net, net->cwnd); 610 } 611 /* Now lets do a RTO with this */ 612 r_net->RTO = sctp_calculate_rto(stcb, &stcb->asoc, r_net, &tv, sctp_align_safe_nocopy); 613 /* Mobility adaptation */ 614 if (req_prim) { 615 if ((sctp_is_mobility_feature_on(stcb->sctp_ep, --- 551 unchanged lines hidden (view full) --- 1167 /* error in parsing parameters */ 1168 return (-1); 1169 } 1170 /* update our state */ 1171 SCTPDBG(SCTP_DEBUG_INPUT2, "moving to COOKIE-ECHOED state\n"); 1172 SCTP_SET_STATE(&stcb->asoc, SCTP_STATE_COOKIE_ECHOED); 1173 1174 /* reset the RTO calc */ | 609 SCTPDBG(SCTP_DEBUG_INPUT1, "Destination %p moved from PF to reachable with cwnd %d.\n", 610 net, net->cwnd); 611 } 612 /* Now lets do a RTO with this */ 613 r_net->RTO = sctp_calculate_rto(stcb, &stcb->asoc, r_net, &tv, sctp_align_safe_nocopy); 614 /* Mobility adaptation */ 615 if (req_prim) { 616 if ((sctp_is_mobility_feature_on(stcb->sctp_ep, --- 551 unchanged lines hidden (view full) --- 1168 /* error in parsing parameters */ 1169 return (-1); 1170 } 1171 /* update our state */ 1172 SCTPDBG(SCTP_DEBUG_INPUT2, "moving to COOKIE-ECHOED state\n"); 1173 SCTP_SET_STATE(&stcb->asoc, SCTP_STATE_COOKIE_ECHOED); 1174 1175 /* reset the RTO calc */ |
1175 if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { | 1176 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { |
1176 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 1177 stcb->asoc.overall_error_count, 1178 0, 1179 SCTP_FROM_SCTP_INPUT, 1180 __LINE__); 1181 } 1182 stcb->asoc.overall_error_count = 0; 1183 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); --- 491 unchanged lines hidden (view full) --- 1675 } 1676 /* process the INIT-ACK info (my info) */ 1677 asoc->my_vtag = ntohl(initack_cp->init.initiate_tag); 1678 asoc->my_rwnd = ntohl(initack_cp->init.a_rwnd); 1679 1680 /* pull from vtag hash */ 1681 LIST_REMOVE(stcb, sctp_asocs); 1682 /* re-insert to new vtag position */ | 1177 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 1178 stcb->asoc.overall_error_count, 1179 0, 1180 SCTP_FROM_SCTP_INPUT, 1181 __LINE__); 1182 } 1183 stcb->asoc.overall_error_count = 0; 1184 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); --- 491 unchanged lines hidden (view full) --- 1676 } 1677 /* process the INIT-ACK info (my info) */ 1678 asoc->my_vtag = ntohl(initack_cp->init.initiate_tag); 1679 asoc->my_rwnd = ntohl(initack_cp->init.a_rwnd); 1680 1681 /* pull from vtag hash */ 1682 LIST_REMOVE(stcb, sctp_asocs); 1683 /* re-insert to new vtag position */ |
1683 head = &sctppcbinfo.sctp_asochash[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, 1684 sctppcbinfo.hashasocmark)]; | 1684 head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, 1685 SCTP_BASE_INFO(hashasocmark))]; |
1685 /* 1686 * put it in the bucket in the vtag hash of assoc's for the 1687 * system 1688 */ 1689 LIST_INSERT_HEAD(head, stcb, sctp_asocs); 1690 1691 /* Is this the first restart? */ 1692 if (stcb->asoc.in_restart_hash == 0) { 1693 /* Ok add it to assoc_id vtag hash */ | 1686 /* 1687 * put it in the bucket in the vtag hash of assoc's for the 1688 * system 1689 */ 1690 LIST_INSERT_HEAD(head, stcb, sctp_asocs); 1691 1692 /* Is this the first restart? */ 1693 if (stcb->asoc.in_restart_hash == 0) { 1694 /* Ok add it to assoc_id vtag hash */ |
1694 head = &sctppcbinfo.sctp_restarthash[SCTP_PCBHASH_ASOC(stcb->asoc.assoc_id, 1695 sctppcbinfo.hashrestartmark)]; | 1695 head = &SCTP_BASE_INFO(sctp_restarthash)[SCTP_PCBHASH_ASOC(stcb->asoc.assoc_id, 1696 SCTP_BASE_INFO(hashrestartmark))]; |
1696 LIST_INSERT_HEAD(head, stcb, sctp_tcbrestarhash); 1697 stcb->asoc.in_restart_hash = 1; 1698 } 1699 /* process the INIT info (peer's info) */ 1700 SCTP_TCB_SEND_UNLOCK(stcb); 1701 SCTP_INP_WUNLOCK(stcb->sctp_ep); 1702 SCTP_INP_INFO_WUNLOCK(); 1703 --- 498 unchanged lines hidden (view full) --- 2202 return (NULL); 2203 } 2204 m_sig = m_split(m, sig_offset, M_DONTWAIT); 2205 if (m_sig == NULL) { 2206 /* out of memory or ?? */ 2207 return (NULL); 2208 } 2209#ifdef SCTP_MBUF_LOGGING | 1697 LIST_INSERT_HEAD(head, stcb, sctp_tcbrestarhash); 1698 stcb->asoc.in_restart_hash = 1; 1699 } 1700 /* process the INIT info (peer's info) */ 1701 SCTP_TCB_SEND_UNLOCK(stcb); 1702 SCTP_INP_WUNLOCK(stcb->sctp_ep); 1703 SCTP_INP_INFO_WUNLOCK(); 1704 --- 498 unchanged lines hidden (view full) --- 2203 return (NULL); 2204 } 2205 m_sig = m_split(m, sig_offset, M_DONTWAIT); 2206 if (m_sig == NULL) { 2207 /* out of memory or ?? */ 2208 return (NULL); 2209 } 2210#ifdef SCTP_MBUF_LOGGING |
2210 if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) { | 2211 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { |
2211 struct mbuf *mat; 2212 2213 mat = m_sig; 2214 while (mat) { 2215 if (SCTP_BUF_IS_EXTENDED(mat)) { 2216 sctp_log_mb(mat, SCTP_MBUF_SPLIT); 2217 } 2218 mat = SCTP_BUF_NEXT(mat); --- 743 unchanged lines hidden (view full) --- 2962 2963 /* restart the timer */ 2964 sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, 2965 stcb, tp1->whoTo, SCTP_FROM_SCTP_INPUT + SCTP_LOC_24); 2966 sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, 2967 stcb, tp1->whoTo); 2968 2969 /* fix counts and things */ | 2212 struct mbuf *mat; 2213 2214 mat = m_sig; 2215 while (mat) { 2216 if (SCTP_BUF_IS_EXTENDED(mat)) { 2217 sctp_log_mb(mat, SCTP_MBUF_SPLIT); 2218 } 2219 mat = SCTP_BUF_NEXT(mat); --- 743 unchanged lines hidden (view full) --- 2963 2964 /* restart the timer */ 2965 sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, 2966 stcb, tp1->whoTo, SCTP_FROM_SCTP_INPUT + SCTP_LOC_24); 2967 sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, 2968 stcb, tp1->whoTo); 2969 2970 /* fix counts and things */ |
2970 if (sctp_logging_level & SCTP_FLIGHT_LOGGING_ENABLE) { | 2971 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FLIGHT_LOGGING_ENABLE) { |
2971 sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_PDRP, 2972 tp1->whoTo->flight_size, 2973 tp1->book_size, 2974 (uintptr_t) stcb, 2975 tp1->rec.data.TSN_seq); 2976 } 2977 sctp_flight_size_decrease(tp1); 2978 sctp_total_flight_decrease(stcb, tp1); --- 301 unchanged lines hidden (view full) --- 3280 fwdtsn.ch.chunk_length = htons(sizeof(struct sctp_forward_tsn_chunk)); 3281 fwdtsn.ch.chunk_type = SCTP_FORWARD_CUM_TSN; 3282 fwdtsn.new_cumulative_tsn = htonl(ntohl(resp->senders_next_tsn) - 1); 3283 sctp_handle_forward_tsn(stcb, &fwdtsn, &abort_flag, NULL, 0); 3284 if (abort_flag) { 3285 return (1); 3286 } 3287 stcb->asoc.highest_tsn_inside_map = (ntohl(resp->senders_next_tsn) - 1); | 2972 sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_PDRP, 2973 tp1->whoTo->flight_size, 2974 tp1->book_size, 2975 (uintptr_t) stcb, 2976 tp1->rec.data.TSN_seq); 2977 } 2978 sctp_flight_size_decrease(tp1); 2979 sctp_total_flight_decrease(stcb, tp1); --- 301 unchanged lines hidden (view full) --- 3281 fwdtsn.ch.chunk_length = htons(sizeof(struct sctp_forward_tsn_chunk)); 3282 fwdtsn.ch.chunk_type = SCTP_FORWARD_CUM_TSN; 3283 fwdtsn.new_cumulative_tsn = htonl(ntohl(resp->senders_next_tsn) - 1); 3284 sctp_handle_forward_tsn(stcb, &fwdtsn, &abort_flag, NULL, 0); 3285 if (abort_flag) { 3286 return (1); 3287 } 3288 stcb->asoc.highest_tsn_inside_map = (ntohl(resp->senders_next_tsn) - 1); |
3289 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { 3290 sctp_log_map(0, 7, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT); 3291 } |
|
3288 stcb->asoc.cumulative_tsn = stcb->asoc.highest_tsn_inside_map; 3289 stcb->asoc.mapping_array_base_tsn = ntohl(resp->senders_next_tsn); 3290 memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size); 3291 stcb->asoc.sending_seq = ntohl(resp->receivers_next_tsn); 3292 stcb->asoc.last_acked_seq = stcb->asoc.cumulative_tsn; 3293 3294 sctp_reset_out_streams(stcb, 0, (uint16_t *) NULL); 3295 sctp_reset_in_stream(stcb, 0, (uint16_t *) NULL); --- 87 unchanged lines hidden (view full) --- 3383 fwdtsn.ch.chunk_type = SCTP_FORWARD_CUM_TSN; 3384 fwdtsn.ch.chunk_flags = 0; 3385 fwdtsn.new_cumulative_tsn = htonl(stcb->asoc.highest_tsn_inside_map + 1); 3386 sctp_handle_forward_tsn(stcb, &fwdtsn, &abort_flag, NULL, 0); 3387 if (abort_flag) { 3388 return (1); 3389 } 3390 stcb->asoc.highest_tsn_inside_map += SCTP_STREAM_RESET_TSN_DELTA; | 3292 stcb->asoc.cumulative_tsn = stcb->asoc.highest_tsn_inside_map; 3293 stcb->asoc.mapping_array_base_tsn = ntohl(resp->senders_next_tsn); 3294 memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size); 3295 stcb->asoc.sending_seq = ntohl(resp->receivers_next_tsn); 3296 stcb->asoc.last_acked_seq = stcb->asoc.cumulative_tsn; 3297 3298 sctp_reset_out_streams(stcb, 0, (uint16_t *) NULL); 3299 sctp_reset_in_stream(stcb, 0, (uint16_t *) NULL); --- 87 unchanged lines hidden (view full) --- 3387 fwdtsn.ch.chunk_type = SCTP_FORWARD_CUM_TSN; 3388 fwdtsn.ch.chunk_flags = 0; 3389 fwdtsn.new_cumulative_tsn = htonl(stcb->asoc.highest_tsn_inside_map + 1); 3390 sctp_handle_forward_tsn(stcb, &fwdtsn, &abort_flag, NULL, 0); 3391 if (abort_flag) { 3392 return (1); 3393 } 3394 stcb->asoc.highest_tsn_inside_map += SCTP_STREAM_RESET_TSN_DELTA; |
3395 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { 3396 sctp_log_map(0, 10, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT); 3397 } |
|
3391 stcb->asoc.cumulative_tsn = stcb->asoc.highest_tsn_inside_map; 3392 stcb->asoc.mapping_array_base_tsn = stcb->asoc.highest_tsn_inside_map + 1; 3393 memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size); 3394 atomic_add_int(&stcb->asoc.sending_seq, 1); 3395 /* save off historical data for retrans */ 3396 stcb->asoc.last_sending_seq[1] = stcb->asoc.last_sending_seq[0]; 3397 stcb->asoc.last_sending_seq[0] = stcb->asoc.sending_seq; 3398 stcb->asoc.last_base_tsnsent[1] = stcb->asoc.last_base_tsnsent[0]; --- 477 unchanged lines hidden (view full) --- 3876 } 3877 } else if (ch->chunk_type != SCTP_COOKIE_ECHO) { 3878 /* 3879 * If there is no stcb, skip the AUTH chunk and process 3880 * later after a stcb is found (to validate the lookup was 3881 * valid. 3882 */ 3883 if ((ch->chunk_type == SCTP_AUTHENTICATION) && | 3398 stcb->asoc.cumulative_tsn = stcb->asoc.highest_tsn_inside_map; 3399 stcb->asoc.mapping_array_base_tsn = stcb->asoc.highest_tsn_inside_map + 1; 3400 memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size); 3401 atomic_add_int(&stcb->asoc.sending_seq, 1); 3402 /* save off historical data for retrans */ 3403 stcb->asoc.last_sending_seq[1] = stcb->asoc.last_sending_seq[0]; 3404 stcb->asoc.last_sending_seq[0] = stcb->asoc.sending_seq; 3405 stcb->asoc.last_base_tsnsent[1] = stcb->asoc.last_base_tsnsent[0]; --- 477 unchanged lines hidden (view full) --- 3883 } 3884 } else if (ch->chunk_type != SCTP_COOKIE_ECHO) { 3885 /* 3886 * If there is no stcb, skip the AUTH chunk and process 3887 * later after a stcb is found (to validate the lookup was 3888 * valid. 3889 */ 3890 if ((ch->chunk_type == SCTP_AUTHENTICATION) && |
3884 (stcb == NULL) && !sctp_auth_disable) { | 3891 (stcb == NULL) && 3892 !SCTP_BASE_SYSCTL(sctp_auth_disable)) { |
3885 /* save this chunk for later processing */ 3886 auth_skipped = 1; 3887 auth_offset = *offset; 3888 auth_len = ntohs(ch->chunk_length); 3889 3890 /* (temporarily) move past this chunk */ 3891 *offset += SCTP_SIZE32(auth_len); 3892 if (*offset >= length) { --- 136 unchanged lines hidden (view full) --- 4029 } /* end if !SCTP_COOKIE_ECHO */ 4030 /* 4031 * process all control chunks... 4032 */ 4033 if (((ch->chunk_type == SCTP_SELECTIVE_ACK) || 4034 (ch->chunk_type == SCTP_HEARTBEAT_REQUEST)) && 4035 (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_ECHOED)) { 4036 /* implied cookie-ack.. we must have lost the ack */ | 3893 /* save this chunk for later processing */ 3894 auth_skipped = 1; 3895 auth_offset = *offset; 3896 auth_len = ntohs(ch->chunk_length); 3897 3898 /* (temporarily) move past this chunk */ 3899 *offset += SCTP_SIZE32(auth_len); 3900 if (*offset >= length) { --- 136 unchanged lines hidden (view full) --- 4037 } /* end if !SCTP_COOKIE_ECHO */ 4038 /* 4039 * process all control chunks... 4040 */ 4041 if (((ch->chunk_type == SCTP_SELECTIVE_ACK) || 4042 (ch->chunk_type == SCTP_HEARTBEAT_REQUEST)) && 4043 (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_ECHOED)) { 4044 /* implied cookie-ack.. we must have lost the ack */ |
4037 if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { | 4045 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { |
4038 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4039 stcb->asoc.overall_error_count, 4040 0, 4041 SCTP_FROM_SCTP_INPUT, 4042 __LINE__); 4043 } 4044 stcb->asoc.overall_error_count = 0; 4045 sctp_handle_cookie_ack((struct sctp_cookie_ack_chunk *)ch, stcb, --- 82 unchanged lines hidden (view full) --- 4128 stcb->asoc.last_control_chunk_from = *netp; 4129 } 4130 } 4131#ifdef SCTP_AUDITING_ENABLED 4132 sctp_audit_log(0xB0, ch->chunk_type); 4133#endif 4134 4135 /* check to see if this chunk required auth, but isn't */ | 4046 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4047 stcb->asoc.overall_error_count, 4048 0, 4049 SCTP_FROM_SCTP_INPUT, 4050 __LINE__); 4051 } 4052 stcb->asoc.overall_error_count = 0; 4053 sctp_handle_cookie_ack((struct sctp_cookie_ack_chunk *)ch, stcb, --- 82 unchanged lines hidden (view full) --- 4136 stcb->asoc.last_control_chunk_from = *netp; 4137 } 4138 } 4139#ifdef SCTP_AUDITING_ENABLED 4140 sctp_audit_log(0xB0, ch->chunk_type); 4141#endif 4142 4143 /* check to see if this chunk required auth, but isn't */ |
4136 if ((stcb != NULL) && !sctp_auth_disable && 4137 sctp_auth_is_required_chunk(ch->chunk_type, 4138 stcb->asoc.local_auth_chunks) && | 4144 if ((stcb != NULL) && 4145 !SCTP_BASE_SYSCTL(sctp_auth_disable) && 4146 sctp_auth_is_required_chunk(ch->chunk_type, stcb->asoc.local_auth_chunks) && |
4139 !stcb->asoc.authenticated) { 4140 /* "silently" ignore */ 4141 SCTP_STAT_INCR(sctps_recvauthmissing); 4142 goto next_chunk; 4143 } 4144 switch (ch->chunk_type) { 4145 case SCTP_INITIATION: 4146 /* must be first and only chunk */ --- 11 unchanged lines hidden (view full) --- 4158 SCTP_TCB_UNLOCK(locked_tcb); 4159 } 4160 *offset = length; 4161 return (NULL); 4162 } 4163 } 4164 if ((chk_length > SCTP_LARGEST_INIT_ACCEPTED) || 4165 (num_chunks > 1) || | 4147 !stcb->asoc.authenticated) { 4148 /* "silently" ignore */ 4149 SCTP_STAT_INCR(sctps_recvauthmissing); 4150 goto next_chunk; 4151 } 4152 switch (ch->chunk_type) { 4153 case SCTP_INITIATION: 4154 /* must be first and only chunk */ --- 11 unchanged lines hidden (view full) --- 4166 SCTP_TCB_UNLOCK(locked_tcb); 4167 } 4168 *offset = length; 4169 return (NULL); 4170 } 4171 } 4172 if ((chk_length > SCTP_LARGEST_INIT_ACCEPTED) || 4173 (num_chunks > 1) || |
4166 (sctp_strict_init && (length - *offset > (int)SCTP_SIZE32(chk_length)))) { | 4174 (SCTP_BASE_SYSCTL(sctp_strict_init) && (length - *offset > (int)SCTP_SIZE32(chk_length)))) { |
4167 *offset = length; 4168 if (locked_tcb) { 4169 SCTP_TCB_UNLOCK(locked_tcb); 4170 } 4171 return (NULL); 4172 } 4173 if ((stcb != NULL) && 4174 (SCTP_GET_STATE(&stcb->asoc) == --- 48 unchanged lines hidden (view full) --- 4223#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) 4224 SCTP_SOCKET_UNLOCK(so, 1); 4225#endif 4226 } 4227 return (NULL); 4228 } 4229 } 4230 if ((num_chunks > 1) || | 4175 *offset = length; 4176 if (locked_tcb) { 4177 SCTP_TCB_UNLOCK(locked_tcb); 4178 } 4179 return (NULL); 4180 } 4181 if ((stcb != NULL) && 4182 (SCTP_GET_STATE(&stcb->asoc) == --- 48 unchanged lines hidden (view full) --- 4231#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) 4232 SCTP_SOCKET_UNLOCK(so, 1); 4233#endif 4234 } 4235 return (NULL); 4236 } 4237 } 4238 if ((num_chunks > 1) || |
4231 (sctp_strict_init && (length - *offset > (int)SCTP_SIZE32(chk_length)))) { | 4239 (SCTP_BASE_SYSCTL(sctp_strict_init) && (length - *offset > (int)SCTP_SIZE32(chk_length)))) { |
4232 *offset = length; 4233 if (locked_tcb) { 4234 SCTP_TCB_UNLOCK(locked_tcb); 4235 } 4236 return (NULL); 4237 } 4238 if ((netp) && (*netp)) { 4239 ret = sctp_handle_init_ack(m, iphlen, *offset, sh, --- 87 unchanged lines hidden (view full) --- 4327 case SCTP_HEARTBEAT_REQUEST: 4328 SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_HEARTBEAT\n"); 4329 if ((stcb) && netp && *netp) { 4330 SCTP_STAT_INCR(sctps_recvheartbeat); 4331 sctp_send_heartbeat_ack(stcb, m, *offset, 4332 chk_length, *netp); 4333 4334 /* He's alive so give him credit */ | 4240 *offset = length; 4241 if (locked_tcb) { 4242 SCTP_TCB_UNLOCK(locked_tcb); 4243 } 4244 return (NULL); 4245 } 4246 if ((netp) && (*netp)) { 4247 ret = sctp_handle_init_ack(m, iphlen, *offset, sh, --- 87 unchanged lines hidden (view full) --- 4335 case SCTP_HEARTBEAT_REQUEST: 4336 SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_HEARTBEAT\n"); 4337 if ((stcb) && netp && *netp) { 4338 SCTP_STAT_INCR(sctps_recvheartbeat); 4339 sctp_send_heartbeat_ack(stcb, m, *offset, 4340 chk_length, *netp); 4341 4342 /* He's alive so give him credit */ |
4335 if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { | 4343 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { |
4336 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4337 stcb->asoc.overall_error_count, 4338 0, 4339 SCTP_FROM_SCTP_INPUT, 4340 __LINE__); 4341 } 4342 stcb->asoc.overall_error_count = 0; 4343 } --- 4 unchanged lines hidden (view full) --- 4348 /* Its not ours */ 4349 *offset = length; 4350 if (locked_tcb) { 4351 SCTP_TCB_UNLOCK(locked_tcb); 4352 } 4353 return (NULL); 4354 } 4355 /* He's alive so give him credit */ | 4344 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4345 stcb->asoc.overall_error_count, 4346 0, 4347 SCTP_FROM_SCTP_INPUT, 4348 __LINE__); 4349 } 4350 stcb->asoc.overall_error_count = 0; 4351 } --- 4 unchanged lines hidden (view full) --- 4356 /* Its not ours */ 4357 *offset = length; 4358 if (locked_tcb) { 4359 SCTP_TCB_UNLOCK(locked_tcb); 4360 } 4361 return (NULL); 4362 } 4363 /* He's alive so give him credit */ |
4356 if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { | 4364 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { |
4357 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4358 stcb->asoc.overall_error_count, 4359 0, 4360 SCTP_FROM_SCTP_INPUT, 4361 __LINE__); 4362 } 4363 stcb->asoc.overall_error_count = 0; 4364 SCTP_STAT_INCR(sctps_recvheartbeatack); --- 64 unchanged lines hidden (view full) --- 4429 * sincen it is possible that a previous endpoint 4430 * WAS listening responded to a INIT-ACK and then 4431 * closed. We opened and bound.. and are now no 4432 * longer listening. 4433 */ 4434 4435 if ((stcb == NULL) && (inp->sctp_socket->so_qlen >= inp->sctp_socket->so_qlimit)) { 4436 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && | 4365 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4366 stcb->asoc.overall_error_count, 4367 0, 4368 SCTP_FROM_SCTP_INPUT, 4369 __LINE__); 4370 } 4371 stcb->asoc.overall_error_count = 0; 4372 SCTP_STAT_INCR(sctps_recvheartbeatack); --- 64 unchanged lines hidden (view full) --- 4437 * sincen it is possible that a previous endpoint 4438 * WAS listening responded to a INIT-ACK and then 4439 * closed. We opened and bound.. and are now no 4440 * longer listening. 4441 */ 4442 4443 if ((stcb == NULL) && (inp->sctp_socket->so_qlen >= inp->sctp_socket->so_qlimit)) { 4444 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && |
4437 (sctp_abort_if_one_2_one_hits_limit)) { | 4445 (SCTP_BASE_SYSCTL(sctp_abort_if_one_2_one_hits_limit))) { |
4438 struct mbuf *oper; 4439 struct sctp_paramhdr *phdr; 4440 4441 oper = sctp_get_mbuf_for_msg(sizeof(struct sctp_paramhdr), 4442 0, M_DONTWAIT, 1, MT_DATA); 4443 if (oper) { 4444 SCTP_BUF_LEN(oper) = 4445 sizeof(struct sctp_paramhdr); --- 97 unchanged lines hidden (view full) --- 4543 SCTP_SOCKET_UNLOCK(so, 1); 4544#endif 4545 *offset = length; 4546 return (NULL); 4547 } 4548 } 4549 /* He's alive so give him credit */ 4550 if ((stcb) && netp && *netp) { | 4446 struct mbuf *oper; 4447 struct sctp_paramhdr *phdr; 4448 4449 oper = sctp_get_mbuf_for_msg(sizeof(struct sctp_paramhdr), 4450 0, M_DONTWAIT, 1, MT_DATA); 4451 if (oper) { 4452 SCTP_BUF_LEN(oper) = 4453 sizeof(struct sctp_paramhdr); --- 97 unchanged lines hidden (view full) --- 4551 SCTP_SOCKET_UNLOCK(so, 1); 4552#endif 4553 *offset = length; 4554 return (NULL); 4555 } 4556 } 4557 /* He's alive so give him credit */ 4558 if ((stcb) && netp && *netp) { |
4551 if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { | 4559 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { |
4552 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4553 stcb->asoc.overall_error_count, 4554 0, 4555 SCTP_FROM_SCTP_INPUT, 4556 __LINE__); 4557 } 4558 stcb->asoc.overall_error_count = 0; 4559 sctp_handle_cookie_ack((struct sctp_cookie_ack_chunk *)ch, stcb, *netp); --- 6 unchanged lines hidden (view full) --- 4566 /* Its not ours */ 4567 if (locked_tcb) { 4568 SCTP_TCB_UNLOCK(locked_tcb); 4569 } 4570 *offset = length; 4571 return (NULL); 4572 } 4573 if (stcb) { | 4560 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4561 stcb->asoc.overall_error_count, 4562 0, 4563 SCTP_FROM_SCTP_INPUT, 4564 __LINE__); 4565 } 4566 stcb->asoc.overall_error_count = 0; 4567 sctp_handle_cookie_ack((struct sctp_cookie_ack_chunk *)ch, stcb, *netp); --- 6 unchanged lines hidden (view full) --- 4574 /* Its not ours */ 4575 if (locked_tcb) { 4576 SCTP_TCB_UNLOCK(locked_tcb); 4577 } 4578 *offset = length; 4579 return (NULL); 4580 } 4581 if (stcb) { |
4574 if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { | 4582 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { |
4575 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4576 stcb->asoc.overall_error_count, 4577 0, 4578 SCTP_FROM_SCTP_INPUT, 4579 __LINE__); 4580 } 4581 stcb->asoc.overall_error_count = 0; 4582 sctp_handle_ecn_echo((struct sctp_ecne_chunk *)ch, --- 7 unchanged lines hidden (view full) --- 4590 /* Its not ours */ 4591 if (locked_tcb) { 4592 SCTP_TCB_UNLOCK(locked_tcb); 4593 } 4594 *offset = length; 4595 return (NULL); 4596 } 4597 if (stcb) { | 4583 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4584 stcb->asoc.overall_error_count, 4585 0, 4586 SCTP_FROM_SCTP_INPUT, 4587 __LINE__); 4588 } 4589 stcb->asoc.overall_error_count = 0; 4590 sctp_handle_ecn_echo((struct sctp_ecne_chunk *)ch, --- 7 unchanged lines hidden (view full) --- 4598 /* Its not ours */ 4599 if (locked_tcb) { 4600 SCTP_TCB_UNLOCK(locked_tcb); 4601 } 4602 *offset = length; 4603 return (NULL); 4604 } 4605 if (stcb) { |
4598 if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { | 4606 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { |
4599 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4600 stcb->asoc.overall_error_count, 4601 0, 4602 SCTP_FROM_SCTP_INPUT, 4603 __LINE__); 4604 } 4605 stcb->asoc.overall_error_count = 0; 4606 sctp_handle_ecn_cwr((struct sctp_cwr_chunk *)ch, stcb); --- 16 unchanged lines hidden (view full) --- 4623 } 4624 *offset = length; 4625 return (NULL); 4626 break; 4627 case SCTP_ASCONF: 4628 SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ASCONF\n"); 4629 /* He's alive so give him credit */ 4630 if (stcb) { | 4607 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4608 stcb->asoc.overall_error_count, 4609 0, 4610 SCTP_FROM_SCTP_INPUT, 4611 __LINE__); 4612 } 4613 stcb->asoc.overall_error_count = 0; 4614 sctp_handle_ecn_cwr((struct sctp_cwr_chunk *)ch, stcb); --- 16 unchanged lines hidden (view full) --- 4631 } 4632 *offset = length; 4633 return (NULL); 4634 break; 4635 case SCTP_ASCONF: 4636 SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ASCONF\n"); 4637 /* He's alive so give him credit */ 4638 if (stcb) { |
4631 if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { | 4639 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { |
4632 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4633 stcb->asoc.overall_error_count, 4634 0, 4635 SCTP_FROM_SCTP_INPUT, 4636 __LINE__); 4637 } 4638 stcb->asoc.overall_error_count = 0; 4639 sctp_handle_asconf(m, *offset, --- 8 unchanged lines hidden (view full) --- 4648 if (locked_tcb) { 4649 SCTP_TCB_UNLOCK(locked_tcb); 4650 } 4651 *offset = length; 4652 return (NULL); 4653 } 4654 if ((stcb) && netp && *netp) { 4655 /* He's alive so give him credit */ | 4640 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4641 stcb->asoc.overall_error_count, 4642 0, 4643 SCTP_FROM_SCTP_INPUT, 4644 __LINE__); 4645 } 4646 stcb->asoc.overall_error_count = 0; 4647 sctp_handle_asconf(m, *offset, --- 8 unchanged lines hidden (view full) --- 4656 if (locked_tcb) { 4657 SCTP_TCB_UNLOCK(locked_tcb); 4658 } 4659 *offset = length; 4660 return (NULL); 4661 } 4662 if ((stcb) && netp && *netp) { 4663 /* He's alive so give him credit */ |
4656 if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { | 4664 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { |
4657 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4658 stcb->asoc.overall_error_count, 4659 0, 4660 SCTP_FROM_SCTP_INPUT, 4661 __LINE__); 4662 } 4663 stcb->asoc.overall_error_count = 0; 4664 sctp_handle_asconf_ack(m, *offset, --- 12 unchanged lines hidden (view full) --- 4677 *offset = length; 4678 return (NULL); 4679 } 4680 /* He's alive so give him credit */ 4681 if (stcb) { 4682 int abort_flag = 0; 4683 4684 stcb->asoc.overall_error_count = 0; | 4665 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4666 stcb->asoc.overall_error_count, 4667 0, 4668 SCTP_FROM_SCTP_INPUT, 4669 __LINE__); 4670 } 4671 stcb->asoc.overall_error_count = 0; 4672 sctp_handle_asconf_ack(m, *offset, --- 12 unchanged lines hidden (view full) --- 4685 *offset = length; 4686 return (NULL); 4687 } 4688 /* He's alive so give him credit */ 4689 if (stcb) { 4690 int abort_flag = 0; 4691 4692 stcb->asoc.overall_error_count = 0; |
4685 if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { | 4693 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { |
4686 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4687 stcb->asoc.overall_error_count, 4688 0, 4689 SCTP_FROM_SCTP_INPUT, 4690 __LINE__); 4691 } 4692 *fwd_tsn_seen = 1; 4693 if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { --- 14 unchanged lines hidden (view full) --- 4708 return (NULL); 4709 } 4710 sctp_handle_forward_tsn(stcb, 4711 (struct sctp_forward_tsn_chunk *)ch, &abort_flag, m, *offset); 4712 if (abort_flag) { 4713 *offset = length; 4714 return (NULL); 4715 } else { | 4694 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4695 stcb->asoc.overall_error_count, 4696 0, 4697 SCTP_FROM_SCTP_INPUT, 4698 __LINE__); 4699 } 4700 *fwd_tsn_seen = 1; 4701 if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { --- 14 unchanged lines hidden (view full) --- 4716 return (NULL); 4717 } 4718 sctp_handle_forward_tsn(stcb, 4719 (struct sctp_forward_tsn_chunk *)ch, &abort_flag, m, *offset); 4720 if (abort_flag) { 4721 *offset = length; 4722 return (NULL); 4723 } else { |
4716 if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { | 4724 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { |
4717 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4718 stcb->asoc.overall_error_count, 4719 0, 4720 SCTP_FROM_SCTP_INPUT, 4721 __LINE__); 4722 } 4723 stcb->asoc.overall_error_count = 0; 4724 } --- 57 unchanged lines hidden (view full) --- 4782 stcb, *netp, 4783 min(chk_length, (sizeof(chunk_buf) - 4))); 4784 4785 } 4786 break; 4787 4788 case SCTP_AUTHENTICATION: 4789 SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_AUTHENTICATION\n"); | 4725 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 4726 stcb->asoc.overall_error_count, 4727 0, 4728 SCTP_FROM_SCTP_INPUT, 4729 __LINE__); 4730 } 4731 stcb->asoc.overall_error_count = 0; 4732 } --- 57 unchanged lines hidden (view full) --- 4790 stcb, *netp, 4791 min(chk_length, (sizeof(chunk_buf) - 4))); 4792 4793 } 4794 break; 4795 4796 case SCTP_AUTHENTICATION: 4797 SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_AUTHENTICATION\n"); |
4790 if (sctp_auth_disable) | 4798 if (SCTP_BASE_SYSCTL(sctp_auth_disable)) |
4791 goto unknown_chunk; 4792 4793 if (stcb == NULL) { 4794 /* save the first AUTH for later processing */ 4795 if (auth_skipped == 0) { 4796 auth_offset = *offset; 4797 auth_len = chk_length; 4798 auth_skipped = 1; --- 47 unchanged lines hidden (view full) --- 4846 */ 4847 phd->param_type = htons(SCTP_CAUSE_UNRECOG_CHUNK); 4848 phd->param_length = htons(chk_length + sizeof(*phd)); 4849 SCTP_BUF_LEN(mm) = sizeof(*phd); 4850 SCTP_BUF_NEXT(mm) = SCTP_M_COPYM(m, *offset, SCTP_SIZE32(chk_length), 4851 M_DONTWAIT); 4852 if (SCTP_BUF_NEXT(mm)) { 4853#ifdef SCTP_MBUF_LOGGING | 4799 goto unknown_chunk; 4800 4801 if (stcb == NULL) { 4802 /* save the first AUTH for later processing */ 4803 if (auth_skipped == 0) { 4804 auth_offset = *offset; 4805 auth_len = chk_length; 4806 auth_skipped = 1; --- 47 unchanged lines hidden (view full) --- 4854 */ 4855 phd->param_type = htons(SCTP_CAUSE_UNRECOG_CHUNK); 4856 phd->param_length = htons(chk_length + sizeof(*phd)); 4857 SCTP_BUF_LEN(mm) = sizeof(*phd); 4858 SCTP_BUF_NEXT(mm) = SCTP_M_COPYM(m, *offset, SCTP_SIZE32(chk_length), 4859 M_DONTWAIT); 4860 if (SCTP_BUF_NEXT(mm)) { 4861#ifdef SCTP_MBUF_LOGGING |
4854 if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) { | 4862 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { |
4855 struct mbuf *mat; 4856 4857 mat = SCTP_BUF_NEXT(mm); 4858 while (mat) { 4859 if (SCTP_BUF_IS_EXTENDED(mat)) { 4860 sctp_log_mb(mat, SCTP_MBUF_ICOPY); 4861 } 4862 mat = SCTP_BUF_NEXT(mat); --- 137 unchanged lines hidden (view full) --- 5000 int un_sent; 5001 5002 SCTP_STAT_INCR(sctps_recvdatagrams); 5003#ifdef SCTP_AUDITING_ENABLED 5004 sctp_audit_log(0xE0, 1); 5005 sctp_auditing(0, inp, stcb, net); 5006#endif 5007 | 4863 struct mbuf *mat; 4864 4865 mat = SCTP_BUF_NEXT(mm); 4866 while (mat) { 4867 if (SCTP_BUF_IS_EXTENDED(mat)) { 4868 sctp_log_mb(mat, SCTP_MBUF_ICOPY); 4869 } 4870 mat = SCTP_BUF_NEXT(mat); --- 137 unchanged lines hidden (view full) --- 5008 int un_sent; 5009 5010 SCTP_STAT_INCR(sctps_recvdatagrams); 5011#ifdef SCTP_AUDITING_ENABLED 5012 sctp_audit_log(0xE0, 1); 5013 sctp_auditing(0, inp, stcb, net); 5014#endif 5015 |
5008 SCTPDBG(SCTP_DEBUG_INPUT1, "Ok, Common input processing called, m:%p iphlen:%d offset:%d stcb:%p\n", 5009 m, iphlen, offset, stcb); | 5016 SCTPDBG(SCTP_DEBUG_INPUT1, "Ok, Common input processing called, m:%p iphlen:%d offset:%d length:%d stcb:%p\n", 5017 m, iphlen, offset, length, stcb); |
5010 if (stcb) { 5011 /* always clear this before beginning a packet */ 5012 stcb->asoc.authenticated = 0; 5013 stcb->asoc.seen_a_sack_this_pkt = 0; 5014 SCTPDBG(SCTP_DEBUG_INPUT1, "stcb:%p state:%x\n", 5015 stcb, stcb->asoc.state); 5016 5017 if ((stcb->asoc.state & SCTP_STATE_WAS_ABORTED) || --- 16 unchanged lines hidden (view full) --- 5034 stcb = sctp_process_control(m, iphlen, &offset, length, sh, ch, 5035 inp, stcb, &net, &fwd_tsn_seen, vrf_id, port); 5036 if (stcb) { 5037 /* 5038 * This covers us if the cookie-echo was there and 5039 * it changes our INP. 5040 */ 5041 inp = stcb->sctp_ep; | 5018 if (stcb) { 5019 /* always clear this before beginning a packet */ 5020 stcb->asoc.authenticated = 0; 5021 stcb->asoc.seen_a_sack_this_pkt = 0; 5022 SCTPDBG(SCTP_DEBUG_INPUT1, "stcb:%p state:%x\n", 5023 stcb, stcb->asoc.state); 5024 5025 if ((stcb->asoc.state & SCTP_STATE_WAS_ABORTED) || --- 16 unchanged lines hidden (view full) --- 5042 stcb = sctp_process_control(m, iphlen, &offset, length, sh, ch, 5043 inp, stcb, &net, &fwd_tsn_seen, vrf_id, port); 5044 if (stcb) { 5045 /* 5046 * This covers us if the cookie-echo was there and 5047 * it changes our INP. 5048 */ 5049 inp = stcb->sctp_ep; |
5050 if ((net) && (port)) { 5051 if (net->port == 0) { 5052 sctp_pathmtu_adjustment(inp, stcb, net, net->mtu - sizeof(struct udphdr)); 5053 } 5054 net->port = port; 5055 } |
|
5042 } 5043 } else { 5044 /* 5045 * no control chunks, so pre-process DATA chunks (these 5046 * checks are taken care of by control processing) 5047 */ 5048 5049 /* 5050 * if DATA only packet, and auth is required, then punt... 5051 * can't have authenticated without any AUTH (control) 5052 * chunks 5053 */ | 5056 } 5057 } else { 5058 /* 5059 * no control chunks, so pre-process DATA chunks (these 5060 * checks are taken care of by control processing) 5061 */ 5062 5063 /* 5064 * if DATA only packet, and auth is required, then punt... 5065 * can't have authenticated without any AUTH (control) 5066 * chunks 5067 */ |
5054 if ((stcb != NULL) && !sctp_auth_disable && 5055 sctp_auth_is_required_chunk(SCTP_DATA, 5056 stcb->asoc.local_auth_chunks)) { | 5068 if ((stcb != NULL) && 5069 !SCTP_BASE_SYSCTL(sctp_auth_disable) && 5070 sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.local_auth_chunks)) { |
5057 /* "silently" ignore */ 5058 SCTP_STAT_INCR(sctps_recvauthmissing); 5059 SCTP_TCB_UNLOCK(stcb); 5060 goto out_now; 5061 } 5062 if (stcb == NULL) { 5063 /* out of the blue DATA chunk */ 5064 sctp_handle_ootb(m, iphlen, offset, sh, inp, NULL, --- 20 unchanged lines hidden (view full) --- 5085 * DATA chunk processing 5086 */ 5087 /* plow through the data chunks while length > offset */ 5088 5089 /* 5090 * Rest should be DATA only. Check authentication state if AUTH for 5091 * DATA is required. 5092 */ | 5071 /* "silently" ignore */ 5072 SCTP_STAT_INCR(sctps_recvauthmissing); 5073 SCTP_TCB_UNLOCK(stcb); 5074 goto out_now; 5075 } 5076 if (stcb == NULL) { 5077 /* out of the blue DATA chunk */ 5078 sctp_handle_ootb(m, iphlen, offset, sh, inp, NULL, --- 20 unchanged lines hidden (view full) --- 5099 * DATA chunk processing 5100 */ 5101 /* plow through the data chunks while length > offset */ 5102 5103 /* 5104 * Rest should be DATA only. Check authentication state if AUTH for 5105 * DATA is required. 5106 */ |
5093 if ((length > offset) && (stcb != NULL) && !sctp_auth_disable && 5094 sctp_auth_is_required_chunk(SCTP_DATA, 5095 stcb->asoc.local_auth_chunks) && | 5107 if ((length > offset) && 5108 (stcb != NULL) && 5109 !SCTP_BASE_SYSCTL(sctp_auth_disable) && 5110 sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.local_auth_chunks) && |
5096 !stcb->asoc.authenticated) { 5097 /* "silently" ignore */ 5098 SCTP_STAT_INCR(sctps_recvauthmissing); 5099 SCTPDBG(SCTP_DEBUG_AUTH1, 5100 "Data chunk requires AUTH, skipped\n"); 5101 goto trigger_send; 5102 } 5103 if (length > offset) { --- 6 unchanged lines hidden (view full) --- 5110 */ 5111 switch (SCTP_GET_STATE(&stcb->asoc)) { 5112 case SCTP_STATE_COOKIE_ECHOED: 5113 /* 5114 * we consider data with valid tags in this state 5115 * shows us the cookie-ack was lost. Imply it was 5116 * there. 5117 */ | 5111 !stcb->asoc.authenticated) { 5112 /* "silently" ignore */ 5113 SCTP_STAT_INCR(sctps_recvauthmissing); 5114 SCTPDBG(SCTP_DEBUG_AUTH1, 5115 "Data chunk requires AUTH, skipped\n"); 5116 goto trigger_send; 5117 } 5118 if (length > offset) { --- 6 unchanged lines hidden (view full) --- 5125 */ 5126 switch (SCTP_GET_STATE(&stcb->asoc)) { 5127 case SCTP_STATE_COOKIE_ECHOED: 5128 /* 5129 * we consider data with valid tags in this state 5130 * shows us the cookie-ack was lost. Imply it was 5131 * there. 5132 */ |
5118 if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { | 5133 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { |
5119 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 5120 stcb->asoc.overall_error_count, 5121 0, 5122 SCTP_FROM_SCTP_INPUT, 5123 __LINE__); 5124 } 5125 stcb->asoc.overall_error_count = 0; 5126 sctp_handle_cookie_ack((struct sctp_cookie_ack_chunk *)ch, stcb, net); --- 134 unchanged lines hidden (view full) --- 5261 5262 net = NULL; 5263 SCTP_STAT_INCR(sctps_recvpackets); 5264 SCTP_STAT_INCR_COUNTER64(sctps_inpackets); 5265 5266 5267#ifdef SCTP_MBUF_LOGGING 5268 /* Log in any input mbufs */ | 5134 sctp_misc_ints(SCTP_THRESHOLD_CLEAR, 5135 stcb->asoc.overall_error_count, 5136 0, 5137 SCTP_FROM_SCTP_INPUT, 5138 __LINE__); 5139 } 5140 stcb->asoc.overall_error_count = 0; 5141 sctp_handle_cookie_ack((struct sctp_cookie_ack_chunk *)ch, stcb, net); --- 134 unchanged lines hidden (view full) --- 5276 5277 net = NULL; 5278 SCTP_STAT_INCR(sctps_recvpackets); 5279 SCTP_STAT_INCR_COUNTER64(sctps_inpackets); 5280 5281 5282#ifdef SCTP_MBUF_LOGGING 5283 /* Log in any input mbufs */ |
5269 if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) { | 5284 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { |
5270 mat = m; 5271 while (mat) { 5272 if (SCTP_BUF_IS_EXTENDED(mat)) { 5273 sctp_log_mb(mat, SCTP_MBUF_INPUT); 5274 } 5275 mat = SCTP_BUF_NEXT(mat); 5276 } 5277 } 5278#endif 5279#ifdef SCTP_PACKET_LOGGING | 5285 mat = m; 5286 while (mat) { 5287 if (SCTP_BUF_IS_EXTENDED(mat)) { 5288 sctp_log_mb(mat, SCTP_MBUF_INPUT); 5289 } 5290 mat = SCTP_BUF_NEXT(mat); 5291 } 5292 } 5293#endif 5294#ifdef SCTP_PACKET_LOGGING |
5280 if (sctp_logging_level & SCTP_LAST_PACKET_TRACING) | 5295 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) |
5281 sctp_packet_log(m, mlen); 5282#endif 5283 /* 5284 * Must take out the iphlen, since mlen expects this (only effect lb 5285 * case) 5286 */ 5287 mlen -= iphlen; 5288 --- 22 unchanged lines hidden (view full) --- 5311 /* 5312 * We only look at broadcast if its a front state, All 5313 * others we will not have a tcb for anyway. 5314 */ 5315 goto bad; 5316 } 5317 /* validate SCTP checksum */ 5318 check = sh->checksum; /* save incoming checksum */ | 5296 sctp_packet_log(m, mlen); 5297#endif 5298 /* 5299 * Must take out the iphlen, since mlen expects this (only effect lb 5300 * case) 5301 */ 5302 mlen -= iphlen; 5303 --- 22 unchanged lines hidden (view full) --- 5326 /* 5327 * We only look at broadcast if its a front state, All 5328 * others we will not have a tcb for anyway. 5329 */ 5330 goto bad; 5331 } 5332 /* validate SCTP checksum */ 5333 check = sh->checksum; /* save incoming checksum */ |
5319 if ((check == 0) && (sctp_no_csum_on_loopback) && | 5334 if ((check == 0) && (SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback)) && |
5320 ((ip->ip_src.s_addr == ip->ip_dst.s_addr) || 5321 (SCTP_IS_IT_LOOPBACK(m))) 5322 ) { 5323 goto sctp_skip_csum_4; 5324 } 5325 sh->checksum = 0; /* prepare for calc */ 5326 calc_check = sctp_calculate_sum(m, &mlen, iphlen); 5327 if (calc_check != check) { --- 140 unchanged lines hidden --- | 5335 ((ip->ip_src.s_addr == ip->ip_dst.s_addr) || 5336 (SCTP_IS_IT_LOOPBACK(m))) 5337 ) { 5338 goto sctp_skip_csum_4; 5339 } 5340 sh->checksum = 0; /* prepare for calc */ 5341 calc_check = sctp_calculate_sum(m, &mlen, iphlen); 5342 if (calc_check != check) { --- 140 unchanged lines hidden --- |