This is the SCTP specific companion of

https://svnweb.freebsd.org/changeset/base/275358
which was provided by Hans Petter Selasky.
This commit is contained in:
Michael Tuexen 2014-12-04 21:17:50 +00:00
parent 001de973d5
commit 457b4b8836
7 changed files with 96 additions and 135 deletions

View File

@ -2296,7 +2296,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length,
struct sockaddr *src, struct sockaddr *dst,
struct sctphdr *sh, struct sctp_inpcb *inp,
struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t * high_tsn,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
uint32_t vrf_id, uint16_t port)
{
struct sctp_data_chunk *ch, chunk_buf;
@ -2391,7 +2391,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length,
stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_19;
sctp_abort_association(inp, stcb, m, iphlen,
src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
return (2);
}
@ -2406,7 +2406,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length,
stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_19;
sctp_abort_association(inp, stcb, m, iphlen,
src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
return (2);
}
@ -2475,7 +2475,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length,
m, iphlen,
src, dst,
sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
return (2);
}

View File

@ -86,7 +86,7 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset,
struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh,
struct sctp_init_chunk *cp, struct sctp_inpcb *inp,
struct sctp_tcb *stcb, int *abort_no_unlock,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
uint32_t vrf_id, uint16_t port)
{
struct sctp_init *init;
@ -101,7 +101,7 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset,
if (ntohs(cp->ch.chunk_length) < sizeof(struct sctp_init_chunk)) {
op_err = sctp_generate_cause(SCTP_CAUSE_INVALID_PARAM, "");
sctp_abort_association(inp, stcb, m, iphlen, src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
if (stcb)
*abort_no_unlock = 1;
@ -113,7 +113,7 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset,
/* protocol error... send abort */
op_err = sctp_generate_cause(SCTP_CAUSE_INVALID_PARAM, "");
sctp_abort_association(inp, stcb, m, iphlen, src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
if (stcb)
*abort_no_unlock = 1;
@ -123,7 +123,7 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset,
/* invalid parameter... send abort */
op_err = sctp_generate_cause(SCTP_CAUSE_INVALID_PARAM, "");
sctp_abort_association(inp, stcb, m, iphlen, src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
if (stcb)
*abort_no_unlock = 1;
@ -133,7 +133,7 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset,
/* protocol error... send abort */
op_err = sctp_generate_cause(SCTP_CAUSE_INVALID_PARAM, "");
sctp_abort_association(inp, stcb, m, iphlen, src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
if (stcb)
*abort_no_unlock = 1;
@ -143,7 +143,7 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset,
/* protocol error... send abort */
op_err = sctp_generate_cause(SCTP_CAUSE_INVALID_PARAM, "");
sctp_abort_association(inp, stcb, m, iphlen, src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
if (stcb)
*abort_no_unlock = 1;
@ -155,7 +155,7 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset,
op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code),
"Problem with AUTH parameters");
sctp_abort_association(inp, stcb, m, iphlen, src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
if (stcb)
*abort_no_unlock = 1;
@ -186,7 +186,7 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset,
op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code),
"No listener");
sctp_send_abort(m, iphlen, src, dst, sh, 0, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
}
goto outnow;
@ -200,7 +200,7 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset,
SCTPDBG(SCTP_DEBUG_INPUT3, "sctp_handle_init: sending INIT-ACK\n");
sctp_send_initiate_ack(inp, stcb, m, iphlen, offset, src, dst,
sh, cp,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port,
((stcb == NULL) ? SCTP_HOLDS_LOCK : SCTP_NOT_LOCKED));
}
@ -434,7 +434,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset,
struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh,
struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb,
struct sctp_nets *net, int *abort_no_unlock,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
uint32_t vrf_id)
{
struct sctp_association *asoc;
@ -474,7 +474,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset,
retval);
sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen,
src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, net->port);
*abort_no_unlock = 1;
return (-1);
@ -549,7 +549,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset,
}
sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen,
src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, net->port);
*abort_no_unlock = 1;
}
@ -1284,7 +1284,7 @@ sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset,
struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh,
struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb,
struct sctp_nets *net, int *abort_no_unlock,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
uint32_t vrf_id)
{
struct sctp_init_ack *init_ack;
@ -1303,7 +1303,7 @@ sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset,
op_err = sctp_generate_cause(SCTP_CAUSE_INVALID_PARAM, "");
sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen,
src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, net->port);
*abort_no_unlock = 1;
return (-1);
@ -1315,7 +1315,7 @@ sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset,
op_err = sctp_generate_cause(SCTP_CAUSE_INVALID_PARAM, "");
sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen,
src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, net->port);
*abort_no_unlock = 1;
return (-1);
@ -1325,7 +1325,7 @@ sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset,
op_err = sctp_generate_cause(SCTP_CAUSE_INVALID_PARAM, "");
sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen,
src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, net->port);
*abort_no_unlock = 1;
return (-1);
@ -1335,7 +1335,7 @@ sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset,
op_err = sctp_generate_cause(SCTP_CAUSE_INVALID_PARAM, "");
sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen,
src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, net->port);
*abort_no_unlock = 1;
return (-1);
@ -1345,7 +1345,7 @@ sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset,
op_err = sctp_generate_cause(SCTP_CAUSE_INVALID_PARAM, "");
sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen,
src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, net->port);
*abort_no_unlock = 1;
return (-1);
@ -1370,7 +1370,7 @@ sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset,
}
if (sctp_process_init_ack(m, iphlen, offset, src, dst, sh, cp, stcb,
net, abort_no_unlock,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id) < 0) {
/* error in parsing parameters */
return (-1);
@ -1427,7 +1427,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
struct sctp_inpcb *inp, struct sctp_nets **netp,
struct sockaddr *init_src, int *notification,
int auth_skipped, uint32_t auth_offset, uint32_t auth_len,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
uint32_t vrf_id, uint16_t port);
@ -1444,7 +1444,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets **netp,
struct sockaddr *init_src, int *notification,
int auth_skipped, uint32_t auth_offset, uint32_t auth_len,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
uint32_t vrf_id, uint16_t port)
{
struct sctp_association *asoc;
@ -1477,7 +1477,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
sctp_send_shutdown_ack(stcb, stcb->asoc.primary_destination);
op_err = sctp_generate_cause(SCTP_CAUSE_COOKIE_IN_SHUTDOWN, "");
sctp_send_operr_to(src, dst, sh, cookie->peers_vtag, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, net->port);
if (how_indx < sizeof(asoc->cookie_how))
asoc->cookie_how[how_indx] = 2;
@ -1684,7 +1684,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
*/
op_err = sctp_generate_cause(SCTP_CAUSE_NAT_COLLIDING_STATE, "");
sctp_send_abort(m, iphlen, src, dst, sh, 0, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
return (NULL);
}
@ -1856,7 +1856,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
sh, cookie, cookie_len,
inp, netp, init_src, notification,
auth_skipped, auth_offset, auth_len,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port));
}
/*
@ -2012,7 +2012,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
struct sctp_inpcb *inp, struct sctp_nets **netp,
struct sockaddr *init_src, int *notification,
int auth_skipped, uint32_t auth_offset, uint32_t auth_len,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
uint32_t vrf_id, uint16_t port)
{
struct sctp_tcb *stcb;
@ -2098,7 +2098,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
op_err = sctp_generate_cause(SCTP_CAUSE_OUT_OF_RESC, "");
sctp_abort_association(inp, (struct sctp_tcb *)NULL, m, iphlen,
src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
return (NULL);
}
@ -2126,7 +2126,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
op_err = sctp_generate_cause(SCTP_CAUSE_OUT_OF_RESC, "");
sctp_abort_association(inp, (struct sctp_tcb *)NULL, m, iphlen,
src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
SCTP_TCB_UNLOCK(stcb);
@ -2373,7 +2373,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
struct sctp_inpcb **inp_p, struct sctp_tcb **stcb, struct sctp_nets **netp,
int auth_skipped, uint32_t auth_offset, uint32_t auth_len,
struct sctp_tcb **locked_tcb,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
uint32_t vrf_id, uint16_t port)
{
struct sctp_state_cookie *cookie;
@ -2560,7 +2560,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
tim = now.tv_usec - cookie->time_entered.tv_usec;
scm->time_usec = htonl(tim);
sctp_send_operr_to(src, dst, sh, cookie->peers_vtag, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
return (NULL);
}
@ -2650,7 +2650,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
cookie, cookie_len, *inp_p,
netp, to, &notification,
auth_skipped, auth_offset, auth_len,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
} else {
/* this is abnormal... cookie-echo on existing TCB */
@ -2659,7 +2659,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
src, dst, sh,
cookie, cookie_len, *inp_p, *stcb, netp, to,
&notification, auth_skipped, auth_offset, auth_len,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
}
@ -2667,11 +2667,8 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
/* still no TCB... must be bad cookie-echo */
return (NULL);
}
if ((*netp != NULL) && (use_mflowid != 0)) {
(*netp)->flowid = mflowid;
#ifdef INVARIANTS
(*netp)->flowidset = 1;
#endif
if ((*netp != NULL) && (mflowtype != M_HASHTYPE_NONE)) {
(*netp)->flowtype = mflowtype;
}
/*
* Ok, we built an association so confirm the address we sent the
@ -2742,7 +2739,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
op_err = sctp_generate_cause(SCTP_CAUSE_OUT_OF_RESC, "");
sctp_abort_association(*inp_p, NULL, m, iphlen,
src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
pcb_so = SCTP_INP_SO(*inp_p);
@ -4368,7 +4365,7 @@ __attribute__((noinline))
struct sockaddr *src, struct sockaddr *dst,
struct sctphdr *sh, struct sctp_chunkhdr *ch, struct sctp_inpcb *inp,
struct sctp_tcb *stcb, struct sctp_nets **netp, int *fwd_tsn_seen,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
uint32_t vrf_id, uint16_t port)
{
struct sctp_association *asoc;
@ -4532,7 +4529,7 @@ __attribute__((noinline))
msg);
/* no association, so it's out of the blue... */
sctp_handle_ootb(m, iphlen, *offset, src, dst, sh, inp, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
*offset = length;
if (locked_tcb) {
@ -4576,7 +4573,7 @@ __attribute__((noinline))
msg);
sctp_handle_ootb(m, iphlen, *offset, src, dst,
sh, inp, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
return (NULL);
}
@ -4721,7 +4718,7 @@ process_control_chunks:
"INIT not the only chunk");
sctp_abort_association(inp, stcb, m, iphlen,
src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
*offset = length;
return (NULL);
@ -4731,7 +4728,7 @@ process_control_chunks:
op_err = sctp_generate_cause(SCTP_CAUSE_OUT_OF_RESC, "");
sctp_abort_association(inp, stcb, m, iphlen,
src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
*offset = length;
return (NULL);
@ -4739,7 +4736,7 @@ process_control_chunks:
sctp_handle_init(m, iphlen, *offset, src, dst, sh,
(struct sctp_init_chunk *)ch, inp,
stcb, &abort_no_unlock,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
*offset = length;
if ((!abort_no_unlock) && (locked_tcb)) {
@ -4793,7 +4790,7 @@ process_control_chunks:
(struct sctp_init_ack_chunk *)ch,
stcb, *netp,
&abort_no_unlock,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id);
} else {
ret = -1;
@ -5098,7 +5095,7 @@ process_control_chunks:
op_err = sctp_generate_cause(SCTP_CAUSE_OUT_OF_RESC, "");
sctp_abort_association(inp, stcb, m, iphlen,
src, dst, sh, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
}
*offset = length;
@ -5133,7 +5130,7 @@ process_control_chunks:
auth_offset,
auth_len,
&locked_tcb,
use_mflowid,
mflowtype,
mflowid,
vrf_id,
port);
@ -5587,7 +5584,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
uint8_t compute_crc,
#endif
uint8_t ecn_bits,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
uint32_t vrf_id, uint16_t port)
{
uint32_t high_tsn;
@ -5626,11 +5623,8 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
net->port = port;
}
#endif
if ((net != NULL) && (use_mflowid != 0)) {
net->flowid = mflowid;
#ifdef INVARIANTS
net->flowidset = 1;
#endif
if ((net != NULL) && (mflowtype != M_HASHTYPE_NONE)) {
net->flowtype = mflowtype;
}
if ((inp != NULL) && (stcb != NULL)) {
sctp_send_packet_dropped(stcb, net, m, length, iphlen, 1);
@ -5659,11 +5653,8 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
net->port = port;
}
#endif
if ((net != NULL) && (use_mflowid != 0)) {
net->flowid = mflowid;
#ifdef INVARIANTS
net->flowidset = 1;
#endif
if ((net != NULL) && (mflowtype != M_HASHTYPE_NONE)) {
net->flowtype = mflowtype;
}
if (inp == NULL) {
SCTP_STAT_INCR(sctps_noport);
@ -5672,7 +5663,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
}
if (ch->chunk_type == SCTP_SHUTDOWN_ACK) {
sctp_send_shutdown_complete2(src, dst, sh,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
goto out;
}
@ -5687,7 +5678,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
"Out of the blue");
sctp_send_abort(m, iphlen, src, dst,
sh, 0, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
}
}
@ -5748,7 +5739,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code),
msg);
sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
goto out;
}
@ -5759,7 +5750,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
stcb = sctp_process_control(m, iphlen, &offset, length,
src, dst, sh, ch,
inp, stcb, &net, &fwd_tsn_seen,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
if (stcb) {
/*
@ -5800,7 +5791,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code),
msg);
sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
goto out;
}
@ -5872,7 +5863,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code),
msg);
sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
goto out;
/* sa_ignore NOTREACHED */
@ -5893,7 +5884,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
retval = sctp_process_data(mm, iphlen, &offset, length,
src, dst, sh,
inp, stcb, net, &high_tsn,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
if (retval == 2) {
/*
@ -6008,7 +5999,7 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint16_t port)
#endif
uint32_t mflowid;
uint8_t use_mflowid;
uint8_t mflowtype;
iphlen = off;
if (SCTP_GET_PKT_VRFID(i_pak, vrf_id)) {
@ -6038,13 +6029,8 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint16_t port)
m->m_pkthdr.len,
if_name(m->m_pkthdr.rcvif),
(int)m->m_pkthdr.csum_flags, CSUM_BITS);
if (m->m_flags & M_FLOWID) {
mflowid = m->m_pkthdr.flowid;
use_mflowid = 1;
} else {
mflowid = 0;
use_mflowid = 0;
}
mflowid = m->m_pkthdr.flowid;
mflowtype = M_HASHTYPE_GET(m);
SCTP_STAT_INCR(sctps_recvpackets);
SCTP_STAT_INCR_COUNTER64(sctps_inpackets);
/* Get IP, SCTP, and first chunk header together in the first mbuf. */
@ -6104,7 +6090,7 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint16_t port)
compute_crc,
#endif
ecn_bits,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
out:
if (m) {
@ -6134,7 +6120,7 @@ sctp_input(struct mbuf **mp, int *offp, int proto SCTP_UNUSED)
int cpu_to_use;
uint32_t flowid, tag;
if (m->m_flags & M_FLOWID) {
if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) {
flowid = m->m_pkthdr.flowid;
} else {
/*
@ -6153,7 +6139,7 @@ sctp_input(struct mbuf **mp, int *offp, int proto SCTP_UNUSED)
tag = htonl(sh->v_tag);
flowid = tag ^ ntohs(sh->dest_port) ^ ntohs(sh->src_port);
m->m_pkthdr.flowid = flowid;
m->m_flags |= M_FLOWID;
M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE);
}
cpu_to_use = sctp_cpuarry[flowid % mp_ncpus];
sctp_queue_to_mcore(m, off, cpu_to_use);

View File

@ -3999,7 +3999,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
uint32_t v_tag,
uint16_t port,
union sctp_sockstore *over_addr,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
int so_locked SCTP_UNUSED
#else
@ -4090,18 +4090,11 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
SCTP_BUF_NEXT(newm) = m;
m = newm;
if (net != NULL) {
#ifdef INVARIANTS
if (net->flowidset == 0) {
panic("Flow ID not set");
}
#endif
m->m_pkthdr.flowid = net->flowid;
m->m_flags |= M_FLOWID;
M_HASHTYPE_SET(m, net->flowtype);
} else {
if (use_mflowid != 0) {
m->m_pkthdr.flowid = mflowid;
m->m_flags |= M_FLOWID;
}
m->m_pkthdr.flowid = mflowid;
M_HASHTYPE_SET(m, mflowtype);
}
packet_length = sctp_calculate_len(m);
ip = mtod(m, struct ip *);
@ -4379,18 +4372,11 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
SCTP_BUF_NEXT(newm) = m;
m = newm;
if (net != NULL) {
#ifdef INVARIANTS
if (net->flowidset == 0) {
panic("Flow ID not set");
}
#endif
m->m_pkthdr.flowid = net->flowid;
m->m_flags |= M_FLOWID;
M_HASHTYPE_SET(m, net->flowtype);
} else {
if (use_mflowid != 0) {
m->m_pkthdr.flowid = mflowid;
m->m_flags |= M_FLOWID;
}
m->m_pkthdr.flowid = mflowid;
M_HASHTYPE_SET(m, mflowtype);
}
packet_length = sctp_calculate_len(m);
@ -5484,7 +5470,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
struct mbuf *init_pkt, int iphlen, int offset,
struct sockaddr *src, struct sockaddr *dst,
struct sctphdr *sh, struct sctp_init_chunk *init_chk,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
uint32_t vrf_id, uint16_t port, int hold_inp_lock)
{
struct sctp_association *asoc;
@ -5536,7 +5522,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code),
"Address added");
sctp_send_abort(init_pkt, iphlen, src, dst, sh, 0, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
return;
}
@ -5555,7 +5541,7 @@ do_a_abort:
}
sctp_send_abort(init_pkt, iphlen, src, dst, sh,
init_chk->init.initiate_tag, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
return;
}
@ -6112,7 +6098,7 @@ do_a_abort:
0, 0,
inp->sctp_lport, sh->src_port, init_chk->init.initiate_tag,
port, over_addr,
use_mflowid, mflowid,
mflowtype, mflowid,
SCTP_SO_NOT_LOCKED);
SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
}
@ -10953,7 +10939,7 @@ static void
sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst,
struct sctphdr *sh, uint32_t vtag,
uint8_t type, struct mbuf *cause,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
uint32_t vrf_id, uint16_t port)
{
struct mbuf *o_pak;
@ -11033,10 +11019,8 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst,
SCTP_BUF_RESV_UF(mout, max_linkhdr);
SCTP_BUF_LEN(mout) = len;
SCTP_BUF_NEXT(mout) = cause;
if (use_mflowid != 0) {
mout->m_pkthdr.flowid = mflowid;
mout->m_flags |= M_FLOWID;
}
mout->m_pkthdr.flowid = mflowid;
M_HASHTYPE_SET(mout, mflowtype);
#ifdef INET
ip = NULL;
#endif
@ -11222,11 +11206,11 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst,
void
sctp_send_shutdown_complete2(struct sockaddr *src, struct sockaddr *dst,
struct sctphdr *sh,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
uint32_t vrf_id, uint16_t port)
{
sctp_send_resp_msg(src, dst, sh, 0, SCTP_SHUTDOWN_COMPLETE, NULL,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
}
@ -12045,7 +12029,7 @@ skip_stuff:
void
sctp_send_abort(struct mbuf *m, int iphlen, struct sockaddr *src, struct sockaddr *dst,
struct sctphdr *sh, uint32_t vtag, struct mbuf *cause,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
uint32_t vrf_id, uint16_t port)
{
/* Don't respond to an ABORT with an ABORT. */
@ -12055,7 +12039,7 @@ sctp_send_abort(struct mbuf *m, int iphlen, struct sockaddr *src, struct sockadd
return;
}
sctp_send_resp_msg(src, dst, sh, vtag, SCTP_ABORT_ASSOCIATION, cause,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
return;
}
@ -12063,11 +12047,11 @@ sctp_send_abort(struct mbuf *m, int iphlen, struct sockaddr *src, struct sockadd
void
sctp_send_operr_to(struct sockaddr *src, struct sockaddr *dst,
struct sctphdr *sh, uint32_t vtag, struct mbuf *cause,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
uint32_t vrf_id, uint16_t port)
{
sctp_send_resp_msg(src, dst, sh, vtag, SCTP_OPERATION_ERROR, cause,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
return;
}

View File

@ -4049,9 +4049,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
net->flowid = stcb->asoc.my_vtag ^
ntohs(stcb->rport) ^
ntohs(stcb->sctp_ep->sctp_lport);
#ifdef INVARIANTS
net->flowidset = 1;
#endif
net->flowtype = M_HASHTYPE_OPAQUE;
if (netp) {
*netp = net;
}

View File

@ -380,9 +380,7 @@ struct sctp_nets {
uint8_t lan_type;
uint8_t rto_needed;
uint32_t flowid;
#ifdef INVARIANTS
uint8_t flowidset;
#endif
uint8_t flowtype;
};

View File

@ -3852,7 +3852,7 @@ sctp_abort_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
struct mbuf *m, int iphlen,
struct sockaddr *src, struct sockaddr *dst,
struct sctphdr *sh, struct mbuf *op_err,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
uint32_t vrf_id, uint16_t port)
{
uint32_t vtag;
@ -3872,7 +3872,7 @@ sctp_abort_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
stcb->asoc.state |= SCTP_STATE_WAS_ABORTED;
}
sctp_send_abort(m, iphlen, src, dst, sh, vtag, op_err,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
if (stcb != NULL) {
/* Ok, now lets free it */
@ -4026,7 +4026,7 @@ sctp_handle_ootb(struct mbuf *m, int iphlen, int offset,
struct sockaddr *src, struct sockaddr *dst,
struct sctphdr *sh, struct sctp_inpcb *inp,
struct mbuf *cause,
uint8_t use_mflowid, uint32_t mflowid,
uint8_t mflowtype, uint32_t mflowid,
uint32_t vrf_id, uint16_t port)
{
struct sctp_chunkhdr *ch, chunk_buf;
@ -4068,7 +4068,7 @@ sctp_handle_ootb(struct mbuf *m, int iphlen, int offset,
return;
case SCTP_SHUTDOWN_ACK:
sctp_send_shutdown_complete2(src, dst, sh,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
return;
default:
@ -4082,7 +4082,7 @@ sctp_handle_ootb(struct mbuf *m, int iphlen, int offset,
((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) &&
(contains_init_chunk == 0))) {
sctp_send_abort(m, iphlen, src, dst, sh, 0, cause,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
}
}

View File

@ -83,7 +83,7 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, uint16_t port)
#endif
uint32_t mflowid;
uint8_t use_mflowid;
uint8_t mflowtype;
iphlen = *offp;
if (SCTP_GET_PKT_VRFID(*i_pak, vrf_id)) {
@ -113,13 +113,8 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, uint16_t port)
m->m_pkthdr.len,
if_name(m->m_pkthdr.rcvif),
(int)m->m_pkthdr.csum_flags, CSUM_BITS);
if (m->m_flags & M_FLOWID) {
mflowid = m->m_pkthdr.flowid;
use_mflowid = 1;
} else {
mflowid = 0;
use_mflowid = 0;
}
mflowid = m->m_pkthdr.flowid;
mflowtype = M_HASHTYPE_GET(m);
SCTP_STAT_INCR(sctps_recvpackets);
SCTP_STAT_INCR_COUNTER64(sctps_inpackets);
/* Get IP, SCTP, and first chunk header together in the first mbuf. */
@ -180,7 +175,7 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, uint16_t port)
compute_crc,
#endif
ecn_bits,
use_mflowid, mflowid,
mflowtype, mflowid,
vrf_id, port);
out:
if (m) {