diff options
author | rrs <rrs@FreeBSD.org> | 2007-09-13 14:43:54 +0000 |
---|---|---|
committer | rrs <rrs@FreeBSD.org> | 2007-09-13 14:43:54 +0000 |
commit | 6368c8b6996760fbbbf5a02a3334bbf98d9d074f (patch) | |
tree | 1bf870312924584217762bb4c4c0f3cd5ec65aab | |
parent | 73fcd49c8635599cba72011c539ea9f781c1da23 (diff) | |
download | FreeBSD-src-6368c8b6996760fbbbf5a02a3334bbf98d9d074f.zip FreeBSD-src-6368c8b6996760fbbbf5a02a3334bbf98d9d074f.tar.gz |
- DF bit was on for COOKIE-ECHO chunks. This is
incorrect and should be OFF letting IP fragment
large cookie-echos.
- Rename sysctl variable logging to log_level.
- Fix description of sysctl variable stats.
- Add sysctl variable log to make sctp_log readable via sysctl
mechanism (this is by compile switch and targets non KTR platforms or
when someone wants to do performance wise tracing).
- Removed debug code
Approved by: re@freebsd.org (B Mah)
-rw-r--r-- | sys/netinet/sctp_asconf.c | 11 | ||||
-rw-r--r-- | sys/netinet/sctp_constants.h | 5 | ||||
-rw-r--r-- | sys/netinet/sctp_output.c | 11 | ||||
-rw-r--r-- | sys/netinet/sctp_pcb.c | 3 | ||||
-rw-r--r-- | sys/netinet/sctp_sysctl.c | 14 | ||||
-rw-r--r-- | sys/netinet/sctp_sysctl.h | 4 | ||||
-rw-r--r-- | sys/netinet/sctp_uio.h | 16 | ||||
-rw-r--r-- | sys/netinet/sctputil.c | 34 | ||||
-rw-r--r-- | sys/netinet/sctputil.h | 2 |
9 files changed, 60 insertions, 40 deletions
diff --git a/sys/netinet/sctp_asconf.c b/sys/netinet/sctp_asconf.c index a72fa1e..1c56ad8 100644 --- a/sys/netinet/sctp_asconf.c +++ b/sys/netinet/sctp_asconf.c @@ -986,11 +986,9 @@ sctp_move_chunks_from_deleted_prim(struct sctp_tcb *stcb, struct sctp_nets *dst) struct sctp_stream_queue_pending *sp; if (dst->dest_state & SCTP_ADDR_UNCONFIRMED) { - SCTPDBG(SCTP_DEBUG_ASCONF1, "move_chunks_from_deleted_prim: specified destination is UNCONFIRMED\n"); return; } if (stcb->asoc.deleted_primary == NULL) { - SCTPDBG(SCTP_DEBUG_ASCONF1, "move_chunks_from_deleted_prim: Funny, old primary is not stored\n"); return; } asoc = &stcb->asoc; @@ -1028,19 +1026,16 @@ sctp_assoc_immediate_retrans(struct sctp_tcb *stcb, struct sctp_nets *dstnet) int error; if (dstnet->dest_state & SCTP_ADDR_UNCONFIRMED) { - SCTPDBG(SCTP_DEBUG_ASCONF1, "assoc_immediate_retrans: specified destination is UNCONFIRMED\n"); return; } if (stcb->asoc.deleted_primary == NULL) { - SCTPDBG(SCTP_DEBUG_ASCONF1, "assoc_immediate_retrans: Funny, old primary is not stored\n"); return; } if (!TAILQ_EMPTY(&stcb->asoc.sent_queue)) { - SCTPDBG(SCTP_DEBUG_ASCONF1, "Deleted primary is "); + SCTPDBG(SCTP_DEBUG_ASCONF1, "assoc_immediate_retrans: Deleted primary is "); SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, &stcb->asoc.deleted_primary->ro._l_addr.sa); SCTPDBG(SCTP_DEBUG_ASCONF1, "Current Primary is "); SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, &stcb->asoc.primary_destination->ro._l_addr.sa); - SCTPDBG(SCTP_DEBUG_ASCONF1, "Stopping send timer and calling t3rxt_timer\n"); sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, stcb->asoc.deleted_primary, SCTP_FROM_SCTP_TIMER + SCTP_LOC_8); @@ -1053,7 +1048,6 @@ sctp_assoc_immediate_retrans(struct sctp_tcb *stcb, struct sctp_nets *dstnet) error = sctp_t3rxt_timer(stcb->sctp_ep, stcb, stcb->asoc.deleted_primary); if (error) { - SCTPDBG(SCTP_DEBUG_ASCONF1, "t3rxt_timer error\n"); SCTP_INP_DECR_REF(stcb->sctp_ep); return; } @@ -1082,8 +1076,7 @@ sctp_net_immediate_retrans(struct sctp_tcb *stcb, struct sctp_nets *net) { struct sctp_tmit_chunk *chk; - SCTPDBG(SCTP_DEBUG_ASCONF1, "net_immediate_retrans:\n"); - SCTPDBG(SCTP_DEBUG_ASCONF1, "RTO is %d\n", net->RTO); + SCTPDBG(SCTP_DEBUG_ASCONF1, "net_immediate_retrans: RTO is %d\n", net->RTO); sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_TIMER + SCTP_LOC_5); stcb->asoc.cc_functions.sctp_set_initial_cc_param(stcb, net); diff --git a/sys/netinet/sctp_constants.h b/sys/netinet/sctp_constants.h index c059a4d..52bc5b8 100644 --- a/sys/netinet/sctp_constants.h +++ b/sys/netinet/sctp_constants.h @@ -229,11 +229,6 @@ __FBSDID("$FreeBSD$"); * logging flag on too in the sysctl (see in sctp.h). */ -/* For SCTP only logging */ -#define SCTP_MAX_LOGGING_SIZE 30000 -#define SCTP_TRACE_PARAMS 6 - - #define SCTP_LOG_EVENT_UNKNOWN 0 #define SCTP_LOG_EVENT_CWND 1 #define SCTP_LOG_EVENT_BLOCK 2 diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index cd51333..6deffd1 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -7852,7 +7852,7 @@ sctp_send_cookie_echo(struct mbuf *m, chk->rec.chunk_id.can_take_data = 0; chk->sent = SCTP_DATAGRAM_UNSENT; chk->snd_count = 0; - chk->flags = 0; + chk->flags = CHUNK_FLAGS_FRAGMENT_OK; chk->asoc = &stcb->asoc; chk->data = cookie; chk->whoTo = chk->asoc->primary_destination; @@ -11979,6 +11979,15 @@ sctp_lower_sosend(struct socket *so, /* We send in a 0, since we do NOT have any locks */ error = sctp_msg_append(stcb, net, top, srcv, 0); top = NULL; + if (srcv->sinfo_flags & SCTP_EOF) { + /* + * This should only happen for Panda for the mbuf + * send case, which does NOT yet support EEOR mode. + * Thus, we can just set this flag to do the proper + * EOF handling. + */ + got_all_of_the_send = 1; + } } if (error) { goto out; diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index d5aa177..d0fab13 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -4911,6 +4911,9 @@ sctp_pcb_init() sctp_pcb_initialized = 1; bzero(&sctpstat, sizeof(struct sctpstat)); +#if defined(SCTP_LOCAL_TRACE_BUF) + bzero(&sctp_log, sizeof(struct sctp_log)); +#endif (void)SCTP_GETTIME_TIMEVAL(&tv); sctpstat.sctps_discontinuitytime.tv_sec = (uint32_t) tv.tv_sec; sctpstat.sctps_discontinuitytime.tv_usec = (uint32_t) tv.tv_usec; diff --git a/sys/netinet/sctp_sysctl.c b/sys/netinet/sctp_sysctl.c index ec28f61..fd232d9 100644 --- a/sys/netinet/sctp_sysctl.c +++ b/sys/netinet/sctp_sysctl.c @@ -98,6 +98,10 @@ uint32_t sctp_default_frag_interleave = SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DEFAULT; uint32_t sctp_mobility_base = SCTPCTL_MOBILITY_BASE_DEFAULT; uint32_t sctp_mobility_fasthandoff = SCTPCTL_MOBILITY_FASTHANDOFF_DEFAULT; +#if defined(SCTP_LOCAL_TRACE_BUF) +struct sctp_log sctp_log; + +#endif #ifdef SCTP_DEBUG uint32_t sctp_debug_on = SCTPCTL_DEBUG_DEFAULT; @@ -759,7 +763,7 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, max_retran_chunk, CTLTYPE_INT | CTLFLAG_RW &sctp_max_retran_chunk, 0, sysctl_sctp_check, "IU", SCTPCTL_MAX_RETRAN_CHUNK_DESC); -SYSCTL_PROC(_net_inet_sctp, OID_AUTO, logging, CTLTYPE_INT | CTLFLAG_RW, +SYSCTL_PROC(_net_inet_sctp, OID_AUTO, log_level, CTLTYPE_INT | CTLFLAG_RW, &sctp_logging_level, 0, sysctl_sctp_check, "IU", SCTPCTL_LOGGING_LEVEL_DESC); @@ -783,6 +787,12 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, mobility_fasthandoff, CTLTYPE_INT | CTLFLA SCTPCTL_MOBILITY_FASTHANDOFF_DESC); #endif +#if defined(SCTP_LOCAL_TRACE_BUF) +SYSCTL_STRUCT(_net_inet_sctp, OID_AUTO, log, CTLFLAG_RD, + &sctp_log, sctp_log, + "SCTP logging (struct sctp_log)"); +#endif + #ifdef SCTP_DEBUG SYSCTL_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_INT | CTLFLAG_RW, &sctp_debug_on, 0, sysctl_sctp_check, "IU", @@ -792,7 +802,7 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_INT | CTLFLAG_RW, SYSCTL_STRUCT(_net_inet_sctp, OID_AUTO, stats, CTLFLAG_RW, &sctpstat, sctpstat, - "SCTP statistics (struct sctps_stat, netinet/sctp.h"); + "SCTP statistics (struct sctp_stat)"); SYSCTL_PROC(_net_inet_sctp, OID_AUTO, assoclist, CTLFLAG_RD, 0, 0, sctp_assoclist, diff --git a/sys/netinet/sctp_sysctl.h b/sys/netinet/sctp_sysctl.h index cb83f4e..15d9798 100644 --- a/sys/netinet/sctp_sysctl.h +++ b/sys/netinet/sctp_sysctl.h @@ -501,6 +501,10 @@ extern uint32_t sctp_default_frag_interleave; extern uint32_t sctp_mobility_base; extern uint32_t sctp_mobility_fasthandoff; +#if defined(SCTP_LOCAL_TRACE_BUF) +extern struct sctp_log sctp_log; + +#endif #if defined(SCTP_DEBUG) extern uint32_t sctp_debug_on; diff --git a/sys/netinet/sctp_uio.h b/sys/netinet/sctp_uio.h index 477ef58..72bebc7 100644 --- a/sys/netinet/sctp_uio.h +++ b/sys/netinet/sctp_uio.h @@ -1017,6 +1017,22 @@ struct xsctp_raddr { struct sctp_timeval start_time; /* sctpAssocLocalRemEntry 8 */ }; +#define SCTP_MAX_LOGGING_SIZE 30000 +#define SCTP_TRACE_PARAMS 6 /* This number MUST be even */ + +struct sctp_log_entry { + u_int64_t timestamp; + uint32_t subsys; + uint32_t padding; + uint32_t params[SCTP_TRACE_PARAMS]; +}; + +struct sctp_log { + struct sctp_log_entry entry[SCTP_MAX_LOGGING_SIZE]; + uint32_t index; + uint32_t padding; +}; + /* * Kernel defined for sctp_send */ diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 8b4d47b..6c17576 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -6459,40 +6459,30 @@ sctp_local_addr_count(struct sctp_tcb *stcb) #if defined(SCTP_LOCAL_TRACE_BUF) -struct sctp_dump_log { - u_int64_t timestamp; - const char *descr; - uint32_t subsys; - uint32_t params[SCTP_TRACE_PARAMS]; -}; -int sctp_log_index = 0; -struct sctp_dump_log sctp_log[SCTP_MAX_LOGGING_SIZE]; - void -sctp_log_trace(uint32_t subsys, const char *str, uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_t e, uint32_t f) +sctp_log_trace(uint32_t subsys, const char *str SCTP_UNUSED, uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_t e, uint32_t f) { - int saveindex, newindex; + uint32_t saveindex, newindex; do { - saveindex = sctp_log_index; + saveindex = sctp_log.index; if (saveindex >= SCTP_MAX_LOGGING_SIZE) { newindex = 1; } else { newindex = saveindex + 1; } - } while (atomic_cmpset_int(&sctp_log_index, saveindex, newindex) == 0); + } while (atomic_cmpset_int(&sctp_log.index, saveindex, newindex) == 0); if (saveindex >= SCTP_MAX_LOGGING_SIZE) { saveindex = 0; } - sctp_log[saveindex].timestamp = SCTP_GET_CYCLECOUNT; - sctp_log[saveindex].subsys = subsys; - sctp_log[saveindex].descr = str; - sctp_log[saveindex].params[0] = a; - sctp_log[saveindex].params[1] = b; - sctp_log[saveindex].params[2] = c; - sctp_log[saveindex].params[3] = d; - sctp_log[saveindex].params[4] = e; - sctp_log[saveindex].params[5] = f; + sctp_log.entry[saveindex].timestamp = SCTP_GET_CYCLECOUNT; + sctp_log.entry[saveindex].subsys = subsys; + sctp_log.entry[saveindex].params[0] = a; + sctp_log.entry[saveindex].params[1] = b; + sctp_log.entry[saveindex].params[2] = c; + sctp_log.entry[saveindex].params[3] = d; + sctp_log.entry[saveindex].params[4] = e; + sctp_log.entry[saveindex].params[5] = f; } #endif diff --git a/sys/netinet/sctputil.h b/sys/netinet/sctputil.h index 8d02967..be03027 100644 --- a/sys/netinet/sctputil.h +++ b/sys/netinet/sctputil.h @@ -56,7 +56,7 @@ void sctp_m_freem(struct mbuf *m); #if defined(SCTP_LOCAL_TRACE_BUF) || defined(__APPLE__) void - sctp_log_trace(uint32_t fr, const char *str, uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_t e, uint32_t f); + sctp_log_trace(uint32_t fr, const char *str SCTP_UNUSED, uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_t e, uint32_t f); #endif |