summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctp_input.c
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2007-06-01 11:19:54 +0000
committerrrs <rrs@FreeBSD.org>2007-06-01 11:19:54 +0000
commitf978918265146648d92dec52ff74fbf46eb3f5f9 (patch)
treec2755093118649fbe976c97b2ea337fa91ffad1b /sys/netinet/sctp_input.c
parent4623bf3eb19a3fc2581cc6506b9754427f5e3687 (diff)
downloadFreeBSD-src-f978918265146648d92dec52ff74fbf46eb3f5f9.zip
FreeBSD-src-f978918265146648d92dec52ff74fbf46eb3f5f9.tar.gz
- Take out the broken table-id concept. Panda Routers have a M-VRF
concept that is NOT well thought out for a multi-homed transport protocol. So the useless table-id entries passed around need to be removed. - Add a event timer for the zero copy api. - Fix a bug in sctp_timer.c when searching for an alternate with the largest ssthresh (the compare was wrong).
Diffstat (limited to 'sys/netinet/sctp_input.c')
-rw-r--r--sys/netinet/sctp_input.c110
1 files changed, 46 insertions, 64 deletions
diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c
index 249b9f2..85cfeed 100644
--- a/sys/netinet/sctp_input.c
+++ b/sys/netinet/sctp_input.c
@@ -78,8 +78,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,
- uint32_t table_id)
+ struct sctp_nets *net, int *abort_no_unlock, uint32_t vrf_id)
{
struct sctp_init *init;
struct mbuf *op_err;
@@ -99,7 +98,7 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh,
* match/restart case?
*/
sctp_abort_association(inp, stcb, m, iphlen, sh, op_err,
- vrf_id, table_id);
+ vrf_id);
if (stcb)
*abort_no_unlock = 1;
return;
@@ -108,7 +107,7 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh,
/* Invalid length */
op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM);
sctp_abort_association(inp, stcb, m, iphlen, sh, op_err,
- vrf_id, table_id);
+ vrf_id);
if (stcb)
*abort_no_unlock = 1;
return;
@@ -118,7 +117,7 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh,
/* protocol error... send abort */
op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM);
sctp_abort_association(inp, stcb, m, iphlen, sh, op_err,
- vrf_id, table_id);
+ vrf_id);
if (stcb)
*abort_no_unlock = 1;
return;
@@ -127,14 +126,14 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh,
/* invalid parameter... send abort */
op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM);
sctp_abort_association(inp, stcb, m, iphlen, sh, op_err,
- vrf_id, table_id);
+ vrf_id);
return;
}
if (init->num_inbound_streams == 0) {
/* protocol error... send abort */
op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM);
sctp_abort_association(inp, stcb, m, iphlen, sh, op_err,
- vrf_id, table_id);
+ vrf_id);
if (stcb)
*abort_no_unlock = 1;
return;
@@ -143,7 +142,7 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh,
/* protocol error... send abort */
op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM);
sctp_abort_association(inp, stcb, m, iphlen, sh, op_err,
- vrf_id, table_id);
+ vrf_id);
if (stcb)
*abort_no_unlock = 1;
return;
@@ -152,16 +151,14 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh,
if (sctp_validate_init_auth_params(m, offset + sizeof(*cp),
init_limit)) {
/* auth parameter(s) error... send abort */
- sctp_abort_association(inp, stcb, m, iphlen, sh, NULL, vrf_id,
- table_id);
+ sctp_abort_association(inp, stcb, m, iphlen, sh, NULL, vrf_id);
if (stcb)
*abort_no_unlock = 1;
return;
}
/* send an INIT-ACK w/cookie */
SCTPDBG(SCTP_DEBUG_INPUT3, "sctp_handle_init: sending INIT-ACK\n");
- sctp_send_initiate_ack(inp, stcb, m, iphlen, offset, sh, cp, vrf_id,
- table_id);
+ sctp_send_initiate_ack(inp, stcb, m, iphlen, offset, sh, cp, vrf_id);
}
/*
@@ -306,8 +303,7 @@ sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb,
static int
sctp_process_init_ack(struct mbuf *m, int iphlen, int offset,
struct sctphdr *sh, struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb,
- struct sctp_nets *net, int *abort_no_unlock, uint32_t vrf_id,
- uint32_t table_id)
+ struct sctp_nets *net, int *abort_no_unlock, uint32_t vrf_id)
{
struct sctp_association *asoc;
struct mbuf *op_err;
@@ -343,7 +339,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset,
"Load addresses from INIT causes an abort %d\n",
retval);
sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh,
- NULL, 0, 0);
+ NULL, 0);
*abort_no_unlock = 1;
return (-1);
}
@@ -400,7 +396,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, 0);
+ sh, op_err, 0);
*abort_no_unlock = 1;
}
return (retval);
@@ -859,8 +855,7 @@ sctp_handle_error(struct sctp_chunkhdr *ch,
static int
sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset,
struct sctphdr *sh, struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb,
- struct sctp_nets *net, int *abort_no_unlock, uint32_t vrf_id,
- uint32_t table_id)
+ struct sctp_nets *net, int *abort_no_unlock, uint32_t vrf_id)
{
struct sctp_init_ack *init_ack;
int *state;
@@ -878,7 +873,7 @@ sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset,
/* Invalid length */
op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM);
sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh,
- op_err, 0, 0);
+ op_err, 0);
*abort_no_unlock = 1;
return (-1);
}
@@ -888,7 +883,7 @@ sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset,
/* protocol error... send an abort */
op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM);
sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh,
- op_err, 0, 0);
+ op_err, 0);
*abort_no_unlock = 1;
return (-1);
}
@@ -896,7 +891,7 @@ sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset,
/* protocol error... send an abort */
op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM);
sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh,
- op_err, 0, 0);
+ op_err, 0);
*abort_no_unlock = 1;
return (-1);
}
@@ -904,7 +899,7 @@ sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset,
/* protocol error... send an abort */
op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM);
sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh,
- op_err, 0, 0);
+ op_err, 0);
*abort_no_unlock = 1;
return (-1);
}
@@ -912,7 +907,7 @@ sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset,
/* protocol error... send an abort */
op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM);
sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh,
- op_err, 0, 0);
+ op_err, 0);
*abort_no_unlock = 1;
return (-1);
}
@@ -936,8 +931,7 @@ sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset,
stcb, 0, (void *)stcb->asoc.primary_destination);
}
if (sctp_process_init_ack(m, iphlen, offset, sh, cp, stcb,
- net, abort_no_unlock, vrf_id,
- table_id) < 0) {
+ net, abort_no_unlock, vrf_id) < 0) {
/* error in parsing parameters */
return (-1);
}
@@ -996,7 +990,7 @@ 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 *net,
struct sockaddr *init_src, int *notification, sctp_assoc_t * sac_assoc_id,
- uint32_t vrf_id, uint32_t table_id)
+ uint32_t vrf_id)
{
struct sctp_association *asoc;
struct sctp_init_chunk *init_cp, init_buf;
@@ -1038,7 +1032,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
ph->param_type = htons(SCTP_CAUSE_COOKIE_IN_SHUTDOWN);
ph->param_length = htons(sizeof(struct sctp_paramhdr));
sctp_send_operr_to(m, iphlen, op_err, cookie->peers_vtag,
- vrf_id, table_id);
+ vrf_id);
if (how_indx < sizeof(asoc->cookie_how))
asoc->cookie_how[how_indx] = 2;
return (NULL);
@@ -1473,7 +1467,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,
- uint32_t vrf_id, uint32_t table_id)
+ uint32_t vrf_id)
{
struct sctp_tcb *stcb;
struct sctp_init_chunk *init_cp, init_buf;
@@ -1550,7 +1544,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC);
sctp_abort_association(inp, (struct sctp_tcb *)NULL, m, iphlen,
- sh, op_err, vrf_id, table_id);
+ sh, op_err, vrf_id);
return (NULL);
}
/* get the correct sctp_nets */
@@ -1558,8 +1552,6 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
*netp = sctp_findnet(stcb, init_src);
asoc = &stcb->asoc;
- /* save the table id (vrf_id is done in aloc_assoc) */
- asoc->table_id = table_id;
/* get scope variables out of cookie */
asoc->ipv4_local_scope = cookie->ipv4_scope;
asoc->site_scope = cookie->site_scope;
@@ -1578,7 +1570,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
atomic_add_int(&stcb->asoc.refcnt, 1);
op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC);
sctp_abort_association(inp, (struct sctp_tcb *)NULL, m, iphlen,
- sh, op_err, vrf_id, table_id);
+ sh, op_err, vrf_id);
atomic_add_int(&stcb->asoc.refcnt, -1);
return (NULL);
}
@@ -1743,7 +1735,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
struct sctphdr *sh, struct sctp_cookie_echo_chunk *cp,
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, uint32_t vrf_id, uint32_t table_id)
+ struct sctp_tcb **locked_tcb, uint32_t vrf_id)
{
struct sctp_state_cookie *cookie;
struct sockaddr_in6 sin6;
@@ -1950,7 +1942,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(m, iphlen, op_err, cookie->peers_vtag,
- vrf_id, table_id);
+ vrf_id);
return (NULL);
}
/*
@@ -2030,13 +2022,13 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
/* this is the "normal" case... get a new TCB */
*stcb = sctp_process_cookie_new(m, iphlen, offset, sh, cookie,
cookie_len, *inp_p, netp, to, &notification,
- auth_skipped, auth_offset, auth_len, vrf_id, table_id);
+ auth_skipped, auth_offset, auth_len, vrf_id);
} else {
/* this is abnormal... cookie-echo on existing TCB */
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, table_id);
+ cookie, cookie_len, *inp_p, *stcb, *netp, to,
+ &notification, &sac_restart_id, vrf_id);
}
if (*stcb == NULL) {
@@ -2111,8 +2103,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
SCTPDBG(SCTP_DEBUG_INPUT1, "process_cookie_new: no room for another socket!\n");
op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC);
sctp_abort_association(*inp_p, NULL, m, iphlen,
- sh, op_err, vrf_id,
- table_id);
+ sh, op_err, vrf_id);
sctp_free_assoc(*inp_p, *stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_20);
return (NULL);
}
@@ -3452,7 +3443,7 @@ __attribute__((noinline))
sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length,
struct sctphdr *sh, struct sctp_chunkhdr *ch, struct sctp_inpcb *inp,
struct sctp_tcb *stcb, struct sctp_nets **netp, int *fwd_tsn_seen,
- uint32_t vrf_id, uint32_t table_id)
+ uint32_t vrf_id)
{
struct sctp_association *asoc;
uint32_t vtag_in;
@@ -3583,7 +3574,7 @@ __attribute__((noinline))
if (stcb == NULL) {
/* no association, so it's out of the blue... */
sctp_handle_ootb(m, iphlen, *offset, sh, inp, NULL,
- vrf_id, table_id);
+ vrf_id);
*offset = length;
if (locked_tcb) {
SCTP_TCB_UNLOCK(locked_tcb);
@@ -3620,7 +3611,7 @@ __attribute__((noinline))
SCTP_TCB_UNLOCK(locked_tcb);
}
sctp_handle_ootb(m, iphlen, *offset, sh, inp,
- NULL, vrf_id, table_id);
+ NULL, vrf_id);
return (NULL);
}
} else {
@@ -3812,7 +3803,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, table_id);
+ stcb, *netp, &abort_no_unlock, vrf_id);
}
if (abort_no_unlock)
return (NULL);
@@ -3851,7 +3842,7 @@ process_control_chunks:
}
if ((netp) && (*netp)) {
ret = sctp_handle_init_ack(m, iphlen, *offset, sh,
- (struct sctp_init_ack_chunk *)ch, stcb, *netp, &abort_no_unlock, vrf_id, table_id);
+ (struct sctp_init_ack_chunk *)ch, stcb, *netp, &abort_no_unlock, vrf_id);
} else {
ret = -1;
}
@@ -4028,8 +4019,7 @@ process_control_chunks:
goto process_cookie_anyway;
}
sctp_abort_association(inp, stcb, m, iphlen,
- sh, NULL, vrf_id,
- table_id);
+ sh, NULL, vrf_id);
*offset = length;
return (NULL);
} else if (inp->sctp_socket->so_qlimit) {
@@ -4055,7 +4045,7 @@ process_control_chunks:
htons(sizeof(struct sctp_paramhdr));
}
sctp_abort_association(inp, stcb, m,
- iphlen, sh, oper, vrf_id, table_id);
+ iphlen, sh, oper, vrf_id);
}
*offset = length;
return (NULL);
@@ -4085,8 +4075,7 @@ process_control_chunks:
auth_offset,
auth_len,
&locked_tcb,
- vrf_id,
- table_id);
+ vrf_id);
} else {
ret_buf = NULL;
}
@@ -4483,7 +4472,7 @@ void
sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset,
int length, struct sctphdr *sh, struct sctp_chunkhdr *ch,
struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets *net,
- uint8_t ecn_bits, uint32_t vrf_id, uint32_t table_id)
+ uint8_t ecn_bits, uint32_t vrf_id)
{
/*
* Control chunk processing
@@ -4512,7 +4501,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset,
/* process the control portion of the SCTP packet */
/* sa_ignore NO_NULL_CHK */
stcb = sctp_process_control(m, iphlen, &offset, length, sh, ch,
- inp, stcb, &net, &fwd_tsn_seen, vrf_id, table_id);
+ inp, stcb, &net, &fwd_tsn_seen, vrf_id);
if (stcb) {
/*
* This covers us if the cookie-echo was there and
@@ -4542,7 +4531,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset,
if (stcb == NULL) {
/* out of the blue DATA chunk */
sctp_handle_ootb(m, iphlen, offset, sh, inp, NULL,
- vrf_id, table_id);
+ vrf_id);
return;
}
if (stcb->asoc.my_vtag != ntohl(sh->v_tag)) {
@@ -4603,7 +4592,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset,
* We consider OOTB any data sent during asoc setup.
*/
sctp_handle_ootb(m, iphlen, offset, sh, inp, NULL,
- vrf_id, table_id);
+ vrf_id);
SCTP_TCB_UNLOCK(stcb);
return;
break;
@@ -4705,7 +4694,7 @@ sctp_input(i_pak, off)
#endif
struct mbuf *m;
int iphlen;
- uint32_t vrf_id = 0, table_id = 0;
+ uint32_t vrf_id = 0;
uint8_t ecn_bits;
struct ip *ip;
struct sctphdr *sh;
@@ -4723,10 +4712,6 @@ sctp_input(i_pak, off)
SCTP_RELEASE_PKT(i_pak);
return;
}
- if (SCTP_GET_PKT_TABLEID(i_pak, table_id)) {
- SCTP_RELEASE_PKT(i_pak);
- return;
- }
mlen = SCTP_HEADER_LEN(i_pak);
iphlen = off;
m = SCTP_HEADER_TO_CHAIN(i_pak);
@@ -4865,16 +4850,14 @@ 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,
- table_id);
+ sctp_send_shutdown_complete2(m, iphlen, sh, vrf_id);
goto bad;
}
if (ch->chunk_type == SCTP_SHUTDOWN_COMPLETE) {
goto bad;
}
if (ch->chunk_type != SCTP_ABORT_ASSOCIATION)
- sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id,
- table_id);
+ sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id);
goto bad;
} else if (stcb == NULL) {
refcount_up = 1;
@@ -4902,8 +4885,7 @@ sctp_skip_csum_4:
/* sa_ignore NO_NULL_CHK */
sctp_common_input_processing(&m, iphlen, offset, length, sh, ch,
- inp, stcb, net, ecn_bits, vrf_id,
- table_id);
+ inp, stcb, net, ecn_bits, vrf_id);
/* inp's ref-count reduced && stcb unlocked */
if (m) {
sctp_m_freem(m);
OpenPOWER on IntegriCloud