summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctp_input.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/sctp_input.c')
-rw-r--r--sys/netinet/sctp_input.c76
1 files changed, 33 insertions, 43 deletions
diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c
index d8f0ae5..be70b10 100644
--- a/sys/netinet/sctp_input.c
+++ b/sys/netinet/sctp_input.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
@@ -84,7 +84,7 @@ sctp_stop_all_cookie_timers(struct sctp_tcb *stcb)
static void
sctp_handle_init(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh,
struct sctp_init_chunk *cp, struct sctp_inpcb *inp, struct sctp_tcb *stcb,
- struct sctp_nets *net, int *abort_no_unlock, uint32_t vrf_id, uint16_t port)
+ int *abort_no_unlock, uint32_t vrf_id, uint16_t port)
{
struct sctp_init *init;
struct mbuf *op_err;
@@ -258,8 +258,7 @@ sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked
}
static int
-sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb,
- struct sctp_nets *net)
+sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb)
{
struct sctp_init *init;
struct sctp_association *asoc;
@@ -433,13 +432,13 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset,
asoc = &stcb->asoc;
asoc->peer_supports_nat = (uint8_t) nat_friendly;
/* process the peer's parameters in the INIT-ACK */
- retval = sctp_process_init((struct sctp_init_chunk *)cp, stcb, net);
+ retval = sctp_process_init((struct sctp_init_chunk *)cp, stcb);
if (retval < 0) {
return (retval);
}
initack_limit = offset + ntohs(cp->ch.chunk_length);
/* load all addresses */
- if ((retval = sctp_load_addresses_from_init(stcb, m, iphlen,
+ if ((retval = sctp_load_addresses_from_init(stcb, m,
(offset + sizeof(struct sctp_init_chunk)), initack_limit, sh,
NULL))) {
/* Huh, we should abort */
@@ -521,7 +520,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset,
mp->resv = 0;
}
sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen,
- sh, op_err, 0, net->port);
+ sh, op_err, vrf_id, net->port);
*abort_no_unlock = 1;
}
return (retval);
@@ -871,7 +870,7 @@ sctp_handle_shutdown(struct sctp_shutdown_chunk *cp,
/* Shutdown NOT the expected size */
return;
} else {
- sctp_update_acked(stcb, cp, net, abort_flag);
+ sctp_update_acked(stcb, cp, abort_flag);
if (*abort_flag) {
return;
}
@@ -953,7 +952,7 @@ sctp_handle_shutdown(struct sctp_shutdown_chunk *cp,
}
static void
-sctp_handle_shutdown_ack(struct sctp_shutdown_ack_chunk *cp,
+sctp_handle_shutdown_ack(struct sctp_shutdown_ack_chunk *cp SCTP_UNUSED,
struct sctp_tcb *stcb,
struct sctp_nets *net)
{
@@ -1410,7 +1409,7 @@ static struct sctp_tcb *
sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
struct sctphdr *sh, struct sctp_state_cookie *cookie, int cookie_len,
struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets **netp,
- struct sockaddr *init_src, int *notification, sctp_assoc_t * sac_assoc_id,
+ struct sockaddr *init_src, int *notification,
uint32_t vrf_id, int auth_skipped, uint32_t auth_offset, uint32_t auth_len, uint16_t port)
{
struct sctp_association *asoc;
@@ -1526,7 +1525,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
* the right seq no's.
*/
/* First we must process the INIT !! */
- retval = sctp_process_init(init_cp, stcb, net);
+ retval = sctp_process_init(init_cp, stcb);
if (retval < 0) {
if (how_indx < sizeof(asoc->cookie_how))
asoc->cookie_how[how_indx] = 3;
@@ -1613,7 +1612,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
* somehow abort.. but we do have an existing asoc. This
* really should not fail.
*/
- if (sctp_load_addresses_from_init(stcb, m, iphlen,
+ if (sctp_load_addresses_from_init(stcb, m,
init_offset + sizeof(struct sctp_init_chunk),
initack_offset, sh, init_src)) {
if (how_indx < sizeof(asoc->cookie_how))
@@ -1749,13 +1748,13 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
}
/* process the INIT info (peer's info) */
- retval = sctp_process_init(init_cp, stcb, net);
+ retval = sctp_process_init(init_cp, stcb);
if (retval < 0) {
if (how_indx < sizeof(asoc->cookie_how))
asoc->cookie_how[how_indx] = 9;
return (NULL);
}
- if (sctp_load_addresses_from_init(stcb, m, iphlen,
+ if (sctp_load_addresses_from_init(stcb, m,
init_offset + sizeof(struct sctp_init_chunk),
initack_offset, sh, init_src)) {
if (how_indx < sizeof(asoc->cookie_how))
@@ -1852,7 +1851,6 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
sctp_timer_stop(SCTP_TIMER_TYPE_INIT, inp, stcb, net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_15);
sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_16);
- *sac_assoc_id = sctp_get_associd(stcb);
/* notify upper layer */
*notification = SCTP_NOTIFY_ASSOC_RESTART;
atomic_add_int(&stcb->asoc.refcnt, 1);
@@ -1928,7 +1926,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
SCTP_INP_WUNLOCK(stcb->sctp_ep);
SCTP_INP_INFO_WUNLOCK();
- retval = sctp_process_init(init_cp, stcb, net);
+ retval = sctp_process_init(init_cp, stcb);
if (retval < 0) {
if (how_indx < sizeof(asoc->cookie_how))
asoc->cookie_how[how_indx] = 13;
@@ -1941,7 +1939,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
*/
net->hb_responded = 1;
- if (sctp_load_addresses_from_init(stcb, m, iphlen,
+ if (sctp_load_addresses_from_init(stcb, m,
init_offset + sizeof(struct sctp_init_chunk),
initack_offset, sh, init_src)) {
if (how_indx < sizeof(asoc->cookie_how))
@@ -2131,7 +2129,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
/* process the INIT info (peer's info) */
if (netp)
- retval = sctp_process_init(init_cp, stcb, *netp);
+ retval = sctp_process_init(init_cp, stcb);
else
retval = 0;
if (retval < 0) {
@@ -2149,7 +2147,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
return (NULL);
}
/* load all addresses */
- if (sctp_load_addresses_from_init(stcb, m, iphlen,
+ if (sctp_load_addresses_from_init(stcb, m,
init_offset + sizeof(struct sctp_init_chunk), initack_offset, sh,
init_src)) {
atomic_add_int(&stcb->asoc.refcnt, 1);
@@ -2356,7 +2354,6 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
struct sctp_tcb *l_stcb = *stcb;
struct sctp_inpcb *l_inp;
struct sockaddr *to;
- sctp_assoc_t sac_restart_id;
struct sctp_pcb *ep;
struct mbuf *m_sig;
uint8_t calc_sig[SCTP_SIGNATURE_SIZE], tmp_sig[SCTP_SIGNATURE_SIZE];
@@ -2682,7 +2679,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
had_a_existing_tcb = 1;
*stcb = sctp_process_cookie_existing(m, iphlen, offset, sh,
cookie, cookie_len, *inp_p, *stcb, netp, to,
- &notification, &sac_restart_id, vrf_id, auth_skipped, auth_offset, auth_len, port);
+ &notification, vrf_id, auth_skipped, auth_offset, auth_len, port);
}
if (*stcb == NULL) {
@@ -2736,7 +2733,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
* For a restart we will keep the same
* socket, no need to do anything. I THINK!!
*/
- sctp_ulp_notify(notification, *stcb, 0, (void *)&sac_restart_id, SCTP_SO_NOT_LOCKED);
+ sctp_ulp_notify(notification, *stcb, 0, NULL, SCTP_SO_NOT_LOCKED);
if (send_int_conf) {
sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_CONFIRMED,
(*stcb), 0, (void *)netl, SCTP_SO_NOT_LOCKED);
@@ -2890,7 +2887,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
}
static void
-sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *cp,
+sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *cp SCTP_UNUSED,
struct sctp_tcb *stcb, struct sctp_nets *net)
{
/* cp must not be used, others call this without a c-ack :-) */
@@ -3160,7 +3157,7 @@ sctp_handle_ecn_cwr(struct sctp_cwr_chunk *cp, struct sctp_tcb *stcb, struct sct
}
static void
-sctp_handle_shutdown_complete(struct sctp_shutdown_complete_chunk *cp,
+sctp_handle_shutdown_complete(struct sctp_shutdown_complete_chunk *cp SCTP_UNUSED,
struct sctp_tcb *stcb, struct sctp_nets *net)
{
struct sctp_association *asoc;
@@ -4401,7 +4398,7 @@ __attribute__((noinline))
asconf_len = ntohs(asconf_ch->chunk_length);
if (asconf_len < sizeof(struct sctp_asconf_paramhdr))
break;
- stcb = sctp_findassociation_ep_asconf(m, iphlen,
+ stcb = sctp_findassociation_ep_asconf(m,
*offset, sh, &inp, netp, vrf_id);
if (stcb != NULL)
break;
@@ -4660,7 +4657,7 @@ process_control_chunks:
if (netp) {
sctp_handle_init(m, iphlen, *offset, sh,
(struct sctp_init_chunk *)ch, inp,
- stcb, *netp, &abort_no_unlock, vrf_id, port);
+ stcb, &abort_no_unlock, vrf_id, port);
}
if (abort_no_unlock)
return (NULL);
@@ -4795,8 +4792,7 @@ process_control_chunks:
sctp_express_handle_sack(stcb, cum_ack, a_rwnd, &abort_now, ecne_seen);
} else {
if (netp && *netp)
- sctp_handle_sack(m, offset_seg, offset_dup,
- stcb, *netp,
+ sctp_handle_sack(m, offset_seg, offset_dup, stcb,
num_seg, 0, num_dup, &abort_now, flags,
cum_ack, a_rwnd, ecne_seen);
}
@@ -4884,8 +4880,7 @@ process_control_chunks:
&abort_now, ecne_seen);
} else {
if (netp && *netp)
- sctp_handle_sack(m, offset_seg, offset_dup,
- stcb, *netp,
+ sctp_handle_sack(m, offset_seg, offset_dup, stcb,
num_seg, num_nr_seg, num_dup, &abort_now, flags,
cum_ack, a_rwnd, ecne_seen);
}
@@ -5526,7 +5521,6 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset,
uint32_t high_tsn;
int fwd_tsn_seen = 0, data_processed = 0;
struct mbuf *m = *mm;
- int abort_flag = 0;
int un_sent;
int cnt_ctrl_ready = 0;
@@ -5572,7 +5566,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset,
inp = stcb->sctp_ep;
if ((net) && (port)) {
if (net->port == 0) {
- sctp_pathmtu_adjustment(inp, stcb, net, net->mtu - sizeof(struct udphdr));
+ sctp_pathmtu_adjustment(stcb, net->mtu - sizeof(struct udphdr));
}
net->port = port;
}
@@ -5719,11 +5713,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset,
}
was_a_gap = SCTP_TSN_GT(highest_tsn, stcb->asoc.cumulative_tsn);
stcb->asoc.send_sack = 1;
- sctp_sack_check(stcb, was_a_gap, &abort_flag);
- if (abort_flag) {
- /* Again, we aborted so NO UNLOCK needed */
- goto out_now;
- }
+ sctp_sack_check(stcb, was_a_gap);
} else if (fwd_tsn_seen) {
stcb->asoc.send_sack = 1;
}
@@ -5891,13 +5881,13 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint16_t port)
SCTPDBG(SCTP_DEBUG_INPUT1, "Bad CSUM on SCTP packet calc_check:%x check:%x m:%p mlen:%d iphlen:%d\n",
calc_check, check, m, mlen, iphlen);
- stcb = sctp_findassociation_addr(m, iphlen,
+ stcb = sctp_findassociation_addr(m,
offset - sizeof(*ch),
sh, ch, &inp, &net,
vrf_id);
if ((net) && (port)) {
if (net->port == 0) {
- sctp_pathmtu_adjustment(inp, stcb, net, net->mtu - sizeof(struct udphdr));
+ sctp_pathmtu_adjustment(stcb, net->mtu - sizeof(struct udphdr));
}
net->port = port;
}
@@ -5928,11 +5918,11 @@ sctp_skip_csum_4:
* Locate pcb and tcb for datagram sctp_findassociation_addr() wants
* IP/SCTP/first chunk header...
*/
- stcb = sctp_findassociation_addr(m, iphlen, offset - sizeof(*ch),
+ stcb = sctp_findassociation_addr(m, offset - sizeof(*ch),
sh, ch, &inp, &net, vrf_id);
if ((net) && (port)) {
if (net->port == 0) {
- sctp_pathmtu_adjustment(inp, stcb, net, net->mtu - sizeof(struct udphdr));
+ sctp_pathmtu_adjustment(stcb, net->mtu - sizeof(struct udphdr));
}
net->port = port;
}
@@ -5971,7 +5961,7 @@ sctp_skip_csum_4:
sh->v_tag = init_chk->init.initiate_tag;
}
if (ch->chunk_type == SCTP_SHUTDOWN_ACK) {
- sctp_send_shutdown_complete2(m, iphlen, sh, vrf_id, port);
+ sctp_send_shutdown_complete2(m, sh, vrf_id, port);
goto bad;
}
if (ch->chunk_type == SCTP_SHUTDOWN_COMPLETE) {
OpenPOWER on IntegriCloud