diff options
author | Randall Stewart <rrs@FreeBSD.org> | 2008-06-14 07:58:05 +0000 |
---|---|---|
committer | Randall Stewart <rrs@FreeBSD.org> | 2008-06-14 07:58:05 +0000 |
commit | b3f1ea41fdf4567ea8639aa1fd94f1a89de2d042 (patch) | |
tree | 3df882f31d5c2904b2d47df7b10bea16002c929b /sys/netinet/sctp_usrreq.c | |
parent | 37f44cb4289f68504f5ac2097eb5d8d4d31c4390 (diff) | |
download | src-b3f1ea41fdf4567ea8639aa1fd94f1a89de2d042.tar.gz src-b3f1ea41fdf4567ea8639aa1fd94f1a89de2d042.zip |
- Macro-izes the packed declaration in all headers.
- Vimage prep - these are major restructures to move
all global variables to be accessed via a macro or two.
The variables all go into a single structure.
- Asconf address addition tweaks (add_or_del Interfaces)
- Fix rwnd calcualtion to be more conservative.
- Support SACK_IMMEDIATE flag to skip delayed sack
by demand of peer.
- Comment updates in the sack mapping calculations
- Invarients panic added.
- Pre-support for UDP tunneling (we can do this on
MAC but will need added support from UDP to
get a "pipe" of UDP packets in.
- clear trace buffer sysctl added when local tracing on.
Note the majority of this huge patch is all the vimage prep stuff :-)
Notes
Notes:
svn path=/head/; revision=179783
Diffstat (limited to 'sys/netinet/sctp_usrreq.c')
-rw-r--r-- | sys/netinet/sctp_usrreq.c | 67 |
1 files changed, 41 insertions, 26 deletions
diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index c1a1acd1493b..1fb2b07f53a7 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -57,48 +57,63 @@ __FBSDID("$FreeBSD$"); void sctp_init(void) { - /* Init the SCTP pcb in sctp_pcb.c */ u_long sb_max_adj; - sctp_pcb_init(); + bzero(&SCTP_BASE_STATS, sizeof(struct sctpstat)); + /* Initialize and modify the sysctled variables */ + sctp_init_sysctls(); if ((nmbclusters / 8) > SCTP_ASOC_MAX_CHUNKS_ON_QUEUE) - sctp_max_chunks_on_queue = (nmbclusters / 8); + SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue) = (nmbclusters / 8); /* * Allow a user to take no more than 1/2 the number of clusters or * the SB_MAX whichever is smaller for the send window. */ sb_max_adj = (u_long)((u_quad_t) (SB_MAX) * MCLBYTES / (MSIZE + MCLBYTES)); - sctp_sendspace = min(sb_max_adj, + SCTP_BASE_SYSCTL(sctp_sendspace) = min(sb_max_adj, (((uint32_t) nmbclusters / 2) * SCTP_DEFAULT_MAXSEGMENT)); /* * Now for the recv window, should we take the same amount? or * should I do 1/2 the SB_MAX instead in the SB_MAX min above. For * now I will just copy. */ - sctp_recvspace = sctp_sendspace; + SCTP_BASE_SYSCTL(sctp_recvspace) = SCTP_BASE_SYSCTL(sctp_sendspace); -} + SCTP_BASE_VAR(first_time) = 0; + SCTP_BASE_VAR(sctp_pcb_initialized) = 0; + sctp_pcb_init(); +#if defined(SCTP_PACKET_LOGGING) + SCTP_BASE_VAR(packet_log_writers) = 0; + SCTP_BASE_VAR(packet_log_end) = 0; + bzero(&SCTP_BASE_VAR(packet_log_buffer), SCTP_PACKET_LOG_SIZE); +#endif +} + +void +sctp_finish(void) +{ + sctp_pcb_finish(); +} /* - * cleanup of the sctppcbinfo structure. - * Assumes that the sctppcbinfo lock is held. + * cleanup of the SCTP_BASE_INFO() structure. + * Assumes that the SCTP_BASE_INFO() lock is held. */ void sctp_pcbinfo_cleanup(void) { /* free the hash tables */ - if (sctppcbinfo.sctp_asochash != NULL) - SCTP_HASH_FREE(sctppcbinfo.sctp_asochash, sctppcbinfo.hashasocmark); - if (sctppcbinfo.sctp_ephash != NULL) - SCTP_HASH_FREE(sctppcbinfo.sctp_ephash, sctppcbinfo.hashmark); - if (sctppcbinfo.sctp_tcpephash != NULL) - SCTP_HASH_FREE(sctppcbinfo.sctp_tcpephash, sctppcbinfo.hashtcpmark); - if (sctppcbinfo.sctp_restarthash != NULL) - SCTP_HASH_FREE(sctppcbinfo.sctp_restarthash, sctppcbinfo.hashrestartmark); + if (SCTP_BASE_INFO(sctp_asochash) != NULL) + SCTP_HASH_FREE(SCTP_BASE_INFO(sctp_asochash), SCTP_BASE_INFO(hashasocmark)); + if (SCTP_BASE_INFO(sctp_ephash) != NULL) + SCTP_HASH_FREE(SCTP_BASE_INFO(sctp_ephash), SCTP_BASE_INFO(hashmark)); + if (SCTP_BASE_INFO(sctp_tcpephash) != NULL) + SCTP_HASH_FREE(SCTP_BASE_INFO(sctp_tcpephash), SCTP_BASE_INFO(hashtcpmark)); + if (SCTP_BASE_INFO(sctp_restarthash) != NULL) + SCTP_HASH_FREE(SCTP_BASE_INFO(sctp_restarthash), SCTP_BASE_INFO(hashrestartmark)); } @@ -134,7 +149,7 @@ sctp_pathmtu_adjustment(struct sctp_inpcb *inp, } chk->sent = SCTP_DATAGRAM_RESEND; chk->rec.data.doing_fast_retransmit = 0; - if (sctp_logging_level & SCTP_FLIGHT_LOGGING_ENABLE) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FLIGHT_LOGGING_ENABLE) { sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_PMTU, chk->whoTo->flight_size, chk->book_size, @@ -293,7 +308,7 @@ sctp_notify(struct sctp_inpcb *inp, * PF state. */ /* Stop any running T3 timers here? */ - if (sctp_cmt_on_off && sctp_cmt_pf) { + if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && SCTP_BASE_SYSCTL(sctp_cmt_pf)) { net->dest_state &= ~SCTP_ADDR_PF; SCTPDBG(SCTP_DEBUG_TIMER4, "Destination %p moved from PF to unreachable.\n", net); @@ -521,7 +536,7 @@ sctp_attach(struct socket *so, int proto, struct thread *p) SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return EINVAL; } - error = SCTP_SORESERVE(so, sctp_sendspace, sctp_recvspace); + error = SCTP_SORESERVE(so, SCTP_BASE_SYSCTL(sctp_sendspace), SCTP_BASE_SYSCTL(sctp_recvspace)); if (error) { return error; } @@ -1674,7 +1689,7 @@ flags_out: struct sctp_assoc_value *av; SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, *optsize); - if (sctp_cmt_on_off) { + if (SCTP_BASE_SYSCTL(sctp_cmt_on_off)) { SCTP_FIND_STCB(inp, stcb, av->assoc_id); if (stcb) { av->assoc_value = stcb->asoc.sctp_cmt_on_off; @@ -2740,7 +2755,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, struct sctp_assoc_value *av; SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, optsize); - if (sctp_cmt_on_off) { + if (SCTP_BASE_SYSCTL(sctp_cmt_on_off)) { SCTP_FIND_STCB(inp, stcb, av->assoc_id); if (stcb) { stcb->asoc.sctp_cmt_on_off = (uint8_t) av->assoc_value; @@ -3699,8 +3714,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, stcb->asoc.maxrto = new_max; stcb->asoc.minrto = new_min; } else { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EDOM); - error = EDOM; + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; } SCTP_TCB_UNLOCK(stcb); } else { @@ -3722,8 +3737,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, inp->sctp_ep.sctp_maxrto = new_max; inp->sctp_ep.sctp_minrto = new_min; } else { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EDOM); - error = EDOM; + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; } SCTP_INP_WUNLOCK(inp); } @@ -4190,7 +4205,7 @@ sctp_listen(struct socket *so, int backlog, struct thread *p) } SCTP_INP_RLOCK(inp); #ifdef SCTP_LOCK_LOGGING - if (sctp_logging_level & SCTP_LOCK_LOGGING_ENABLE) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) { sctp_log_lock(inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_SOCK); } #endif |