- 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.
This commit is contained in:
Randall Stewart 2007-06-14 22:59:04 +00:00
parent dcb5531bb2
commit 80fefe0a08
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=170744
22 changed files with 1117 additions and 1244 deletions

View File

@ -397,30 +397,18 @@ XBONEHACK
# SCTP
#
SCTP opt_sctp.h
SCTP_DEBUG opt_sctp.h
SCTP_HIGH_SPEED opt_sctp.h
SCTP_LOG_MAXBURST opt_sctp.h
SCTP_LOG_RWND opt_sctp.h
SCTP_STAT_LOGGING opt_sctp.h
SCTP_CWND_LOGGING opt_sctp.h
SCTP_CWND_MONITOR opt_sctp.h
SCTP_BLK_LOGGING opt_sctp.h
SCTP_STR_LOGGING opt_sctp.h
SCTP_FR_LOGGING opt_sctp.h
SCTP_MAP_LOGGING opt_sctp.h
SCTP_SACK_LOGGING opt_sctp.h
SCTP_LOCK_LOGGING opt_sctp.h
SCTP_RTTVAR_LOGGING opt_sctp.h
SCTP_SB_LOGGING opt_sctp.h
SCTP_WITH_NO_CSUM opt_sctp.h
SCTP_EARLYFR_LOGGING opt_sctp.h
SCTP_NAGLE_LOGGING opt_sctp.h
SCTP_WAKE_LOGGING opt_sctp.h
SCTP_RECV_RWND_LOGGING opt_sctp.h
SCTP_SACK_RWND_LOGGING opt_sctp.h
SCTP_FLIGHT_LOGGING opt_sctp.h
SCTP_MBUF_LOGGING opt_sctp.h
SCTP_PACKET_LOGGING opt_sctp.h
SCTP_DEBUG opt_sctp.h # Enable debug printfs
SCTP_HIGH_SPEED opt_sctp.h # Enable Sally Floyds HS TCP CC
SCTP_WITH_NO_CSUM opt_sctp.h # Use this at your peril
SCTP_LOCK_LOGGING opt_sctp.h # Log to KTR lock activity
SCTP_MBUF_LOGGING opt_sctp.h # Log to KTR general mbuf aloc/free
SCTP_MBCNT_LOGGING opt_sctp.h # Log to KTR mbcnt activity
SCTP_PACKET_LOGGING opt_sctp.h # Log to a packet buffer last N packets
SCTP_LTRACE_CHUNKS opt_sctp.h # Log to KTR chunks processed
SCTP_LTRACE_ERRORS opt_sctp.h # Log to KTR error returns.
#
#
#
# Netgraph(4). Use option NETGRAPH to enable the base netgraph code.
# Each netgraph node type can be either be compiled into the kernel

View File

@ -477,7 +477,41 @@ __attribute__((packed));
#include <netinet/sctp_uio.h>
/* This dictates the size of the packet
* collection buffer. This only applies
* if SCTP_PACKET_LOGGING is enabled in
* your config.
*/
#define SCTP_PACKET_LOG_SIZE 65536
/* Types of logging/KTR tracing that can be enabled via the
* sysctl net.inet.sctp.sctp_logging. You must also enable
* SUBSYS tracing.
* Note that you must have the SCTP option in the kernel
* to enable these as well.
*/
#define SCTP_BLK_LOGGING_ENABLE 0x00000001
#define SCTP_CWND_MONITOR_ENABLE 0x00000002
#define SCTP_CWND_LOGGING_ENABLE 0x00000004
#define SCTP_EARLYFR_LOGGING_ENABLE 0x00000010
#define SCTP_FLIGHT_LOGGING_ENABLE 0x00000020
#define SCTP_FR_LOGGING_ENABLE 0x00000040
#define SCTP_LOCK_LOGGING_ENABLE 0x00000080
#define SCTP_MAP_LOGGING_ENABLE 0x00000100
#define SCTP_MBCNT_LOGGING_ENABLE 0x00000200
#define SCTP_MBUF_LOGGING_ENABLE 0x00000400
#define SCTP_NAGLE_LOGGING_ENABLE 0x00000800
#define SCTP_RECV_RWND_LOGGING_ENABLE 0x00001000
#define SCTP_RTTVAR_LOGGING_ENABLE 0x00002000
#define SCTP_SACK_LOGGING_ENABLE 0x00004000
#define SCTP_SACK_RWND_LOGGING_ENABLE 0x00008000
#define SCTP_SB_LOGGING_ENABLE 0x00010000
#define SCTP_STR_LOGGING_ENABLE 0x00020000
#define SCTP_WAKE_LOGGING_ENABLE 0x00040000
#define SCTP_LOG_MAXBURST_ENABLE 0x00080000
#define SCTP_LOG_RWND_ENABLE 0x00100000
#define SCTP_LOG_SACK_ARRIVALS_ENABLE 0x00200000
#define SCTP_LTRACE_CHUNK_ENABLE 0x00400000
#define SCTP_LTRACE_ERROR_ENABLE 0x00800000
#endif /* !_NETINET_SCTP_H_ */

View File

@ -2543,14 +2543,16 @@ sctp_check_address_list(struct sctp_tcb *stcb, struct mbuf *m, int offset,
*/
uint32_t
sctp_addr_mgmt_ep_sa(struct sctp_inpcb *inp, struct sockaddr *sa,
uint32_t type, uint32_t vrf_id)
uint32_t type, uint32_t vrf_id, struct sctp_ifa *sctp_ifap)
{
struct sctp_ifa *ifa;
if (sa->sa_len == 0) {
return (EINVAL);
}
if (type == SCTP_ADD_IP_ADDRESS) {
if (sctp_ifap) {
ifa = sctp_ifap;
} else if (type == SCTP_ADD_IP_ADDRESS) {
/* For an add the address MUST be on the system */
ifa = sctp_find_ifa_by_addr(sa, vrf_id, 0);
} else if (type == SCTP_DEL_IP_ADDRESS) {

View File

@ -55,7 +55,7 @@ sctp_handle_asconf_ack(struct mbuf *, int,
extern uint32_t
sctp_addr_mgmt_ep_sa(struct sctp_inpcb *, struct sockaddr *,
uint32_t, uint32_t);
uint32_t, uint32_t, struct sctp_ifa *);
int sctp_iterator_ep(struct sctp_inpcb *inp, void *ptr, uint32_t val);

View File

@ -364,8 +364,10 @@ sctp_get_mbuf_for_msg(unsigned int space_needed, int want_header,
SCTP_BUF_NEXT(m) = NULL;
}
#ifdef SCTP_MBUF_LOGGING
if (SCTP_BUF_IS_EXTENDED(m)) {
sctp_log_mb(m, SCTP_MBUF_IALLOC);
if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) {
if (SCTP_BUF_IS_EXTENDED(m)) {
sctp_log_mb(m, SCTP_MBUF_IALLOC);
}
}
#endif
return (m);

View File

@ -71,7 +71,6 @@ __FBSDID("$FreeBSD$");
#define SCTP_VERSION_STRING "KAME-BSD 1.1"
/* #define SCTP_AUDITING_ENABLED 1 used for debug/auditing */
#define SCTP_AUDIT_SIZE 256
#define SCTP_STAT_LOG_SIZE 80000
#define SCTP_USE_THREAD_BASED_ITERATOR 1
@ -204,12 +203,13 @@ __FBSDID("$FreeBSD$");
#define SCTP_LOG_MAX_TYPES 118
/*
* To turn on various logging, you must first define SCTP_STAT_LOGGING. Then
* to get something to log you define one of the logging defines i.e.
* To turn on various logging, you must first enable 'options KTR' and
* you might want to bump the entires 'options KTR_ENTRIES=80000'.
* To get something to log you define one of the logging defines.
* (see LINT).
*
* SCTP_CWND_LOGGING SCTP_BLK_LOGGING SCTP_STR_LOGGING SCTP_FR_LOGGING
*
* Any one or a combination of the logging can be turned on.
* This gets the compile in place, but you still need to turn the
* logging flag on too in the sysctl (see in sctp.h).
*/
#define SCTP_LOG_EVENT_UNKNOWN 0
#define SCTP_LOG_EVENT_CWND 1
@ -229,8 +229,10 @@ __FBSDID("$FreeBSD$");
#define SCTP_LOG_MISC_EVENT 15
#define SCTP_LOG_EVENT_CLOSE 16
#define SCTP_LOG_EVENT_MBUF 17
#define SCTP_LOG_CHUNK_PROC 18
#define SCTP_LOG_ERROR_RET 19
#define SCTP_LOG_MAX_EVENT 18
#define SCTP_LOG_MAX_EVENT 20
#define SCTP_LOCK_UNKNOWN 2

File diff suppressed because it is too large Load Diff

View File

@ -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 @@ __attribute__((noinline))
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

View File

@ -82,15 +82,6 @@ extern int sctp_logoff_stuff;
#define SCTP_STATLOG_UNLOCK()
#define SCTP_STATLOG_DESTROY()
#define SCTP_STATLOG_GETREF(x) { \
x = atomic_fetchadd_int(&global_sctp_cwnd_log_at, 1); \
if(x == SCTP_STAT_LOG_SIZE) { \
global_sctp_cwnd_log_at = 1; \
x = 0; \
global_sctp_cwnd_log_rolled = 1; \
} \
}
#define SCTP_INP_INFO_LOCK_INIT() \
mtx_init(&sctppcbinfo.ipi_ep_mtx, "sctp-info", "inp_info", MTX_DEF)
@ -187,12 +178,12 @@ extern int sctp_logoff_stuff;
#ifdef SCTP_LOCK_LOGGING
#define SCTP_INP_RLOCK(_inp) do { \
sctp_log_lock(_inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_INP);\
if(sctp_logging_level & SCTP_LOCK_LOGGING_ENABLE) sctp_log_lock(_inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_INP);\
mtx_lock(&(_inp)->inp_mtx); \
} while (0)
#define SCTP_INP_WLOCK(_inp) do { \
sctp_log_lock(_inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_INP);\
if(sctp_logging_level & SCTP_LOCK_LOGGING_ENABLE) sctp_log_lock(_inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_INP);\
mtx_lock(&(_inp)->inp_mtx); \
} while (0)
@ -227,7 +218,7 @@ extern int sctp_logoff_stuff;
#ifdef SCTP_LOCK_LOGGING
#define SCTP_ASOC_CREATE_LOCK(_inp) \
do { \
sctp_log_lock(_inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_CREATE); \
if(sctp_logging_level & SCTP_LOCK_LOGGING_ENABLE) sctp_log_lock(_inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_CREATE); \
mtx_lock(&(_inp)->inp_create_mtx); \
} while (0)
#else
@ -257,7 +248,7 @@ extern int sctp_logoff_stuff;
#ifdef SCTP_LOCK_LOGGING
#define SCTP_TCB_LOCK(_tcb) do { \
sctp_log_lock(_tcb->sctp_ep, _tcb, SCTP_LOG_LOCK_TCB); \
if(sctp_logging_level & SCTP_LOCK_LOGGING_ENABLE) sctp_log_lock(_tcb->sctp_ep, _tcb, SCTP_LOG_LOCK_TCB); \
mtx_lock(&(_tcb)->tcb_mtx); \
} while (0)

