diff options
Diffstat (limited to 'sys/netinet/sctp_input.c')
-rw-r--r-- | sys/netinet/sctp_input.c | 103 |
1 files changed, 59 insertions, 44 deletions
diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 694d8ca..a6acb16 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -267,7 +267,7 @@ sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb, TAILQ_FOREACH(lnet, &asoc->nets, sctp_next) { lnet->ssthresh = asoc->peers_rwnd; - if (sctp_logging_level & (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) { sctp_log_cwnd(stcb, lnet, 0, SCTP_CWND_INITIALIZATION); } } @@ -316,7 +316,7 @@ sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb, asoc->streamoutcnt = asoc->pre_open_streams; /* init tsn's */ asoc->highest_tsn_inside_map = asoc->asconf_seq_in = ntohl(init->initial_tsn) - 1; - if (sctp_logging_level & SCTP_MAP_LOGGING_ENABLE) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { sctp_log_map(0, 5, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT); } /* This is the next one we expect */ @@ -446,7 +446,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, op_err = NULL; } /* extract the cookie and queue it to "echo" it back... */ - if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { sctp_misc_ints(SCTP_THRESHOLD_CLEAR, stcb->asoc.overall_error_count, 0, @@ -596,15 +596,16 @@ sctp_handle_heartbeat_ack(struct sctp_heartbeat_chunk *cp, * timer is running, for the destination, stop the timer because a * PF-heartbeat was received. */ - if (sctp_cmt_on_off && sctp_cmt_pf && (net->dest_state & SCTP_ADDR_PF) == - SCTP_ADDR_PF) { + if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && + SCTP_BASE_SYSCTL(sctp_cmt_pf) && + (net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF) { if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_5); } net->dest_state &= ~SCTP_ADDR_PF; - net->cwnd = net->mtu * sctp_cmt_pf; + net->cwnd = net->mtu * SCTP_BASE_SYSCTL(sctp_cmt_pf); SCTPDBG(SCTP_DEBUG_INPUT1, "Destination %p moved from PF to reachable with cwnd %d.\n", net, net->cwnd); } @@ -1172,7 +1173,7 @@ sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset, SCTP_SET_STATE(&stcb->asoc, SCTP_STATE_COOKIE_ECHOED); /* reset the RTO calc */ - if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { sctp_misc_ints(SCTP_THRESHOLD_CLEAR, stcb->asoc.overall_error_count, 0, @@ -1680,8 +1681,8 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, /* pull from vtag hash */ LIST_REMOVE(stcb, sctp_asocs); /* re-insert to new vtag position */ - head = &sctppcbinfo.sctp_asochash[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, - sctppcbinfo.hashasocmark)]; + head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, + SCTP_BASE_INFO(hashasocmark))]; /* * put it in the bucket in the vtag hash of assoc's for the * system @@ -1691,8 +1692,8 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, /* Is this the first restart? */ if (stcb->asoc.in_restart_hash == 0) { /* Ok add it to assoc_id vtag hash */ - head = &sctppcbinfo.sctp_restarthash[SCTP_PCBHASH_ASOC(stcb->asoc.assoc_id, - sctppcbinfo.hashrestartmark)]; + head = &SCTP_BASE_INFO(sctp_restarthash)[SCTP_PCBHASH_ASOC(stcb->asoc.assoc_id, + SCTP_BASE_INFO(hashrestartmark))]; LIST_INSERT_HEAD(head, stcb, sctp_tcbrestarhash); stcb->asoc.in_restart_hash = 1; } @@ -2207,7 +2208,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset, return (NULL); } #ifdef SCTP_MBUF_LOGGING - if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { struct mbuf *mat; mat = m_sig; @@ -2967,7 +2968,7 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc, stcb, tp1->whoTo); /* fix counts and things */ - if (sctp_logging_level & SCTP_FLIGHT_LOGGING_ENABLE) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FLIGHT_LOGGING_ENABLE) { sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_PDRP, tp1->whoTo->flight_size, tp1->book_size, @@ -3285,6 +3286,9 @@ sctp_handle_stream_reset_response(struct sctp_tcb *stcb, return (1); } stcb->asoc.highest_tsn_inside_map = (ntohl(resp->senders_next_tsn) - 1); + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { + sctp_log_map(0, 7, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT); + } stcb->asoc.cumulative_tsn = stcb->asoc.highest_tsn_inside_map; stcb->asoc.mapping_array_base_tsn = ntohl(resp->senders_next_tsn); memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size); @@ -3388,6 +3392,9 @@ sctp_handle_str_reset_request_tsn(struct sctp_tcb *stcb, return (1); } stcb->asoc.highest_tsn_inside_map += SCTP_STREAM_RESET_TSN_DELTA; + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { + sctp_log_map(0, 10, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT); + } stcb->asoc.cumulative_tsn = stcb->asoc.highest_tsn_inside_map; stcb->asoc.mapping_array_base_tsn = stcb->asoc.highest_tsn_inside_map + 1; memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size); @@ -3881,7 +3888,8 @@ __attribute__((noinline)) * valid. */ if ((ch->chunk_type == SCTP_AUTHENTICATION) && - (stcb == NULL) && !sctp_auth_disable) { + (stcb == NULL) && + !SCTP_BASE_SYSCTL(sctp_auth_disable)) { /* save this chunk for later processing */ auth_skipped = 1; auth_offset = *offset; @@ -4034,7 +4042,7 @@ __attribute__((noinline)) (ch->chunk_type == SCTP_HEARTBEAT_REQUEST)) && (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_ECHOED)) { /* implied cookie-ack.. we must have lost the ack */ - if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { sctp_misc_ints(SCTP_THRESHOLD_CLEAR, stcb->asoc.overall_error_count, 0, @@ -4133,9 +4141,9 @@ process_control_chunks: #endif /* check to see if this chunk required auth, but isn't */ - if ((stcb != NULL) && !sctp_auth_disable && - sctp_auth_is_required_chunk(ch->chunk_type, - stcb->asoc.local_auth_chunks) && + if ((stcb != NULL) && + !SCTP_BASE_SYSCTL(sctp_auth_disable) && + sctp_auth_is_required_chunk(ch->chunk_type, stcb->asoc.local_auth_chunks) && !stcb->asoc.authenticated) { /* "silently" ignore */ SCTP_STAT_INCR(sctps_recvauthmissing); @@ -4163,7 +4171,7 @@ process_control_chunks: } if ((chk_length > SCTP_LARGEST_INIT_ACCEPTED) || (num_chunks > 1) || - (sctp_strict_init && (length - *offset > (int)SCTP_SIZE32(chk_length)))) { + (SCTP_BASE_SYSCTL(sctp_strict_init) && (length - *offset > (int)SCTP_SIZE32(chk_length)))) { *offset = length; if (locked_tcb) { SCTP_TCB_UNLOCK(locked_tcb); @@ -4228,7 +4236,7 @@ process_control_chunks: } } if ((num_chunks > 1) || - (sctp_strict_init && (length - *offset > (int)SCTP_SIZE32(chk_length)))) { + (SCTP_BASE_SYSCTL(sctp_strict_init) && (length - *offset > (int)SCTP_SIZE32(chk_length)))) { *offset = length; if (locked_tcb) { SCTP_TCB_UNLOCK(locked_tcb); @@ -4332,7 +4340,7 @@ process_control_chunks: chk_length, *netp); /* He's alive so give him credit */ - if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { sctp_misc_ints(SCTP_THRESHOLD_CLEAR, stcb->asoc.overall_error_count, 0, @@ -4353,7 +4361,7 @@ process_control_chunks: return (NULL); } /* He's alive so give him credit */ - if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { sctp_misc_ints(SCTP_THRESHOLD_CLEAR, stcb->asoc.overall_error_count, 0, @@ -4434,7 +4442,7 @@ process_control_chunks: if ((stcb == NULL) && (inp->sctp_socket->so_qlen >= inp->sctp_socket->so_qlimit)) { if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && - (sctp_abort_if_one_2_one_hits_limit)) { + (SCTP_BASE_SYSCTL(sctp_abort_if_one_2_one_hits_limit))) { struct mbuf *oper; struct sctp_paramhdr *phdr; @@ -4548,7 +4556,7 @@ process_control_chunks: } /* He's alive so give him credit */ if ((stcb) && netp && *netp) { - if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { sctp_misc_ints(SCTP_THRESHOLD_CLEAR, stcb->asoc.overall_error_count, 0, @@ -4571,7 +4579,7 @@ process_control_chunks: return (NULL); } if (stcb) { - if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { sctp_misc_ints(SCTP_THRESHOLD_CLEAR, stcb->asoc.overall_error_count, 0, @@ -4595,7 +4603,7 @@ process_control_chunks: return (NULL); } if (stcb) { - if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { sctp_misc_ints(SCTP_THRESHOLD_CLEAR, stcb->asoc.overall_error_count, 0, @@ -4628,7 +4636,7 @@ process_control_chunks: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ASCONF\n"); /* He's alive so give him credit */ if (stcb) { - if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { sctp_misc_ints(SCTP_THRESHOLD_CLEAR, stcb->asoc.overall_error_count, 0, @@ -4653,7 +4661,7 @@ process_control_chunks: } if ((stcb) && netp && *netp) { /* He's alive so give him credit */ - if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { sctp_misc_ints(SCTP_THRESHOLD_CLEAR, stcb->asoc.overall_error_count, 0, @@ -4682,7 +4690,7 @@ process_control_chunks: int abort_flag = 0; stcb->asoc.overall_error_count = 0; - if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { sctp_misc_ints(SCTP_THRESHOLD_CLEAR, stcb->asoc.overall_error_count, 0, @@ -4713,7 +4721,7 @@ process_control_chunks: *offset = length; return (NULL); } else { - if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { sctp_misc_ints(SCTP_THRESHOLD_CLEAR, stcb->asoc.overall_error_count, 0, @@ -4787,7 +4795,7 @@ process_control_chunks: case SCTP_AUTHENTICATION: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_AUTHENTICATION\n"); - if (sctp_auth_disable) + if (SCTP_BASE_SYSCTL(sctp_auth_disable)) goto unknown_chunk; if (stcb == NULL) { @@ -4851,7 +4859,7 @@ process_control_chunks: M_DONTWAIT); if (SCTP_BUF_NEXT(mm)) { #ifdef SCTP_MBUF_LOGGING - if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { struct mbuf *mat; mat = SCTP_BUF_NEXT(mm); @@ -5005,8 +5013,8 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, sctp_auditing(0, inp, stcb, net); #endif - SCTPDBG(SCTP_DEBUG_INPUT1, "Ok, Common input processing called, m:%p iphlen:%d offset:%d stcb:%p\n", - m, iphlen, offset, stcb); + SCTPDBG(SCTP_DEBUG_INPUT1, "Ok, Common input processing called, m:%p iphlen:%d offset:%d length:%d stcb:%p\n", + m, iphlen, offset, length, stcb); if (stcb) { /* always clear this before beginning a packet */ stcb->asoc.authenticated = 0; @@ -5039,6 +5047,12 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, * it changes our INP. */ inp = stcb->sctp_ep; + if ((net) && (port)) { + if (net->port == 0) { + sctp_pathmtu_adjustment(inp, stcb, net, net->mtu - sizeof(struct udphdr)); + } + net->port = port; + } } } else { /* @@ -5051,9 +5065,9 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, * can't have authenticated without any AUTH (control) * chunks */ - if ((stcb != NULL) && !sctp_auth_disable && - sctp_auth_is_required_chunk(SCTP_DATA, - stcb->asoc.local_auth_chunks)) { + if ((stcb != NULL) && + !SCTP_BASE_SYSCTL(sctp_auth_disable) && + sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.local_auth_chunks)) { /* "silently" ignore */ SCTP_STAT_INCR(sctps_recvauthmissing); SCTP_TCB_UNLOCK(stcb); @@ -5090,9 +5104,10 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, * Rest should be DATA only. Check authentication state if AUTH for * DATA is required. */ - if ((length > offset) && (stcb != NULL) && !sctp_auth_disable && - sctp_auth_is_required_chunk(SCTP_DATA, - stcb->asoc.local_auth_chunks) && + if ((length > offset) && + (stcb != NULL) && + !SCTP_BASE_SYSCTL(sctp_auth_disable) && + sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.local_auth_chunks) && !stcb->asoc.authenticated) { /* "silently" ignore */ SCTP_STAT_INCR(sctps_recvauthmissing); @@ -5115,7 +5130,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, * shows us the cookie-ack was lost. Imply it was * there. */ - if (sctp_logging_level & SCTP_THRESHOLD_LOGGING) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { sctp_misc_ints(SCTP_THRESHOLD_CLEAR, stcb->asoc.overall_error_count, 0, @@ -5266,7 +5281,7 @@ sctp_input_with_port(i_pak, off, port) #ifdef SCTP_MBUF_LOGGING /* Log in any input mbufs */ - if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { mat = m; while (mat) { if (SCTP_BUF_IS_EXTENDED(mat)) { @@ -5277,7 +5292,7 @@ sctp_input_with_port(i_pak, off, port) } #endif #ifdef SCTP_PACKET_LOGGING - if (sctp_logging_level & SCTP_LAST_PACKET_TRACING) + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) sctp_packet_log(m, mlen); #endif /* @@ -5316,7 +5331,7 @@ sctp_input_with_port(i_pak, off, port) } /* validate SCTP checksum */ check = sh->checksum; /* save incoming checksum */ - if ((check == 0) && (sctp_no_csum_on_loopback) && + if ((check == 0) && (SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback)) && ((ip->ip_src.s_addr == ip->ip_dst.s_addr) || (SCTP_IS_IT_LOOPBACK(m))) ) { |