summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctp_input.c
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2007-06-14 22:59:04 +0000
committerrrs <rrs@FreeBSD.org>2007-06-14 22:59:04 +0000
commit5db775aaced05bbda585e596739fe8150a74d68d (patch)
tree54d00675be01f15ab0ef5ba5c19c020edee43762 /sys/netinet/sctp_input.c
parent491996f8103df505e60bc52e817f90a4bccba59e (diff)
downloadFreeBSD-src-5db775aaced05bbda585e596739fe8150a74d68d.zip
FreeBSD-src-5db775aaced05bbda585e596739fe8150a74d68d.tar.gz
- Fix so ifn's are properly deleted when the ref count goes to 0.
- Fix so VRF's will clean themselves up when no references are around. - Allow sctp_ifa to be passed into inpcb_bind, addr_mgmt_ep_sa to bypass normal validation checks. - turn auto-asconf off for subset bound sockets - Moves all logging to use KTR. This gets rid of most of the logging #ifdef's with a few exceptions reducing the number of config options for SCTP.
Diffstat (limited to 'sys/netinet/sctp_input.c')
-rw-r--r--sys/netinet/sctp_input.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c
index 1042159..0baeaba 100644
--- a/sys/netinet/sctp_input.c
+++ b/sys/netinet/sctp_input.c
@@ -183,10 +183,9 @@ sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb,
TAILQ_FOREACH(lnet, &asoc->nets, sctp_next) {
lnet->ssthresh = asoc->peers_rwnd;
-#if defined(SCTP_CWND_MONITOR) || defined(SCTP_CWND_LOGGING)
- sctp_log_cwnd(stcb, lnet, 0, SCTP_CWND_INITIALIZATION);
-#endif
-
+ if (sctp_logging_level & (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) {
+ sctp_log_cwnd(stcb, lnet, 0, SCTP_CWND_INITIALIZATION);
+ }
}
}
SCTP_TCB_SEND_LOCK(stcb);
@@ -233,9 +232,9 @@ sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb,
asoc->streamoutcnt = asoc->pre_open_streams;
/* init tsn's */
asoc->highest_tsn_inside_map = asoc->asconf_seq_in = ntohl(init->initial_tsn) - 1;
-#ifdef SCTP_MAP_LOGGING
- sctp_log_map(0, 5, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT);
-#endif
+ if (sctp_logging_level & SCTP_MAP_LOGGING_ENABLE) {
+ sctp_log_map(0, 5, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT);
+ }
/* This is the next one we expect */
asoc->str_reset_seq_in = asoc->asconf_seq_in + 1;
@@ -2312,11 +2311,9 @@ sctp_handle_ecn_echo(struct sctp_ecne_chunk *cp,
net = stcb->asoc.primary_destination;
if (compare_with_wrap(tsn, stcb->asoc.last_cwr_tsn, MAX_TSN)) {
-#ifdef SCTP_CWND_MONITOR
int old_cwnd;
old_cwnd = net->cwnd;
-#endif
SCTP_STAT_INCR(sctps_ecnereducedcwnd);
net->ssthresh = net->cwnd / 2;
if (net->ssthresh < net->mtu) {
@@ -2325,9 +2322,9 @@ sctp_handle_ecn_echo(struct sctp_ecne_chunk *cp,
net->RTO <<= 1;
}
net->cwnd = net->ssthresh;
-#ifdef SCTP_CWND_MONITOR
- sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT);
-#endif
+ if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT);
+ }
/*
* we reduce once every RTT. So we will only lower cwnd at
* the next sending seq i.e. the resync_tsn.
@@ -2527,13 +2524,13 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc,
stcb, tp1->whoTo);
/* fix counts and things */
-#ifdef SCTP_FLIGHT_LOGGING
- sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_PDRP,
- tp1->whoTo->flight_size,
- tp1->book_size,
- (uintptr_t) stcb,
- tp1->rec.data.TSN_seq);
-#endif
+ if (sctp_logging_level & SCTP_FLIGHT_LOGGING_ENABLE) {
+ sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_PDRP,
+ tp1->whoTo->flight_size,
+ tp1->book_size,
+ (uintptr_t) stcb,
+ tp1->rec.data.TSN_seq);
+ }
sctp_flight_size_decrease(tp1);
sctp_total_flight_decrease(stcb, tp1);
} {
@@ -3322,10 +3319,8 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk *cp,
uint32_t bw_avail;
int rtt, incr;
-#ifdef SCTP_CWND_MONITOR
int old_cwnd = net->cwnd;
-#endif
/* need real RTT for this calc */
rtt = ((net->lastsa >> 2) + net->lastsv) >> 1;
/* get bottle neck bw */
@@ -3420,13 +3415,13 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk *cp,
/* We always have 1 MTU */
net->cwnd = net->mtu;
}
-#ifdef SCTP_CWND_MONITOR
if (net->cwnd - old_cwnd != 0) {
/* log only changes */
- sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd),
- SCTP_CWND_LOG_FROM_SAT);
+ if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd),
+ SCTP_CWND_LOG_FROM_SAT);
+ }
}
-#endif
}
}
@@ -3650,6 +3645,7 @@ process_control_chunks:
chk_length = ntohs(ch->chunk_length);
SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_process_control: processing a chunk type=%u, len=%u\n",
ch->chunk_type, chk_length);
+ SCTP_LTRACE_CHK(inp, stcb, ch->chunk_type, chk_length);
if (chk_length < sizeof(*ch) ||
(*offset + (int)chk_length) > length) {
*offset = length;
@@ -4711,12 +4707,14 @@ sctp_input(i_pak, off)
#ifdef SCTP_MBUF_LOGGING
/* Log in any input mbufs */
- mat = m;
- while (mat) {
- if (SCTP_BUF_IS_EXTENDED(mat)) {
- sctp_log_mb(mat, SCTP_MBUF_INPUT);
+ if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) {
+ mat = m;
+ while (mat) {
+ if (SCTP_BUF_IS_EXTENDED(mat)) {
+ sctp_log_mb(mat, SCTP_MBUF_INPUT);
+ }
+ mat = SCTP_BUF_NEXT(mat);
}
- mat = SCTP_BUF_NEXT(mat);
}
#endif
#ifdef SCTP_PACKET_LOGGING
OpenPOWER on IntegriCloud