diff options
Diffstat (limited to 'sys/netinet/sctputil.c')
-rw-r--r-- | sys/netinet/sctputil.c | 79 |
1 files changed, 35 insertions, 44 deletions
diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index a9d120b..aa78064 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -7,11 +7,11 @@ * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * * b) Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. + * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived @@ -121,7 +121,6 @@ rto_logging(struct sctp_nets *net, int from) sctp_clog.x.misc.log2, sctp_clog.x.misc.log3, sctp_clog.x.misc.log4); - } void @@ -142,7 +141,6 @@ sctp_log_strm_del_alt(struct sctp_tcb *stcb, uint32_t tsn, uint16_t sseq, uint16 sctp_clog.x.misc.log2, sctp_clog.x.misc.log3, sctp_clog.x.misc.log4); - } void @@ -219,7 +217,6 @@ sctp_log_fr(uint32_t biggest_tsn, uint32_t biggest_new_tsn, uint32_t tsn, sctp_clog.x.misc.log2, sctp_clog.x.misc.log3, sctp_clog.x.misc.log4); - } @@ -277,7 +274,6 @@ sctp_log_strm_del(struct sctp_queued_to_read *control, struct sctp_queued_to_rea sctp_clog.x.misc.log2, sctp_clog.x.misc.log3, sctp_clog.x.misc.log4); - } void @@ -313,7 +309,6 @@ sctp_log_cwnd(struct sctp_tcb *stcb, struct sctp_nets *net, int augment, uint8_t sctp_clog.x.misc.log2, sctp_clog.x.misc.log3, sctp_clog.x.misc.log4); - } void @@ -358,7 +353,6 @@ sctp_log_lock(struct sctp_inpcb *inp, struct sctp_tcb *stcb, uint8_t from) sctp_clog.x.misc.log2, sctp_clog.x.misc.log3, sctp_clog.x.misc.log4); - } void @@ -386,7 +380,6 @@ sctp_log_maxburst(struct sctp_tcb *stcb, struct sctp_nets *net, int error, int b sctp_clog.x.misc.log2, sctp_clog.x.misc.log3, sctp_clog.x.misc.log4); - } void @@ -441,7 +434,6 @@ sctp_log_mbcnt(uint8_t from, uint32_t total_oq, uint32_t book, uint32_t total_mb sctp_clog.x.misc.log2, sctp_clog.x.misc.log3, sctp_clog.x.misc.log4); - } void @@ -454,7 +446,7 @@ sctp_misc_ints(uint8_t from, uint32_t a, uint32_t b, uint32_t c, uint32_t d) } void -sctp_wakeup_log(struct sctp_tcb *stcb, uint32_t cumtsn, uint32_t wake_cnt, int from) +sctp_wakeup_log(struct sctp_tcb *stcb, uint32_t wake_cnt, int from) { struct sctp_cwnd_log sctp_clog; @@ -497,11 +489,10 @@ sctp_wakeup_log(struct sctp_tcb *stcb, uint32_t cumtsn, uint32_t wake_cnt, int f sctp_clog.x.misc.log2, sctp_clog.x.misc.log3, sctp_clog.x.misc.log4); - } void -sctp_log_block(uint8_t from, struct socket *so, struct sctp_association *asoc, int sendlen) +sctp_log_block(uint8_t from, struct sctp_association *asoc, int sendlen) { struct sctp_cwnd_log sctp_clog; @@ -519,11 +510,10 @@ sctp_log_block(uint8_t from, struct socket *so, struct sctp_association *asoc, i sctp_clog.x.misc.log2, sctp_clog.x.misc.log3, sctp_clog.x.misc.log4); - } int -sctp_fill_stat_log(void *optval, size_t *optsize) +sctp_fill_stat_log(void *optval SCTP_UNUSED, size_t *optsize SCTP_UNUSED) { /* May need to fix this if ktrdump does not work */ return (0); @@ -800,7 +790,7 @@ sctp_get_prev_mtu(uint32_t val) * entry, just return val. */ uint32_t -sctp_get_next_mtu(struct sctp_inpcb *inp, uint32_t val) +sctp_get_next_mtu(uint32_t val) { /* select another MTU that is just bigger than this one */ uint32_t i; @@ -871,21 +861,22 @@ retry: } uint32_t -sctp_select_a_tag(struct sctp_inpcb *inp, uint16_t lport, uint16_t rport, int save_in_twait) +sctp_select_a_tag(struct sctp_inpcb *inp, uint16_t lport, uint16_t rport, int check) { - uint32_t x, not_done; + uint32_t x; struct timeval now; - (void)SCTP_GETTIME_TIMEVAL(&now); - not_done = 1; - while (not_done) { + if (check) { + (void)SCTP_GETTIME_TIMEVAL(&now); + } + for (;;) { x = sctp_select_initial_TSN(&inp->sctp_ep); if (x == 0) { /* we never use 0 */ continue; } - if (sctp_is_vtag_good(inp, x, lport, rport, &now, save_in_twait)) { - not_done = 0; + if (!check || sctp_is_vtag_good(x, lport, rport, &now)) { + break; } } return (x); @@ -2612,7 +2603,7 @@ sctp_pad_lastmbuf(struct mbuf *m, int padval, struct mbuf *last_mbuf) static void sctp_notify_assoc_change(uint32_t event, struct sctp_tcb *stcb, - uint32_t error, void *data, int so_locked + uint32_t error, int so_locked #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED #endif @@ -2688,7 +2679,7 @@ sctp_notify_assoc_change(uint32_t event, struct sctp_tcb *stcb, SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_assoc_change); SCTP_BUF_NEXT(m_notify) = NULL; control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, - 0, 0, 0, 0, 0, 0, + 0, 0, stcb->asoc.context, 0, 0, 0, m_notify); if (control == NULL) { /* no memory */ @@ -2787,7 +2778,7 @@ sctp_notify_peer_addr_change(struct sctp_tcb *stcb, uint32_t state, /* append to socket */ control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, - 0, 0, 0, 0, 0, 0, + 0, 0, stcb->asoc.context, 0, 0, 0, m_notify); if (control == NULL) { /* no memory */ @@ -2873,7 +2864,7 @@ sctp_notify_send_failed(struct sctp_tcb *stcb, uint32_t error, } /* append to socket */ control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, - 0, 0, 0, 0, 0, 0, + 0, 0, stcb->asoc.context, 0, 0, 0, m_notify); if (control == NULL) { /* no memory */ @@ -2949,7 +2940,7 @@ sctp_notify_send_failed2(struct sctp_tcb *stcb, uint32_t error, } /* append to socket */ control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, - 0, 0, 0, 0, 0, 0, + 0, 0, stcb->asoc.context, 0, 0, 0, m_notify); if (control == NULL) { /* no memory */ @@ -2965,8 +2956,7 @@ sctp_notify_send_failed2(struct sctp_tcb *stcb, uint32_t error, static void -sctp_notify_adaptation_layer(struct sctp_tcb *stcb, - uint32_t error) +sctp_notify_adaptation_layer(struct sctp_tcb *stcb) { struct mbuf *m_notify; struct sctp_adaptation_event *sai; @@ -2993,7 +2983,7 @@ sctp_notify_adaptation_layer(struct sctp_tcb *stcb, /* append to socket */ control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, - 0, 0, 0, 0, 0, 0, + 0, 0, stcb->asoc.context, 0, 0, 0, m_notify); if (control == NULL) { /* no memory */ @@ -3047,7 +3037,7 @@ sctp_notify_partial_delivery_indication(struct sctp_tcb *stcb, uint32_t error, SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_pdapi_event); SCTP_BUF_NEXT(m_notify) = NULL; control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, - 0, 0, 0, 0, 0, 0, + 0, 0, stcb->asoc.context, 0, 0, 0, m_notify); if (control == NULL) { /* no memory */ @@ -3155,7 +3145,7 @@ sctp_notify_shutdown_event(struct sctp_tcb *stcb) /* append to socket */ control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, - 0, 0, 0, 0, 0, 0, + 0, 0, stcb->asoc.context, 0, 0, 0, m_notify); if (control == NULL) { /* no memory */ @@ -3204,7 +3194,8 @@ sctp_notify_sender_dry_event(struct sctp_tcb *stcb, /* append to socket */ control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, - 0, 0, 0, 0, 0, 0, m_notify); + 0, 0, stcb->asoc.context, 0, 0, 0, + m_notify); if (control == NULL) { /* no memory */ sctp_m_freem(m_notify); @@ -3258,7 +3249,7 @@ sctp_notify_stream_reset_add(struct sctp_tcb *stcb, int number_entries, int flag } /* append to socket */ control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, - 0, 0, 0, 0, 0, 0, + 0, 0, stcb->asoc.context, 0, 0, 0, m_notify); if (control == NULL) { /* no memory */ @@ -3324,7 +3315,7 @@ sctp_notify_stream_reset(struct sctp_tcb *stcb, } /* append to socket */ control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, - 0, 0, 0, 0, 0, 0, + 0, 0, stcb->asoc.context, 0, 0, 0, m_notify); if (control == NULL) { /* no memory */ @@ -3371,11 +3362,11 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, switch (notification) { case SCTP_NOTIFY_ASSOC_UP: if (stcb->asoc.assoc_up_sent == 0) { - sctp_notify_assoc_change(SCTP_COMM_UP, stcb, error, NULL, so_locked); + sctp_notify_assoc_change(SCTP_COMM_UP, stcb, error, so_locked); stcb->asoc.assoc_up_sent = 1; } if (stcb->asoc.adaptation_needed && (stcb->asoc.adaptation_sent == 0)) { - sctp_notify_adaptation_layer(stcb, error); + sctp_notify_adaptation_layer(stcb); } if (stcb->asoc.peer_supports_auth == 0) { sctp_ulp_notify(SCTP_NOTIFY_NO_PEER_AUTH, stcb, 0, @@ -3383,7 +3374,7 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, } break; case SCTP_NOTIFY_ASSOC_DOWN: - sctp_notify_assoc_change(SCTP_SHUTDOWN_COMP, stcb, error, NULL, so_locked); + sctp_notify_assoc_change(SCTP_SHUTDOWN_COMP, stcb, error, so_locked); break; case SCTP_NOTIFY_INTERFACE_DOWN: { @@ -3434,9 +3425,9 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, case SCTP_NOTIFY_ASSOC_ABORTED: if ((stcb) && (((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_WAIT) || ((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_ECHOED))) { - sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, NULL, so_locked); + sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, so_locked); } else { - sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, NULL, so_locked); + sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, so_locked); } break; case SCTP_NOTIFY_PEER_OPENED_STREAM: @@ -3444,7 +3435,7 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, case SCTP_NOTIFY_STREAM_OPENED_OK: break; case SCTP_NOTIFY_ASSOC_RESTART: - sctp_notify_assoc_change(SCTP_RESTART, stcb, error, data, so_locked); + sctp_notify_assoc_change(SCTP_RESTART, stcb, error, so_locked); if (stcb->asoc.peer_supports_auth == 0) { sctp_ulp_notify(SCTP_NOTIFY_NO_PEER_AUTH, stcb, 0, NULL, so_locked); @@ -3848,7 +3839,7 @@ sctp_handle_ootb(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, */ return; case SCTP_SHUTDOWN_ACK: - sctp_send_shutdown_complete2(m, iphlen, sh, vrf_id, port); + sctp_send_shutdown_complete2(m, sh, vrf_id, port); return; default: break; @@ -6353,7 +6344,7 @@ sctp_bindx_add_address(struct socket *so, struct sctp_inpcb *inp, * assumes all arguments are valid/checked by caller. */ void -sctp_bindx_delete_address(struct socket *so, struct sctp_inpcb *inp, +sctp_bindx_delete_address(struct sctp_inpcb *inp, struct sockaddr *sa, sctp_assoc_t assoc_id, uint32_t vrf_id, int *error) { |