View File

@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include "opt_inet.h"
#include "opt_sctp.h"
#include <sys/param.h>
#include <sys/ktr.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
@ -157,6 +158,18 @@ MALLOC_DECLARE(SCTP_M_SOCKOPT);
#endif
#define SCTP_PRINTF(params...) printf(params)
#ifdef SCTP_LTRACE_CHUNKS
#define SCTP_LTRACE_CHK(a, b, c, d) if(sctp_logging_level & SCTP_LTRACE_CHUNK_ENABLE) CTR6(KTR_NET, "SCTP:%d[%d]:%x-%x-%x-%x", SCTP_LOG_CHUNK_PROC, 0, a, b, c, d)
#else
#define SCTP_LTRACE_CHK(a, b, c, d)
#endif
#ifdef SCTP_LTRACE_ERRORS
#define SCTP_LTRACE_ERR(a, b, c, d) if(sctp_logging_level & SCTP_LTRACE_ERROR_ENABLE) CTR6(KTR_NET, "SCTP:%d[%d]:%x-%x-%x-%x", SCTP_LOG_ERROR_RET, 0, a, b, c, d)
#else
#define SCTP_LTRACE_ERR(a, b, c, d)
#endif
/*
* Local address and interface list handling
*/

View File

@ -3295,6 +3295,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
newm = sctp_get_mbuf_for_msg(sizeof(struct ip), 1, M_DONTWAIT, 1, MT_DATA);
if (newm == NULL) {
sctp_m_freem(m);
SCTP_LTRACE_ERR(inp, stcb, ENOMEM, 0);
return (ENOMEM);
}
SCTP_ALIGN_TO_END(newm, sizeof(struct ip));
@ -3450,6 +3451,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
if (SCTP_GET_HEADER_FOR_OUTPUT(o_pak)) {
/* failed to prepend data, give up */
sctp_m_freem(m);
SCTP_LTRACE_ERR(inp, stcb, ENOMEM, 0);
return (ENOMEM);
}
#ifdef SCTP_PACKET_LOGGING
@ -3523,6 +3525,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
newm = sctp_get_mbuf_for_msg(sizeof(struct ip6_hdr), 1, M_DONTWAIT, 1, MT_DATA);
if (newm == NULL) {
sctp_m_freem(m);
SCTP_LTRACE_ERR(inp, stcb, ENOMEM, 0);
return (ENOMEM);
}
SCTP_ALIGN_TO_END(newm, sizeof(struct ip6_hdr));
@ -3666,6 +3669,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
if (SCTP_GET_HEADER_FOR_OUTPUT(o_pak)) {
/* failed to prepend data, give up */
sctp_m_freem(m);
SCTP_LTRACE_ERR(inp, stcb, ENOMEM, 0);
return (ENOMEM);
}
#ifdef SCTP_PACKET_LOGGING
@ -5343,6 +5347,7 @@ sctp_msg_append(struct sctp_tcb *stcb,
}
sctp_alloc_a_strmoq(stcb, sp);
if (sp == NULL) {
SCTP_LTRACE_ERR(stcb->sctp_ep, stcb, ENOMEM, 0);
error = ENOMEM;
goto out_now;
}
@ -5818,6 +5823,7 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, struct mbuf *m,
SCTP_M_COPYAL);
if (ca == NULL) {
sctp_m_freem(m);
SCTP_LTRACE_ERR(inp, NULL, ENOMEM, 0);
return (ENOMEM);
}
memset(ca, 0, sizeof(struct sctp_copy_all));
@ -5835,6 +5841,7 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, struct mbuf *m,
ca->m = sctp_copy_out_all(uio, ca->sndlen);
if (ca->m == NULL) {
SCTP_FREE(ca, SCTP_M_COPYAL);
SCTP_LTRACE_ERR(inp, NULL, ENOMEM, 0);
return (ENOMEM);
}
} else {
@ -5980,19 +5987,19 @@ sctp_clean_up_datalist(struct sctp_tcb *stcb,
data_list[i]->sent = SCTP_DATAGRAM_SENT;
data_list[i]->snd_count = 1;
data_list[i]->rec.data.chunk_was_revoked = 0;
#ifdef SCTP_FLIGHT_LOGGING
sctp_misc_ints(SCTP_FLIGHT_LOG_UP,
data_list[i]->whoTo->flight_size,
data_list[i]->book_size,
(uintptr_t) data_list[i]->whoTo,
data_list[i]->rec.data.TSN_seq);
#endif
if (sctp_logging_level & SCTP_FLIGHT_LOGGING_ENABLE) {
sctp_misc_ints(SCTP_FLIGHT_LOG_UP,
data_list[i]->whoTo->flight_size,
data_list[i]->book_size,
(uintptr_t) data_list[i]->whoTo,
data_list[i]->rec.data.TSN_seq);
}
sctp_flight_size_increase(data_list[i]);
sctp_total_flight_increase(stcb, data_list[i]);
#ifdef SCTP_LOG_RWND
sctp_log_rwnd(SCTP_DECREASE_PEER_RWND,
asoc->peers_rwnd, data_list[i]->send_size, sctp_peer_chunk_oh);
#endif
if (sctp_logging_level & SCTP_LOG_RWND_ENABLE) {
sctp_log_rwnd(SCTP_DECREASE_PEER_RWND,
asoc->peers_rwnd, data_list[i]->send_size, sctp_peer_chunk_oh);
}
asoc->peers_rwnd = sctp_sbspace_sub(asoc->peers_rwnd,
(uint32_t) (data_list[i]->send_size + sctp_peer_chunk_oh));
if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
@ -6827,9 +6834,9 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
* copied out of the stream buffers. Note mostly
* copy by reference (we hope).
*/
#ifdef SCTP_CWND_LOGGING
sctp_log_cwnd(stcb, net, 0, SCTP_CWND_LOG_FILL_OUTQ_CALLED);
#endif
if (sctp_logging_level & SCTP_CWND_LOGGING_ENABLE) {
sctp_log_cwnd(stcb, net, 0, SCTP_CWND_LOG_FILL_OUTQ_CALLED);
}
sctp_fill_outqueue(stcb, net, frag_point, eeor_mode);
}
if (start_at != TAILQ_FIRST(&asoc->nets)) {
@ -6890,9 +6897,9 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
ifp = net->ro.ro_rt->rt_ifp;
if ((ifp->if_snd.ifq_len + 2) >= ifp->if_snd.ifq_maxlen) {
SCTP_STAT_INCR(sctps_ifnomemqueued);
#ifdef SCTP_LOG_MAXBURST
sctp_log_maxburst(stcb, net, ifp->if_snd.ifq_len, ifp->if_snd.ifq_maxlen, SCTP_MAX_IFP_APPLIED);
#endif
if (sctp_logging_level & SCTP_LOG_MAXBURST_ENABLE) {
sctp_log_maxburst(stcb, net, ifp->if_snd.ifq_len, ifp->if_snd.ifq_maxlen, SCTP_MAX_IFP_APPLIED);
}
continue;
}
}
@ -6987,6 +6994,7 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
chk->send_size, chk->copy_by_ref);
if (outchain == NULL) {
*reason_code = 8;
SCTP_LTRACE_ERR(inp, stcb, ENOMEM, 0);
return (ENOMEM);
}
SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
@ -7231,6 +7239,7 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
sctp_timer_start(SCTP_TIMER_TYPE_SEND, inp, stcb, net);
}
*reason_code = 3;
SCTP_LTRACE_ERR(inp, stcb, ENOMEM, 0);
return (ENOMEM);
}
/* upate our MTU size */
@ -7428,9 +7437,9 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
break;
}
}
#ifdef SCTP_CWND_LOGGING
sctp_log_cwnd(stcb, net, tsns_sent, SCTP_CWND_LOG_FROM_SEND);
#endif
if (sctp_logging_level & SCTP_CWND_LOGGING_ENABLE) {
sctp_log_cwnd(stcb, net, tsns_sent, SCTP_CWND_LOG_FROM_SEND);
}
}
if (old_startat == NULL) {
old_startat = send_start_at;
@ -7441,9 +7450,9 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
* At the end there should be no NON timed chunks hanging on this
* queue.
*/
#ifdef SCTP_CWND_LOGGING
sctp_log_cwnd(stcb, net, *num_out, SCTP_CWND_LOG_FROM_SEND);
#endif
if (sctp_logging_level & SCTP_CWND_LOGGING_ENABLE) {
sctp_log_cwnd(stcb, net, *num_out, SCTP_CWND_LOG_FROM_SEND);
}
if ((*num_out == 0) && (*reason_code == 0)) {
*reason_code = 4;
} else {
@ -8140,6 +8149,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp,
}
m = sctp_copy_mbufchain(chk->data, m, &endofchain, 0, chk->send_size, chk->copy_by_ref);
if (m == NULL) {
SCTP_LTRACE_ERR(inp, stcb, ENOMEM, 0);
return (ENOMEM);
}
/* Do clear IP_DF ? */
@ -8191,6 +8201,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp,
}
m = sctp_copy_mbufchain(fwd->data, m, &endofchain, 0, fwd->send_size, fwd->copy_by_ref);
if (m == NULL) {
SCTP_LTRACE_ERR(inp, stcb, ENOMEM, 0);
return (ENOMEM);
}
/* Do clear IP_DF ? */
@ -8307,21 +8318,21 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp,
} else {
#ifdef SCTP_LOG_RWND
sctp_log_rwnd(SCTP_DECREASE_PEER_RWND,
asoc->peers_rwnd, data_list[i]->send_size, sctp_peer_chunk_oh);
#endif
if (sctp_logging_level & SCTP_LOG_RWND_ENABLE) {
sctp_log_rwnd(SCTP_DECREASE_PEER_RWND,
asoc->peers_rwnd, data_list[i]->send_size, sctp_peer_chunk_oh);
}
asoc->peers_rwnd = sctp_sbspace_sub(asoc->peers_rwnd,
(uint32_t) (data_list[i]->send_size +
sctp_peer_chunk_oh));
}
#ifdef SCTP_FLIGHT_LOGGING
sctp_misc_ints(SCTP_FLIGHT_LOG_UP_RSND,
data_list[i]->whoTo->flight_size,
data_list[i]->book_size,
(uintptr_t) data_list[i]->whoTo,
data_list[i]->rec.data.TSN_seq);
#endif
if (sctp_logging_level & SCTP_FLIGHT_LOGGING_ENABLE) {
sctp_misc_ints(SCTP_FLIGHT_LOG_UP_RSND,
data_list[i]->whoTo->flight_size,
data_list[i]->book_size,
(uintptr_t) data_list[i]->whoTo,
data_list[i]->rec.data.TSN_seq);
}
sctp_flight_size_increase(data_list[i]);
sctp_total_flight_increase(stcb, data_list[i]);
if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
@ -8348,9 +8359,9 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp,
}
}
}
#ifdef SCTP_CWND_LOGGING
sctp_log_cwnd(stcb, net, tsns_sent, SCTP_CWND_LOG_FROM_RESEND);
#endif
if (sctp_logging_level & SCTP_CWND_LOGGING_ENABLE) {
sctp_log_cwnd(stcb, net, tsns_sent, SCTP_CWND_LOG_FROM_RESEND);
}
#ifdef SCTP_AUDITING_ENABLED
sctp_auditing(21, inp, stcb, NULL);
#endif
@ -8562,13 +8573,12 @@ sctp_chunk_output(struct sctp_inpcb *inp,
old_cwnd = net->cwnd;
net->cwnd = (net->flight_size + (burst_limit * net->mtu));
#ifdef SCTP_CWND_MONITOR
sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_BRST);
#endif
#ifdef SCTP_LOG_MAXBURST
sctp_log_maxburst(stcb, net, 0, burst_limit, SCTP_MAX_BURST_APPLIED);
#endif
if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_BRST);
}
if (sctp_logging_level & SCTP_LOG_MAXBURST_ENABLE) {
sctp_log_maxburst(stcb, net, 0, burst_limit, SCTP_MAX_BURST_APPLIED);
}
SCTP_STAT_INCR(sctps_maxburstqueued);
}
net->fast_retran_ip = 0;
@ -8589,26 +8599,25 @@ sctp_chunk_output(struct sctp_inpcb *inp,
&now, &now_filled, frag_point);
if (error) {
SCTPDBG(SCTP_DEBUG_OUTPUT1, "Error %d was returned from med-c-op\n", error);
#ifdef SCTP_LOG_MAXBURST
sctp_log_maxburst(stcb, asoc->primary_destination, error, burst_cnt, SCTP_MAX_BURST_ERROR_STOP);
#endif
#ifdef SCTP_CWND_LOGGING
sctp_log_cwnd(stcb, NULL, error, SCTP_SEND_NOW_COMPLETES);
sctp_log_cwnd(stcb, NULL, 0xdeadbeef, SCTP_SEND_NOW_COMPLETES);
#endif
if (sctp_logging_level & SCTP_LOG_MAXBURST_ENABLE) {
sctp_log_maxburst(stcb, asoc->primary_destination, error, burst_cnt, SCTP_MAX_BURST_ERROR_STOP);
}
if (sctp_logging_level & SCTP_CWND_LOGGING_ENABLE) {
sctp_log_cwnd(stcb, NULL, error, SCTP_SEND_NOW_COMPLETES);
sctp_log_cwnd(stcb, NULL, 0xdeadbeef, SCTP_SEND_NOW_COMPLETES);
}
break;
}
SCTPDBG(SCTP_DEBUG_OUTPUT3, "m-c-o put out %d\n", num_out);
tot_out += num_out;
burst_cnt++;
#ifdef SCTP_CWND_LOGGING
sctp_log_cwnd(stcb, NULL, num_out, SCTP_SEND_NOW_COMPLETES);
if (num_out == 0) {
sctp_log_cwnd(stcb, NULL, reason_code, SCTP_SEND_NOW_COMPLETES);
if (sctp_logging_level & SCTP_CWND_LOGGING_ENABLE) {
sctp_log_cwnd(stcb, NULL, num_out, SCTP_SEND_NOW_COMPLETES);
if (num_out == 0) {
sctp_log_cwnd(stcb, NULL, reason_code, SCTP_SEND_NOW_COMPLETES);
}
}
#endif
if (nagle_on) {
/*-
* When nagle is on, we look at how much is un_sent, then
@ -8640,16 +8649,16 @@ sctp_chunk_output(struct sctp_inpcb *inp,
if (burst_cnt >= burst_limit) {
SCTP_STAT_INCR(sctps_maxburstqueued);
asoc->burst_limit_applied = 1;
#ifdef SCTP_LOG_MAXBURST
sctp_log_maxburst(stcb, asoc->primary_destination, 0, burst_cnt, SCTP_MAX_BURST_APPLIED);
#endif
if (sctp_logging_level & SCTP_LOG_MAXBURST_ENABLE) {
sctp_log_maxburst(stcb, asoc->primary_destination, 0, burst_cnt, SCTP_MAX_BURST_APPLIED);
}
} else {
asoc->burst_limit_applied = 0;
}
}
#ifdef SCTP_CWND_LOGGING
sctp_log_cwnd(stcb, NULL, tot_out, SCTP_SEND_NOW_COMPLETES);
#endif
if (sctp_logging_level & SCTP_CWND_LOGGING_ENABLE) {
sctp_log_cwnd(stcb, NULL, tot_out, SCTP_SEND_NOW_COMPLETES);
}
SCTPDBG(SCTP_DEBUG_OUTPUT1, "Ok, we have put out %d chunks\n",
tot_out);
@ -10011,6 +10020,7 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb,
}
sctp_alloc_a_chunk(stcb, chk);
if (chk == NULL) {
SCTP_LTRACE_ERR(stcb->sctp_ep, stcb, ENOMEM, 0);
return (ENOMEM);
}
chk->copy_by_ref = 0;
@ -10024,6 +10034,7 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb,
chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_DONTWAIT, 1, MT_DATA);
if (chk->data == NULL) {
sctp_free_a_chunk(stcb, chk);
SCTP_LTRACE_ERR(stcb->sctp_ep, stcb, ENOMEM, 0);
return (ENOMEM);
}
SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD);
@ -11130,10 +11141,10 @@ sctp_lower_sosend(struct socket *so,
/* No room right no ! */
SOCKBUF_LOCK(&so->so_snd);
while (SCTP_SB_LIMIT_SND(so) < (stcb->asoc.total_output_queue_size + sctp_add_more_threshold)) {
#ifdef SCTP_BLK_LOGGING
sctp_log_block(SCTP_BLOCK_LOG_INTO_BLKA,
so, asoc, uio->uio_resid);
#endif
if (sctp_logging_level & SCTP_BLK_LOGGING_ENABLE) {
sctp_log_block(SCTP_BLOCK_LOG_INTO_BLKA,
so, asoc, uio->uio_resid);
}
be.error = 0;
stcb->block_entry = &be;
error = sbwait(&so->so_snd);
@ -11149,10 +11160,10 @@ sctp_lower_sosend(struct socket *so,
SOCKBUF_UNLOCK(&so->so_snd);
goto out_unlocked;
}
#ifdef SCTP_BLK_LOGGING
sctp_log_block(SCTP_BLOCK_LOG_OUTOF_BLK,
so, asoc, stcb->asoc.total_output_queue_size);
#endif
if (sctp_logging_level & SCTP_BLK_LOGGING_ENABLE) {
sctp_log_block(SCTP_BLOCK_LOG_OUTOF_BLK,
so, asoc, stcb->asoc.total_output_queue_size);
}
if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
goto out_unlocked;
}
@ -11394,25 +11405,28 @@ sctp_lower_sosend(struct socket *so,
* Don't send anything and let SACKs drive out the
* data unless wen have a "full" segment to send.
*/
#ifdef SCTP_NAGLE_LOGGING
sctp_log_nagle_event(stcb, SCTP_NAGLE_APPLIED);
#endif
if (sctp_logging_level & SCTP_NAGLE_LOGGING_ENABLE) {
sctp_log_nagle_event(stcb, SCTP_NAGLE_APPLIED);
}
SCTP_STAT_INCR(sctps_naglequeued);
nagle_applies = 1;
} else {
#ifdef SCTP_NAGLE_LOGGING
if (sctp_is_feature_off(inp, SCTP_PCB_FLAGS_NODELAY))
sctp_log_nagle_event(stcb, SCTP_NAGLE_SKIPPED);
#endif
if (sctp_logging_level & SCTP_NAGLE_LOGGING_ENABLE) {
if (sctp_is_feature_off(inp, SCTP_PCB_FLAGS_NODELAY))
sctp_log_nagle_event(stcb, SCTP_NAGLE_SKIPPED);
}
SCTP_STAT_INCR(sctps_naglesent);
nagle_applies = 0;
}
/* What about the INIT, send it maybe */
#ifdef SCTP_BLK_LOGGING
sctp_misc_ints(SCTP_CWNDLOG_PRESEND, queue_only_for_init, queue_only, nagle_applies, un_sent);
sctp_misc_ints(SCTP_CWNDLOG_PRESEND, stcb->asoc.total_output_queue_size, stcb->asoc.total_flight,
stcb->asoc.chunks_on_out_queue, stcb->asoc.total_flight_count);
#endif
if (sctp_logging_level & SCTP_BLK_LOGGING_ENABLE) {
sctp_misc_ints(SCTP_CWNDLOG_PRESEND, queue_only_for_init, queue_only,
nagle_applies, un_sent);
sctp_misc_ints(SCTP_CWNDLOG_PRESEND, stcb->asoc.total_output_queue_size,
stcb->asoc.total_flight,
stcb->asoc.chunks_on_out_queue, stcb->asoc.total_flight_count);
}
if (queue_only_for_init) {
if (hold_tcblock == 0) {
SCTP_TCB_LOCK(stcb);
@ -11472,10 +11486,10 @@ sctp_lower_sosend(struct socket *so,
* wakeup flag in place.
*/
if (SCTP_SB_LIMIT_SND(so) < (stcb->asoc.total_output_queue_size + sctp_add_more_threshold)) {
#ifdef SCTP_BLK_LOGGING
sctp_log_block(SCTP_BLOCK_LOG_INTO_BLK,
so, asoc, uio->uio_resid);
#endif
if (sctp_logging_level & SCTP_BLK_LOGGING_ENABLE) {
sctp_log_block(SCTP_BLOCK_LOG_INTO_BLK,
so, asoc, uio->uio_resid);
}
be.error = 0;
stcb->block_entry = &be;
error = sbwait(&so->so_snd);
@ -11492,10 +11506,10 @@ sctp_lower_sosend(struct socket *so,
SOCKBUF_UNLOCK(&so->so_snd);
goto out_unlocked;
}
#ifdef SCTP_BLK_LOGGING
sctp_log_block(SCTP_BLOCK_LOG_OUTOF_BLK,
so, asoc, stcb->asoc.total_output_queue_size);
#endif
if (sctp_logging_level & SCTP_BLK_LOGGING_ENABLE) {
sctp_log_block(SCTP_BLOCK_LOG_OUTOF_BLK,
so, asoc, stcb->asoc.total_output_queue_size);
}
}
SOCKBUF_UNLOCK(&so->so_snd);
if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
@ -11658,16 +11672,16 @@ sctp_lower_sosend(struct socket *so,
* Don't send anything and let SACKs drive out the
* data unless wen have a "full" segment to send.
*/
#ifdef SCTP_NAGLE_LOGGING
sctp_log_nagle_event(stcb, SCTP_NAGLE_APPLIED);
#endif
if (sctp_logging_level & SCTP_NAGLE_LOGGING_ENABLE) {
sctp_log_nagle_event(stcb, SCTP_NAGLE_APPLIED);
}
SCTP_STAT_INCR(sctps_naglequeued);
nagle_applies = 1;
} else {
#ifdef SCTP_NAGLE_LOGGING
if (sctp_is_feature_off(inp, SCTP_PCB_FLAGS_NODELAY))
sctp_log_nagle_event(stcb, SCTP_NAGLE_SKIPPED);
#endif
if (sctp_logging_level & SCTP_NAGLE_LOGGING_ENABLE) {
if (sctp_is_feature_off(inp, SCTP_PCB_FLAGS_NODELAY))
sctp_log_nagle_event(stcb, SCTP_NAGLE_SKIPPED);
}
SCTP_STAT_INCR(sctps_naglesent);
nagle_applies = 0;
}

View File

@ -155,6 +155,7 @@ sctp_allocate_vrf(int vrf_id)
vrf->vrf_id = vrf_id;
LIST_INIT(&vrf->ifnlist);
vrf->total_ifa_count = 0;
vrf->refcount = 0;
/* now also setup table ids */
SCTP_INIT_VRF_TABLEID(vrf);
/* Init the HASH of addresses */
@ -215,6 +216,19 @@ sctp_find_vrf(uint32_t vrf_id)
return (NULL);
}
void
sctp_free_vrf(struct sctp_vrf *vrf)
{
int ret;
ret = atomic_fetchadd_int(&vrf->refcount, -1);
if (ret == 1) {
/* We zero'd the count */
LIST_REMOVE(vrf, next_vrf);
SCTP_FREE(vrf, SCTP_M_VRF);
atomic_subtract_int(&sctppcbinfo.ipi_count_vrfs, 1);
}
}
void
sctp_free_ifn(struct sctp_ifn *sctp_ifnp)
@ -224,6 +238,9 @@ sctp_free_ifn(struct sctp_ifn *sctp_ifnp)
ret = atomic_fetchadd_int(&sctp_ifnp->refcount, -1);
if (ret == 1) {
/* We zero'd the count */
if (sctp_ifnp->vrf) {
sctp_free_vrf(sctp_ifnp->vrf);
}
SCTP_FREE(sctp_ifnp, SCTP_M_IFN);
atomic_subtract_int(&sctppcbinfo.ipi_count_ifns, 1);
}
@ -249,6 +266,9 @@ sctp_free_ifa(struct sctp_ifa *sctp_ifap)
ret = atomic_fetchadd_int(&sctp_ifap->refcount, -1);
if (ret == 1) {
/* We zero'd the count */
if (sctp_ifap->ifn_p) {
sctp_free_ifn(sctp_ifap->ifn_p);
}
SCTP_FREE(sctp_ifap, SCTP_M_IFA);
atomic_subtract_int(&sctppcbinfo.ipi_count_ifas, 1);
}
@ -293,15 +313,19 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
/* How granular do we need the locks to be here? */
SCTP_IPI_ADDR_LOCK();
vrf = sctp_find_vrf(vrf_id);
if (vrf == NULL) {
vrf = sctp_allocate_vrf(vrf_id);
sctp_ifnp = sctp_find_ifn(ifn, ifn_index);
if (sctp_ifnp) {
vrf = sctp_ifnp->vrf;
} else {
vrf = sctp_find_vrf(vrf_id);
if (vrf == NULL) {
SCTP_IPI_ADDR_UNLOCK();
return (NULL);
vrf = sctp_allocate_vrf(vrf_id);
if (vrf == NULL) {
SCTP_IPI_ADDR_UNLOCK();
return (NULL);
}
}
}
sctp_ifnp = sctp_find_ifn(ifn, ifn_index);
if (sctp_ifnp == NULL) {
/*
* build one and add it, can't hold lock until after malloc
@ -321,6 +345,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
sctp_ifnp->ifa_count = 0;
sctp_ifnp->refcount = 1;
sctp_ifnp->vrf = vrf;
atomic_add_int(&vrf->refcount, 1);
sctp_ifnp->ifn_mtu = SCTP_GATHER_MTU_FROM_IFN_INFO(ifn, ifn_index, addr->sa_family);
if (if_name != NULL) {
memcpy(sctp_ifnp->ifn_name, if_name, SCTP_IFNAMSIZ);
@ -340,10 +365,15 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
/* Hmm, it already exists? */
if ((sctp_ifap->ifn_p) &&
(sctp_ifap->ifn_p->ifn_index == ifn_index)) {
if (new_ifn_af) {
/* Remove the created one that we don't want */
sctp_delete_ifn(sctp_ifap->ifn_p, 1);
}
if (sctp_ifap->localifa_flags & SCTP_BEING_DELETED) {
/* easy to solve, just switch back to active */
sctp_ifap->localifa_flags = SCTP_ADDR_VALID;
sctp_ifap->ifn_p = sctp_ifnp;
atomic_add_int(&sctp_ifap->ifn_p->refcount, 1);
exit_stage_left:
SCTP_IPI_ADDR_UNLOCK();
return (sctp_ifap);
@ -356,6 +386,13 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
* The first IFN gets the address,
* duplicates are ignored.
*/
if (new_ifn_af) {
/*
* Remove the created one that we
* don't want
*/
sctp_delete_ifn(sctp_ifap->ifn_p, 1);
}
goto exit_stage_left;
} else {
/* repair ifnp which was NULL ? */
@ -2078,7 +2115,8 @@ sctp_isport_inuse(struct sctp_inpcb *inp, uint16_t lport, uint32_t vrf_id)
int
sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, struct thread *p)
sctp_inpcb_bind(struct socket *so, struct sockaddr *addr,
struct sctp_ifa *sctp_ifap, struct thread *p)
{
/* bind a ep to a socket address */
struct sctppcbhead *head;
@ -2328,8 +2366,11 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, struct thread *p)
* zero out the port to find the address! yuck! can't do
* this earlier since need port for sctp_pcb_findep()
*/
ifa = sctp_find_ifa_by_addr((struct sockaddr *)&store_sa,
vrf_id, 0);
if (sctp_ifap)
ifa = sctp_ifap;
else
ifa = sctp_find_ifa_by_addr((struct sockaddr *)&store_sa,
vrf_id, 0);
if (ifa == NULL) {
/* Can't find an interface with that address */
SCTP_INP_WUNLOCK(inp);
@ -2349,12 +2390,8 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, struct thread *p)
inp->sctp_flags &= ~SCTP_PCB_FLAGS_BOUNDALL;
/* allow bindx() to send ASCONF's for binding changes */
sctp_feature_on(inp, SCTP_PCB_FLAGS_DO_ASCONF);
/* set the automatic addr changes from kernel flag */
if (sctp_auto_asconf == 0) {
sctp_feature_off(inp, SCTP_PCB_FLAGS_AUTO_ASCONF);
} else {
sctp_feature_on(inp, SCTP_PCB_FLAGS_AUTO_ASCONF);
}
/* clear automatic addr changes from kernel flag */
sctp_feature_off(inp, SCTP_PCB_FLAGS_AUTO_ASCONF);
/* add this address to the endpoint list */
error = sctp_insert_laddr(&inp->sctp_addr_list, ifa, 0);
@ -3168,10 +3205,9 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
sctp_set_initial_cc_param(stcb, net);
#if defined(SCTP_CWND_MONITOR) || defined(SCTP_CWND_LOGGING)
sctp_log_cwnd(stcb, net, 0, SCTP_CWND_INITIALIZATION);
#endif
if (sctp_logging_level & (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) {
sctp_log_cwnd(stcb, net, 0, SCTP_CWND_INITIALIZATION);
}
/*
* CMT: CUC algo - set find_pseudo_cumack to TRUE (1) at beginning
* of assoc (2005/06/27, iyengar@cis.udel.edu)
@ -3343,7 +3379,7 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr,
* ephemerial bind for you.
*/
if ((err = sctp_inpcb_bind(inp->sctp_socket,
(struct sockaddr *)NULL,
(struct sockaddr *)NULL, (struct sctp_ifa *)NULL,
(struct thread *)NULL
))) {
/* bind error, probably perm */

View File

@ -65,6 +65,7 @@ struct sctp_vrf {
uint32_t tbl_id_v6; /* default v6 table id */
uint32_t total_ifa_count;
u_long vrf_addr_hashmark;
uint32_t refcount;
};
struct sctp_ifn {
@ -422,8 +423,8 @@ struct sctp_ifn *
sctp_find_ifn(void *ifn, uint32_t ifn_index);
struct sctp_vrf *sctp_allocate_vrf(int vrfid);
struct sctp_vrf *sctp_find_vrf(uint32_t vrfid);
void sctp_free_vrf(struct sctp_vrf *vrf);
struct sctp_ifa *
sctp_add_addr_to_vrf(uint32_t vrfid,
@ -448,8 +449,9 @@ struct sctp_nets *sctp_findnet(struct sctp_tcb *, struct sockaddr *);
struct sctp_inpcb *sctp_pcb_findep(struct sockaddr *, int, int, uint32_t);
int sctp_inpcb_bind(struct socket *, struct sockaddr *, struct thread *);
int
sctp_inpcb_bind(struct socket *, struct sockaddr *, struct sctp_ifa *,
struct thread *);
struct sctp_tcb *
sctp_findassociation_addr(struct mbuf *, int, int,

View File

@ -35,14 +35,16 @@
__FBSDID("$FreeBSD$");
#include <netinet/sctp_os.h>
#include <netinet/sctp_pcb.h>
#include <netinet/sctputil.h>
#include <netinet/sctp_var.h>
#include <netinet/sctp_var.h>
#include <netinet/sctp_sysctl.h>
#include <netinet/sctp.h>
#include <netinet/sctp_uio.h>
#include <netinet/sctp_var.h>
#include <netinet/sctp_peeloff.h>
#include <netinet/sctputil.h>
#include <netinet/sctp_auth.h>
#ifdef SCTP_DEBUG
extern uint32_t sctp_debug_on;
@ -174,7 +176,9 @@ sctp_get_peeloff(struct socket *head, sctp_assoc_t assoc_id, int *error)
/* We remove it right away */
#ifdef SCTP_LOCK_LOGGING
sctp_log_lock(inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_SOCK);
if (sctp_logging_level & SCTP_LOCK_LOGGING_ENABLE) {
sctp_log_lock(inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_SOCK);
}
#endif
TAILQ_REMOVE(&head->so_comp, newso, so_list);
head->so_qlen--;

View File

@ -63,6 +63,8 @@ uint32_t sctp_max_burst_default = SCTP_DEF_MAX_BURST;
uint32_t sctp_use_cwnd_based_maxburst = 1;
uint32_t sctp_do_drain = 1;
uint32_t sctp_hb_maxburst = SCTP_DEF_MAX_BURST;
uint32_t sctp_logging_level = SCTPCTL_LOGGING_LEVEL_DEFAULT;
uint32_t sctp_max_chunks_on_queue = SCTP_ASOC_MAX_CHUNKS_ON_QUEUE;
uint32_t sctp_delayed_sack_time_default = SCTP_RECV_MSEC;
@ -683,6 +685,11 @@ SYSCTL_INT(_net_inet_sctp, OID_AUTO, max_retran_chunk, CTLFLAG_RW,
&sctp_max_retran_chunk, 0,
SCTPCTL_MAX_RETRAN_CHUNK_DESC);
SYSCTL_INT(_net_inet_sctp, OID_AUTO, sctp_logging, CTLFLAG_RW,
&sctp_logging_level, 0,
SCTPCTL_LOGGING_LEVEL_DESC);
#ifdef SCTP_DEBUG
SYSCTL_INT(_net_inet_sctp, OID_AUTO, debug, CTLFLAG_RW,
&sctp_debug_on, 0, "Configure debug output");

View File

@ -392,19 +392,25 @@ __FBSDID("$FreeBSD$");
#define SCTPCTL_MAX_RETRAN_CHUNK_MAX 65535
#define SCTPCTL_MAX_RETRAN_CHUNK_DEFAULT 30
/* sctp_logging: This gives us logging when the options are enabled */
#define SCTPCTL_LOGGING_LEVEL 51
#define SCTPCTL_LOGGING_LEVEL_DESC "Ltrace/KTR trace logging level"
#define SCTPCTL_LOGGING_LEVEL_MIN 0
#define SCTPCTL_LOGGING_LEVEL_MAX 0x007fffff
#define SCTPCTL_LOGGING_LEVEL_DEFAULT 0
#ifdef SCTP_DEBUG
/* debug: Configure debug output */
#define SCTPCTL_DEBUG 51
#define SCTPCTL_DEBUG 52
#define SCTPCTL_DEBUG_DESC "Configure debug output"
#define SCTPCTL_DEBUG_MIN 0
#define SCTPCTL_DEBUG_MAX 0xFFFFFFFF
#define SCTPCTL_DEBUG_DEFAULT 0
#define SCTPCTL_MAXID 51
#define SCTPCTL_MAXID 52
#else
#define SCTPCTL_MAXID 50
#define SCTPCTL_MAXID 51
#endif
/*
@ -464,6 +470,7 @@ __FBSDID("$FreeBSD$");
{ "asoc_resource", CTLTYPE_INT }, \
{ "min_residual", CTLTYPE_INT }, \
{ "max_retran_chunk", CTLTYPE_INT }, \
{ "sctp_logging", CTLTYPE_INT }, \
{ "debug", CTLTYPE_INT }, \
}
#else
@ -519,6 +526,7 @@ __FBSDID("$FreeBSD$");
{ "asoc_resource", CTLTYPE_INT }, \
{ "min_residual", CTLTYPE_INT }, \
{ "max_retran_chunk", CTLTYPE_INT }, \
{ "sctp_logging", CTLTYPE_INT }, \
}
#endif
@ -579,6 +587,7 @@ extern uint32_t sctp_abort_if_one_2_one_hits_limit;
extern uint32_t sctp_strict_data_order;
extern uint32_t sctp_min_residual;
extern uint32_t sctp_max_retran_chunk;
extern uint32_t sctp_logging_level;
#if defined(SCTP_DEBUG)
extern uint32_t sctp_debug_on;

View File

@ -120,10 +120,10 @@ sctp_early_fr_timer(struct sctp_inpcb *inp,
continue;
}
}
#ifdef SCTP_EARLYFR_LOGGING
sctp_log_fr(chk->rec.data.TSN_seq, chk->snd_count,
4, SCTP_FR_MARKED_EARLY);
#endif
if (sctp_logging_level & SCTP_EARLYFR_LOGGING_ENABLE) {
sctp_log_fr(chk->rec.data.TSN_seq, chk->snd_count,
4, SCTP_FR_MARKED_EARLY);
}
SCTP_STAT_INCR(sctps_earlyfrmrkretrans);
chk->sent = SCTP_DATAGRAM_RESEND;
sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
@ -137,11 +137,9 @@ sctp_early_fr_timer(struct sctp_inpcb *inp,
}
}
if (cnt) {
#ifdef SCTP_CWND_MONITOR
int old_cwnd;
old_cwnd = net->cwnd;
#endif
sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_EARLY_FR_TMR);
/*
* make a small adjustment to cwnd and force to CA.
@ -153,9 +151,9 @@ sctp_early_fr_timer(struct sctp_inpcb *inp,
if (net->cwnd < net->ssthresh)
/* still in SS move to CA */
net->ssthresh = net->cwnd - 1;
#ifdef SCTP_CWND_MONITOR
sctp_log_cwnd(stcb, net, (old_cwnd - net->cwnd), SCTP_CWND_LOG_FROM_FR);
#endif
if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, (old_cwnd - net->cwnd), SCTP_CWND_LOG_FROM_FR);
}
} else if (cnt_resend) {
sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_EARLY_FR_TMR);
}
@ -399,10 +397,8 @@ sctp_backoff_on_timeout(struct sctp_tcb *stcb,
}
if ((win_probe == 0) && num_marked) {
/* We don't apply penalty to window probe scenarios */
#ifdef SCTP_CWND_MONITOR
int old_cwnd = net->cwnd;
#endif
net->ssthresh = net->cwnd >> 1;
if (net->ssthresh < (net->mtu << 1)) {
net->ssthresh = (net->mtu << 1);
@ -411,10 +407,9 @@ sctp_backoff_on_timeout(struct sctp_tcb *stcb,
/* floor of 1 mtu */
if (net->cwnd < net->mtu)
net->cwnd = net->mtu;
#ifdef SCTP_CWND_MONITOR
sctp_log_cwnd(stcb, net, net->cwnd - old_cwnd, SCTP_CWND_LOG_FROM_RTX);
#endif
if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, net->cwnd - old_cwnd, SCTP_CWND_LOG_FROM_RTX);
}
net->partial_bytes_acked = 0;
}
}
@ -469,17 +464,17 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
/* get cur rto in micro-seconds */
cur_rtt = (((net->lastsa >> 2) + net->lastsv) >> 1);
cur_rtt *= 1000;
#if defined(SCTP_FR_LOGGING) || defined(SCTP_EARLYFR_LOGGING)
sctp_log_fr(cur_rtt,
stcb->asoc.peers_rwnd,
window_probe,
SCTP_FR_T3_MARK_TIME);
sctp_log_fr(net->flight_size,
SCTP_OS_TIMER_PENDING(&net->fr_timer.timer),
SCTP_OS_TIMER_ACTIVE(&net->fr_timer.timer),
SCTP_FR_CWND_REPORT);
sctp_log_fr(net->flight_size, net->cwnd, stcb->asoc.total_flight, SCTP_FR_CWND_REPORT);
#endif
if (sctp_logging_level & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
sctp_log_fr(cur_rtt,
stcb->asoc.peers_rwnd,
window_probe,
SCTP_FR_T3_MARK_TIME);
sctp_log_fr(net->flight_size,
SCTP_OS_TIMER_PENDING(&net->fr_timer.timer),
SCTP_OS_TIMER_ACTIVE(&net->fr_timer.timer),
SCTP_FR_CWND_REPORT);
sctp_log_fr(net->flight_size, net->cwnd, stcb->asoc.total_flight, SCTP_FR_CWND_REPORT);
}
tv.tv_sec = cur_rtt / 1000000;
tv.tv_usec = cur_rtt % 1000000;
min_wait = now;
@ -493,10 +488,10 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
*/
min_wait.tv_sec = min_wait.tv_usec = 0;
}
#if defined(SCTP_FR_LOGGING) || defined(SCTP_EARLYFR_LOGGING)
sctp_log_fr(cur_rtt, now.tv_sec, now.tv_usec, SCTP_FR_T3_MARK_TIME);
sctp_log_fr(0, min_wait.tv_sec, min_wait.tv_usec, SCTP_FR_T3_MARK_TIME);
#endif
if (sctp_logging_level & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
sctp_log_fr(cur_rtt, now.tv_sec, now.tv_usec, SCTP_FR_T3_MARK_TIME);
sctp_log_fr(0, min_wait.tv_sec, min_wait.tv_usec, SCTP_FR_T3_MARK_TIME);
}
/*
* Our rwnd will be incorrect here since we are not adding back the
* cnt * mbuf but we will fix that down below.
@ -529,24 +524,24 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
*/
/* validate its been outstanding long enough */
#if defined(SCTP_FR_LOGGING) || defined(SCTP_EARLYFR_LOGGING)
sctp_log_fr(chk->rec.data.TSN_seq,
chk->sent_rcv_time.tv_sec,
chk->sent_rcv_time.tv_usec,
SCTP_FR_T3_MARK_TIME);
#endif
if (sctp_logging_level & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
sctp_log_fr(chk->rec.data.TSN_seq,
chk->sent_rcv_time.tv_sec,
chk->sent_rcv_time.tv_usec,
SCTP_FR_T3_MARK_TIME);
}
if ((chk->sent_rcv_time.tv_sec > min_wait.tv_sec) && (window_probe == 0)) {
/*
* we have reached a chunk that was sent
* some seconds past our min.. forget it we
* will find no more to send.
*/
#if defined(SCTP_FR_LOGGING) || defined(SCTP_EARLYFR_LOGGING)
sctp_log_fr(0,
chk->sent_rcv_time.tv_sec,
chk->sent_rcv_time.tv_usec,
SCTP_FR_T3_STOPPED);
#endif
if (sctp_logging_level & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
sctp_log_fr(0,
chk->sent_rcv_time.tv_sec,
chk->sent_rcv_time.tv_usec,
SCTP_FR_T3_STOPPED);
}
continue;
} else if ((chk->sent_rcv_time.tv_sec == min_wait.tv_sec) &&
(window_probe == 0)) {
@ -559,12 +554,12 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
* ok it was sent after our boundary
* time.
*/
#if defined(SCTP_FR_LOGGING) || defined(SCTP_EARLYFR_LOGGING)
sctp_log_fr(0,
chk->sent_rcv_time.tv_sec,
chk->sent_rcv_time.tv_usec,
SCTP_FR_T3_STOPPED);
#endif
if (sctp_logging_level & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
sctp_log_fr(0,
chk->sent_rcv_time.tv_sec,
chk->sent_rcv_time.tv_usec,
SCTP_FR_T3_STOPPED);
}
continue;
}
}
@ -603,11 +598,10 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
tsnfirst = chk->rec.data.TSN_seq;
}
tsnlast = chk->rec.data.TSN_seq;
#if defined(SCTP_FR_LOGGING) || defined(SCTP_EARLYFR_LOGGING)
sctp_log_fr(chk->rec.data.TSN_seq, chk->snd_count,
0, SCTP_FR_T3_MARKED);
#endif
if (sctp_logging_level & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
sctp_log_fr(chk->rec.data.TSN_seq, chk->snd_count,
0, SCTP_FR_T3_MARKED);
}
if (chk->rec.data.chunk_was_revoked) {
/* deflate the cwnd */
chk->whoTo->cwnd -= chk->book_size;
@ -615,13 +609,13 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
}
net->marked_retrans++;
stcb->asoc.marked_retrans++;
#ifdef SCTP_FLIGHT_LOGGING
sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_RSND_TO,
chk->whoTo->flight_size,
chk->book_size,
(uintptr_t) chk->whoTo,
chk->rec.data.TSN_seq);
#endif
if (sctp_logging_level & SCTP_FLIGHT_LOGGING_ENABLE) {
sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_RSND_TO,
chk->whoTo->flight_size,
chk->book_size,
(uintptr_t) chk->whoTo,
chk->rec.data.TSN_seq);
}
sctp_flight_size_decrease(chk);
sctp_total_flight_decrease(stcb, chk);
stcb->asoc.peers_rwnd += chk->send_size;
@ -665,9 +659,9 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
/* we did not subtract the same things? */
audit_tf = 1;
}
#if defined(SCTP_FR_LOGGING) || defined(SCTP_EARLYFR_LOGGING)
sctp_log_fr(tsnfirst, tsnlast, num_mk, SCTP_FR_T3_TIMEOUT);
#endif
if (sctp_logging_level & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
sctp_log_fr(tsnfirst, tsnlast, num_mk, SCTP_FR_T3_TIMEOUT);
}
#ifdef SCTP_DEBUG
if (num_mk) {
SCTPDBG(SCTP_DEBUG_TIMER1, "LAST TSN marked was %x\n",
@ -725,14 +719,13 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
}
TAILQ_FOREACH(chk, &stcb->asoc.sent_queue, sctp_next) {
if (chk->sent < SCTP_DATAGRAM_RESEND) {
#ifdef SCTP_FLIGHT_LOGGING
sctp_misc_ints(SCTP_FLIGHT_LOG_UP,
chk->whoTo->flight_size,
chk->book_size,
(uintptr_t) chk->whoTo,
chk->rec.data.TSN_seq);
#endif
if (sctp_logging_level & SCTP_FLIGHT_LOGGING_ENABLE) {
sctp_misc_ints(SCTP_FLIGHT_LOG_UP,
chk->whoTo->flight_size,
chk->book_size,
(uintptr_t) chk->whoTo,
chk->rec.data.TSN_seq);
}
sctp_flight_size_increase(chk);
sctp_total_flight_increase(stcb, chk);
}
@ -804,10 +797,10 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp,
struct sctp_nets *alt;
int win_probe, num_mk;
#ifdef SCTP_FR_LOGGING
sctp_log_fr(0, 0, 0, SCTP_FR_T3_TIMEOUT);
#ifdef SCTP_CWND_LOGGING
{
if (sctp_logging_level & SCTP_FR_LOGGING_ENABLE) {
sctp_log_fr(0, 0, 0, SCTP_FR_T3_TIMEOUT);
}
if (sctp_logging_level & SCTP_CWND_LOGGING_ENABLE) {
struct sctp_nets *lnet;
TAILQ_FOREACH(lnet, &stcb->asoc.nets, sctp_next) {
@ -818,8 +811,6 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp,
}
}
}
#endif
#endif
/* Find an alternate and mark those for retransmission */
if ((stcb->asoc.peers_rwnd == 0) &&
(stcb->asoc.total_flight < net->mtu)) {
@ -972,9 +963,9 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp,
}
}
}
#ifdef SCTP_CWND_MONITOR
sctp_log_cwnd(stcb, net, net->cwnd, SCTP_CWND_LOG_FROM_RTX);
#endif
if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, net->cwnd, SCTP_CWND_LOG_FROM_RTX);
}
return (0);
}

