summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctp_input.c
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2007-06-13 01:31:53 +0000
committerrrs <rrs@FreeBSD.org>2007-06-13 01:31:53 +0000
commit20ad8ecfb0af809f13b9dc6e5ab994548e0d785c (patch)
tree8d5bbe40650c2eb2f33e58ff8a55f66ae96d6c38 /sys/netinet/sctp_input.c
parentec70de06d657f80cf4eaa0dee9fa7938ca45ac46 (diff)
downloadFreeBSD-src-20ad8ecfb0af809f13b9dc6e5ab994548e0d785c.zip
FreeBSD-src-20ad8ecfb0af809f13b9dc6e5ab994548e0d785c.tar.gz
- Fixed cookie handling to calc an RTO when
its an INIT collision case. - Fixed RTO calc to maintain a seperate variable to track if a RTO calc as been done, this allows the RTO var to be doubled during initial timeouts. - Reduces the amount of stack used by process control. - Use a constant for the peer chunk overhead. - Name change to spell candidate correctly.
Diffstat (limited to 'sys/netinet/sctp_input.c')
-rw-r--r--sys/netinet/sctp_input.c67
1 files changed, 25 insertions, 42 deletions
diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c
index d1dff3c..1042159 100644
--- a/sys/netinet/sctp_input.c
+++ b/sys/netinet/sctp_input.c
@@ -1144,6 +1144,8 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
* double things
*/
net->hb_responded = 1;
+ net->RTO = sctp_calculate_rto(stcb, asoc, net,
+ &cookie->time_entered);
if (stcb->asoc.sctp_autoclose_ticks &&
(sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE))) {
@@ -1718,9 +1720,10 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
}
/* respond with a COOKIE-ACK */
/* calculate the RTT */
- if ((netp) && (*netp))
+ if ((netp) && (*netp)) {
(*netp)->RTO = sctp_calculate_rto(stcb, asoc, *netp,
&cookie->time_entered);
+ }
sctp_send_cookie_ack(stcb);
return (stcb);
}
@@ -3673,14 +3676,20 @@ process_control_chunks:
}
return (NULL);
}
- } else if (ch->chunk_type == SCTP_COOKIE_ECHO) {
+ } else {
+ /*
+ * For cookies and all other chunks. if the
+ */
if (chk_length > sizeof(chunk_buf)) {
/*
* use just the size of the chunk buffer so
- * the front part of our cookie is intact.
- * The rest of cookie processing should use
- * the sctp_m_getptr() function to access
- * the other parts.
+ * the front part of our chunks fit in
+ * contiguous space up to the chunk buffer
+ * size (508 bytes). For chunks that need to
+ * get more than that they mus use the
+ * sctp_m_getptr() function or other means
+ * (know how to parse mbuf chains). Cookies
+ * do this already.
*/
ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset,
(sizeof(chunk_buf) - 4),
@@ -3694,44 +3703,16 @@ process_control_chunks:
}
} else {
/* We can fit it all */
- goto all_fits;
- }
- } else {
- /* get a complete chunk... */
- if (chk_length > sizeof(chunk_buf)) {
- struct mbuf *oper;
- struct sctp_paramhdr *phdr;
-
- oper = NULL;
- if (stcb) {
- oper = sctp_get_mbuf_for_msg(sizeof(struct sctp_paramhdr),
- 0, M_DONTWAIT, 1, MT_DATA);
-
- if (oper) {
- /* pre-reserve some space */
- SCTP_BUF_RESV_UF(oper, sizeof(struct sctp_chunkhdr));
- SCTP_BUF_LEN(oper) = sizeof(struct sctp_paramhdr);
- phdr = mtod(oper, struct sctp_paramhdr *);
- phdr->param_type = htons(SCTP_CAUSE_OUT_OF_RESC);
- phdr->param_length = htons(sizeof(struct sctp_paramhdr));
- sctp_queue_op_err(stcb, oper);
+ ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset,
+ chk_length, chunk_buf);
+ if (ch == NULL) {
+ SCTP_PRINTF("sctp_process_control: Can't get the all data....\n");
+ *offset = length;
+ if (locked_tcb) {
+ SCTP_TCB_UNLOCK(locked_tcb);
}
+ return (NULL);
}
- if (locked_tcb) {
- SCTP_TCB_UNLOCK(locked_tcb);
- }
- return (NULL);
- }
- all_fits:
- ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset,
- chk_length, chunk_buf);
- if (ch == NULL) {
- SCTP_PRINTF("sctp_process_control: Can't get the all data....\n");
- *offset = length;
- if (locked_tcb) {
- SCTP_TCB_UNLOCK(locked_tcb);
- }
- return (NULL);
}
}
num_chunks++;
@@ -3814,6 +3795,8 @@ process_control_chunks:
}
return (NULL);
break;
+ case SCTP_PAD_CHUNK:
+ break;
case SCTP_INITIATION_ACK:
/* must be first and only chunk */
SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_INIT-ACK\n");
OpenPOWER on IntegriCloud