View File

@ -697,7 +697,7 @@ struct sctp_mbuf_log {
};
struct sctp_cwnd_log {
uint32_t time_event;
uint64_t time_event;
uint8_t from;
uint8_t event_type;
uint8_t resv[2];

View File

@ -133,13 +133,13 @@ sctp_pathmtu_adjustment(struct sctp_inpcb *inp,
}
chk->sent = SCTP_DATAGRAM_RESEND;
chk->rec.data.doing_fast_retransmit = 0;
#ifdef SCTP_FLIGHT_LOGGING
sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_PMTU,
chk->whoTo->flight_size,
chk->book_size,
(uintptr_t) chk->whoTo,
chk->rec.data.TSN_seq);
#endif
if (sctp_logging_level & SCTP_FLIGHT_LOGGING_ENABLE) {
sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_PMTU,
chk->whoTo->flight_size,
chk->book_size,
(uintptr_t) chk->whoTo,
chk->rec.data.TSN_seq);
}
/* Clear any time so NO RTT is being done */
chk->do_rtt = 0;
sctp_flight_size_decrease(chk);
@ -289,7 +289,9 @@ sctp_notify(struct sctp_inpcb *inp,
}
if (inp->sctp_socket) {
#ifdef SCTP_LOCK_LOGGING
sctp_log_lock(inp, stcb, SCTP_LOG_LOCK_SOCK);
if (sctp_logging_level & SCTP_LOCK_LOGGING_ENABLE) {
sctp_log_lock(inp, stcb, SCTP_LOG_LOCK_SOCK);
}
#endif
SOCK_LOCK(inp->sctp_socket);
inp->sctp_socket->so_error = error;
@ -550,7 +552,7 @@ sctp_bind(struct socket *so, struct sockaddr *addr, struct thread *p)
if (inp == 0)
return EINVAL;
error = sctp_inpcb_bind(so, addr, p);
error = sctp_inpcb_bind(so, addr, NULL, p);
return error;
}
@ -1321,7 +1323,7 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb *inp, void *optval,
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) ==
SCTP_PCB_FLAGS_UNBOUND) {
/* Bind a ephemeral port */
error = sctp_inpcb_bind(so, NULL, p);
error = sctp_inpcb_bind(so, NULL, NULL, p);
if (error) {
goto out_now;
}
@ -1732,11 +1734,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
}
break;
case SCTP_GET_STAT_LOG:
#ifdef SCTP_STAT_LOGGING
error = sctp_fill_stat_log(optval, optsize);
#else
error = EOPNOTSUPP;
#endif
break;
case SCTP_EVENTS:
{
@ -2515,11 +2513,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
}
break;
case SCTP_CLR_STAT_LOG:
#ifdef SCTP_STAT_LOGGING
sctp_clr_stat_log();
#else
error = EOPNOTSUPP;
#endif
break;
case SCTP_CONTEXT:
{
@ -3622,7 +3616,7 @@ sctp_connect(struct socket *so, struct sockaddr *addr, struct thread *p)
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) ==
SCTP_PCB_FLAGS_UNBOUND) {
/* Bind a ephemeral port */
error = sctp_inpcb_bind(so, NULL, p);
error = sctp_inpcb_bind(so, NULL, NULL, p);
if (error) {
goto out_now;
}
@ -3711,7 +3705,9 @@ sctp_listen(struct socket *so, int backlog, struct thread *p)
}
SCTP_INP_RLOCK(inp);
#ifdef SCTP_LOCK_LOGGING
sctp_log_lock(inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_SOCK);
if (sctp_logging_level & SCTP_LOCK_LOGGING_ENABLE) {
sctp_log_lock(inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_SOCK);
}
#endif
SOCK_LOCK(so);
error = solisten_proto_check(so);
@ -3731,7 +3727,7 @@ sctp_listen(struct socket *so, int backlog, struct thread *p)
/* We must do a bind. */
SOCK_UNLOCK(so);
SCTP_INP_RUNLOCK(inp);
if ((error = sctp_inpcb_bind(so, NULL, p))) {
if ((error = sctp_inpcb_bind(so, NULL, NULL, p))) {
/* bind error, probably perm */
return (error);
}

File diff suppressed because it is too large Load Diff

View File

@ -40,60 +40,6 @@ __FBSDID("$FreeBSD$");
#if defined(_KERNEL)
/*-
* Any new logging added must also define SCTP_STAT_LOGGING if
* its not already defined.
*/
#if defined(SCTP_LOG_MAXBURST) || defined(SCTP_LOG_RWND)
#ifndef SCTP_STAT_LOGGING
#define SCTP_STAT_LOGGING 1
#endif
#endif
#if defined(SCTP_CWND_LOGGING) || defined(SCTP_CWND_MONITOR) || defined(SCTP_BLK_LOGGING)
#ifndef SCTP_STAT_LOGGING
#define SCTP_STAT_LOGGING 1
#endif
#endif
#if defined(SCTP_STR_LOGGING) || defined(SCTP_FR_LOGGING) || defined(SCTP_MAP_LOGGING)
#ifndef SCTP_STAT_LOGGING
#define SCTP_STAT_LOGGING 1
#endif
#endif
#if defined(SCTP_SACK_LOGGING) || defined(SCTP_LOCK_LOGGING)
#ifndef SCTP_STAT_LOGGING
#define SCTP_STAT_LOGGING 1
#endif
#endif
#if defined(SCTP_RTTVAR_LOGGING) || defined(SCTP_SB_LOGGING) || defined(SCTP_EARLYFR_LOGGING)
#ifndef SCTP_STAT_LOGGING
#define SCTP_STAT_LOGGING 1
#endif
#endif
#if defined(SCTP_NAGLE_LOGGING) || defined(SCTP_WAKE_LOGGING) || defined(SCTP_RECV_RWND_LOGGING)
#ifndef SCTP_STAT_LOGGING
#define SCTP_STAT_LOGGING 1
#endif
#endif
#if defined(SCTP_SACK_RWND_LOGGING) || defined(SCTP_FLIGHT_LOGGING) || defined(SCTP_MBUF_LOGGING)
#ifndef SCTP_STAT_LOGGING
#define SCTP_STAT_LOGGING 1
#endif
#endif
#if defined(SCTP_LOG_SACK_ARRIVALS)
#ifndef SCTP_STAT_LOGGING
#define SCTP_STAT_LOGGING 1
#endif
#endif
#ifdef SCTP_ASOCLOG_OF_TSNS
void sctp_print_out_track_log(struct sctp_tcb *stcb);
@ -276,7 +222,7 @@ sctp_bindx_delete_address(struct socket *so, struct sctp_inpcb *inp,
#ifdef SCTP_MBCNT_LOGGING
void
sctp_free_bufspace(struct sctp_tcb *, struct sctp_association *,
struct sctp_tmit_chunk *);
struct sctp_tmit_chunk *, int);
#else
#define sctp_free_bufspace(stcb, asoc, tp1, chk_cnt) \
@ -353,7 +299,6 @@ sctp_l_soreceive(struct socket *so,
int *flag);
#ifdef SCTP_STAT_LOGGING
void
sctp_misc_ints(uint8_t from, uint32_t a, uint32_t b, uint32_t c, uint32_t d);
@ -396,7 +341,6 @@ void sctp_log_map(uint32_t, uint32_t, uint32_t, int);
void sctp_clr_stat_log(void);
#endif
#ifdef SCTP_AUDITING_ENABLED
void

View File

@ -617,7 +617,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, struct thread *p)
in6_sin6_2_sin(&sin, sin6_p);
inp6->inp_vflag |= INP_IPV4;
inp6->inp_vflag &= ~INP_IPV6;
error = sctp_inpcb_bind(so, (struct sockaddr *)&sin, p);
error = sctp_inpcb_bind(so, (struct sockaddr *)&sin, NULL, p);
return error;
}
}
@ -637,7 +637,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, struct thread *p)
return EINVAL;
}
}
error = sctp_inpcb_bind(so, addr, p);
error = sctp_inpcb_bind(so, addr, NULL, p);
return error;
}