summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2007-06-22 13:50:56 +0000
committerrrs <rrs@FreeBSD.org>2007-06-22 13:50:56 +0000
commitcdfbc0147192329ec8c28c33e01dc1ba04756b5a (patch)
tree2b354542a2dde75a52870cd61eab47d12ffb8788 /sys/netinet
parent2f486f25b672cff71428e86c7369dbc7ed9d21a5 (diff)
downloadFreeBSD-src-cdfbc0147192329ec8c28c33e01dc1ba04756b5a.zip
FreeBSD-src-cdfbc0147192329ec8c28c33e01dc1ba04756b5a.tar.gz
- Fix stream reset so it limits the number of streams that can be listed
- Fix fwd-tsn to use proper accessor so it does not overrun mbufs - Fix stream reset error reporting to actually work (it has always been broken if the peer rejects a stream reset) - Some 64 bit friendly changes Approved by: re(bmah@freebsd.org)
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/sctp_indata.c17
-rw-r--r--sys/netinet/sctp_indata.h2
-rw-r--r--sys/netinet/sctp_input.c60
-rw-r--r--sys/netinet/sctp_uio.h355
-rw-r--r--sys/netinet/sctputil.c4
5 files changed, 240 insertions, 198 deletions
diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c
index bb6d667..f3fdcfc 100644
--- a/sys/netinet/sctp_indata.c
+++ b/sys/netinet/sctp_indata.c
@@ -5624,7 +5624,7 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb,
void
sctp_handle_forward_tsn(struct sctp_tcb *stcb,
- struct sctp_forward_tsn_chunk *fwd, int *abort_flag)
+ struct sctp_forward_tsn_chunk *fwd, int *abort_flag, struct mbuf *m, int offset)
{
/*
* ISSUES that MUST be fixed for ECN! When we are the sender of the
@@ -5649,7 +5649,6 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb,
* pr-in-streams 4) clean up re-assembly queue 5) Send a sack to
* report where we are.
*/
- struct sctp_strseq *stseq;
struct sctp_association *asoc;
uint32_t new_cum_tsn, gap, back_out_htsn;
unsigned int i, cnt_gone, fwd_sz, cumack_set_flag, m_size;
@@ -5883,17 +5882,25 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb,
/*************************************************************/
/* 3. Update the PR-stream re-ordering queues */
/*************************************************************/
- stseq = (struct sctp_strseq *)((caddr_t)fwd + sizeof(*fwd));
fwd_sz -= sizeof(*fwd);
- {
+ if (m && fwd_sz) {
/* New method. */
unsigned int num_str;
+ struct sctp_strseq *stseq, strseqbuf;
+
+ offset += sizeof(*fwd);
num_str = fwd_sz / sizeof(struct sctp_strseq);
for (i = 0; i < num_str; i++) {
uint16_t st;
unsigned char *xx;
+ stseq = (struct sctp_strseq *)sctp_m_getptr(m, offset,
+ sizeof(struct sctp_strseq),
+ (uint8_t *) & strseqbuf);
+ offset += sizeof(struct sctp_strseq);
+ if (stseq == NULL)
+ break;
/* Convert */
xx = (unsigned char *)&stseq[i];
st = ntohs(stseq[i].stream);
@@ -5901,7 +5908,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb,
st = ntohs(stseq[i].sequence);
stseq[i].sequence = st;
/* now process */
- if (stseq[i].stream > asoc->streamincnt) {
+ if (stseq[i].stream >= asoc->streamincnt) {
/*
* It is arguable if we should continue.
* Since the peer sent bogus stream info we
diff --git a/sys/netinet/sctp_indata.h b/sys/netinet/sctp_indata.h
index 8a65a20..9ab5ebf 100644
--- a/sys/netinet/sctp_indata.h
+++ b/sys/netinet/sctp_indata.h
@@ -102,7 +102,7 @@ sctp_handle_sack(struct mbuf *m, int offset, struct sctp_sack_chunk *, struct sc
/* draft-ietf-tsvwg-usctp */
void
sctp_handle_forward_tsn(struct sctp_tcb *,
- struct sctp_forward_tsn_chunk *, int *);
+ struct sctp_forward_tsn_chunk *, int *, struct mbuf *, int);
struct sctp_tmit_chunk *
sctp_try_advance_peer_ack_point(struct sctp_tcb *, struct sctp_association *);
diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c
index 0dc56f7..e3d49bd 100644
--- a/sys/netinet/sctp_input.c
+++ b/sys/netinet/sctp_input.c
@@ -2832,7 +2832,7 @@ sctp_handle_stream_reset_response(struct sctp_tcb *stcb,
fwdtsn.ch.chunk_length = htons(sizeof(struct sctp_forward_tsn_chunk));
fwdtsn.ch.chunk_type = SCTP_FORWARD_CUM_TSN;
fwdtsn.new_cumulative_tsn = htonl(ntohl(resp->senders_next_tsn) - 1);
- sctp_handle_forward_tsn(stcb, &fwdtsn, &abort_flag);
+ sctp_handle_forward_tsn(stcb, &fwdtsn, &abort_flag, NULL, 0);
if (abort_flag) {
return (1);
}
@@ -2860,7 +2860,7 @@ sctp_handle_stream_reset_response(struct sctp_tcb *stcb,
static void
sctp_handle_str_reset_request_in(struct sctp_tcb *stcb,
struct sctp_tmit_chunk *chk,
- struct sctp_stream_reset_in_request *req)
+ struct sctp_stream_reset_in_request *req, int trunc)
{
uint32_t seq;
int len, i;
@@ -2875,7 +2875,12 @@ sctp_handle_str_reset_request_in(struct sctp_tcb *stcb,
seq = ntohl(req->request_seq);
if (asoc->str_reset_seq_in == seq) {
- if (stcb->asoc.stream_reset_out_is_outstanding == 0) {
+ if (trunc) {
+ /* Can't do it, since they exceeded our buffer size */
+ asoc->last_reset_action[1] = asoc->last_reset_action[0];
+ asoc->last_reset_action[0] = SCTP_STREAM_RESET_DENIED;
+ sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]);
+ } else if (stcb->asoc.stream_reset_out_is_outstanding == 0) {
len = ntohs(req->ph.param_length);
number_entries = ((len - sizeof(struct sctp_stream_reset_in_request)) / sizeof(uint16_t));
for (i = 0; i < number_entries; i++) {
@@ -2930,7 +2935,7 @@ sctp_handle_str_reset_request_tsn(struct sctp_tcb *stcb,
fwdtsn.ch.chunk_type = SCTP_FORWARD_CUM_TSN;
fwdtsn.ch.chunk_flags = 0;
fwdtsn.new_cumulative_tsn = htonl(stcb->asoc.highest_tsn_inside_map + 1);
- sctp_handle_forward_tsn(stcb, &fwdtsn, &abort_flag);
+ sctp_handle_forward_tsn(stcb, &fwdtsn, &abort_flag, NULL, 0);
if (abort_flag) {
return (1);
}
@@ -2975,7 +2980,7 @@ sctp_handle_str_reset_request_tsn(struct sctp_tcb *stcb,
static void
sctp_handle_str_reset_request_out(struct sctp_tcb *stcb,
struct sctp_tmit_chunk *chk,
- struct sctp_stream_reset_out_request *req)
+ struct sctp_stream_reset_out_request *req, int trunc)
{
uint32_t seq, tsn;
int number_entries, len;
@@ -2998,7 +3003,10 @@ sctp_handle_str_reset_request_out(struct sctp_tcb *stcb,
/* move the reset action back one */
asoc->last_reset_action[1] = asoc->last_reset_action[0];
- if ((tsn == asoc->cumulative_tsn) ||
+ if (trunc) {
+ sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_DENIED);
+ asoc->last_reset_action[0] = SCTP_STREAM_RESET_DENIED;
+ } else if ((tsn == asoc->cumulative_tsn) ||
(compare_with_wrap(asoc->cumulative_tsn, tsn, MAX_TSN))) {
/* we can do it now */
sctp_reset_in_stream(stcb, number_entries, req->list_of_streams);
@@ -3047,12 +3055,20 @@ sctp_handle_str_reset_request_out(struct sctp_tcb *stcb,
}
}
-static int
-sctp_handle_stream_reset(struct sctp_tcb *stcb, struct sctp_stream_reset_out_req *sr_req)
+#ifdef __GNUC__
+__attribute__((noinline))
+#endif
+ static int
+ sctp_handle_stream_reset(struct sctp_tcb *stcb, struct mbuf *m, int offset,
+ struct sctp_stream_reset_out_req *sr_req)
{
int chk_length, param_len, ptype;
+ struct sctp_paramhdr pstore;
+ uint8_t cstore[SCTP_CHUNK_BUFFER_SIZE];
+
uint32_t seq;
int num_req = 0;
+ int trunc = 0;
struct sctp_tmit_chunk *chk;
struct sctp_chunkhdr *ch;
struct sctp_paramhdr *ph;
@@ -3096,15 +3112,26 @@ strres_nochunk:
ch->chunk_flags = 0;
ch->chunk_length = htons(chk->send_size);
SCTP_BUF_LEN(chk->data) = SCTP_SIZE32(chk->send_size);
- ph = (struct sctp_paramhdr *)&sr_req->sr_req;
+ offset += sizeof(struct sctp_chunkhdr);
while ((size_t)chk_length >= sizeof(struct sctp_stream_reset_tsn_request)) {
+ ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, sizeof(pstore), (uint8_t *) & pstore);
+ if (ph == NULL)
+ break;
param_len = ntohs(ph->param_length);
if (param_len < (int)sizeof(struct sctp_stream_reset_tsn_request)) {
/* bad param */
break;
}
+ ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, min(param_len, sizeof(cstore)),
+ (uint8_t *) & cstore);
ptype = ntohs(ph->param_type);
num_param++;
+ if (param_len > sizeof(cstore)) {
+ trunc = 1;
+ } else {
+ trunc = 0;
+ }
+
if (num_param > SCTP_MAX_RESET_PARAMS) {
/* hit the max of parameters already sorry.. */
break;
@@ -3121,18 +3148,22 @@ strres_nochunk:
(void)sctp_handle_stream_reset_response(stcb, seq, SCTP_STREAM_RESET_PERFORMED, NULL);
}
}
- sctp_handle_str_reset_request_out(stcb, chk, req_out);
+ sctp_handle_str_reset_request_out(stcb, chk, req_out, trunc);
} else if (ptype == SCTP_STR_RESET_IN_REQUEST) {
struct sctp_stream_reset_in_request *req_in;
num_req++;
+
+
req_in = (struct sctp_stream_reset_in_request *)ph;
- sctp_handle_str_reset_request_in(stcb, chk, req_in);
+
+ sctp_handle_str_reset_request_in(stcb, chk, req_in, trunc);
} else if (ptype == SCTP_STR_RESET_TSN_REQUEST) {
struct sctp_stream_reset_tsn_request *req_tsn;
num_req++;
req_tsn = (struct sctp_stream_reset_tsn_request *)ph;
+
if (sctp_handle_str_reset_request_tsn(stcb, chk, req_tsn)) {
ret_code = 1;
goto strres_nochunk;
@@ -3153,8 +3184,7 @@ strres_nochunk:
} else {
break;
}
-
- ph = (struct sctp_paramhdr *)((caddr_t)ph + SCTP_SIZE32(param_len));
+ offset += SCTP_SIZE32(param_len);
chk_length -= SCTP_SIZE32(param_len);
}
if (num_req == 0) {
@@ -4223,7 +4253,7 @@ process_control_chunks:
return (NULL);
}
sctp_handle_forward_tsn(stcb,
- (struct sctp_forward_tsn_chunk *)ch, &abort_flag);
+ (struct sctp_forward_tsn_chunk *)ch, &abort_flag, m, *offset);
if (abort_flag) {
*offset = length;
return (NULL);
@@ -4257,7 +4287,7 @@ process_control_chunks:
*/
stcb->asoc.peer_supports_strreset = 1;
}
- if (sctp_handle_stream_reset(stcb, (struct sctp_stream_reset_out_req *)ch)) {
+ if (sctp_handle_stream_reset(stcb, m, *offset, (struct sctp_stream_reset_out_req *)ch)) {
/* stop processing */
*offset = length;
return (NULL);
diff --git a/sys/netinet/sctp_uio.h b/sys/netinet/sctp_uio.h
index 3d29f6d..e0c8441 100644
--- a/sys/netinet/sctp_uio.h
+++ b/sys/netinet/sctp_uio.h
@@ -207,6 +207,7 @@ struct sctp_paddr_change {
uint32_t spc_state;
uint32_t spc_error;
sctp_assoc_t spc_assoc_id;
+ uint8_t spc_padding[4];
};
/* paddr state values */
@@ -396,15 +397,14 @@ union sctp_notification {
*/
struct sctp_paddrparams {
- sctp_assoc_t spp_assoc_id;
struct sockaddr_storage spp_address;
+ sctp_assoc_t spp_assoc_id;
uint32_t spp_hbinterval;
- uint16_t spp_pathmaxrxt;
uint32_t spp_pathmtu;
uint32_t spp_flags;
uint32_t spp_ipv6_flowlabel;
+ uint16_t spp_pathmaxrxt;
uint8_t spp_ipv4_tos;
-
};
#define SPP_HB_ENABLE 0x00000001
@@ -417,8 +417,8 @@ struct sctp_paddrparams {
#define SPP_IPV4_TOS 0x00000200
struct sctp_paddrinfo {
- sctp_assoc_t spinfo_assoc_id;
struct sockaddr_storage spinfo_address;
+ sctp_assoc_t spinfo_assoc_id;
int32_t spinfo_state;
uint32_t spinfo_cwnd;
uint32_t spinfo_srtt;
@@ -435,21 +435,23 @@ struct sctp_rtoinfo {
struct sctp_assocparams {
sctp_assoc_t sasoc_assoc_id;
- uint16_t sasoc_asocmaxrxt;
- uint16_t sasoc_number_peer_destinations;
uint32_t sasoc_peer_rwnd;
uint32_t sasoc_local_rwnd;
uint32_t sasoc_cookie_life;
+ uint16_t sasoc_asocmaxrxt;
+ uint16_t sasoc_number_peer_destinations;
};
struct sctp_setprim {
- sctp_assoc_t ssp_assoc_id;
struct sockaddr_storage ssp_addr;
+ sctp_assoc_t ssp_assoc_id;
+ uint8_t ssp_padding[4];
};
struct sctp_setpeerprim {
- sctp_assoc_t sspp_assoc_id;
struct sockaddr_storage sspp_addr;
+ sctp_assoc_t sspp_assoc_id;
+ uint8_t sspp_padding[4];
};
struct sctp_getaddresses {
@@ -535,11 +537,11 @@ struct sctp_sack_info {
};
struct sctp_cwnd_args {
- struct sctp_nets *net; /* network to */
+ struct sctp_nets *net; /* network to *//* FIXME: LP64 issue */
uint32_t cwnd_new_value;/* cwnd in k */
uint32_t inflight; /* flightsize in k */
uint32_t pseudo_cumack;
- int cwnd_augment; /* increment to it */
+ uint32_t cwnd_augment; /* increment to it */
uint8_t meets_pseudo_cumack;
uint8_t need_new_pseudo_cumack;
uint8_t cnt_in_send;
@@ -585,7 +587,7 @@ struct sctp_get_nonce_values {
/* Debugging logs */
struct sctp_str_log {
- void *stcb;
+ void *stcb; /* FIXME: LP64 issue */
uint32_t n_tsn;
uint32_t e_tsn;
uint16_t n_sseq;
@@ -594,7 +596,7 @@ struct sctp_str_log {
};
struct sctp_sb_log {
- void *stcb;
+ void *stcb; /* FIXME: LP64 issue */
uint32_t so_sbcc;
uint32_t stcb_sbcc;
uint32_t incr;
@@ -635,8 +637,8 @@ struct sctp_sack_log {
};
struct sctp_lock_log {
- void *sock;
- void *inp;
+ void *sock; /* FIXME: LP64 issue */
+ void *inp; /* FIXME: LP64 issue */
uint8_t tcb_lock;
uint8_t inp_lock;
uint8_t info_lock;
@@ -648,12 +650,12 @@ struct sctp_lock_log {
};
struct sctp_rto_log {
- void *net;
+ void *net; /* FIXME: LP64 issue */
uint32_t rtt;
};
struct sctp_nagle_log {
- void *stcb;
+ void *stcb; /* FIXME: LP64 issue */
uint32_t total_flight;
uint32_t total_in_queue;
uint16_t count_in_queue;
@@ -661,7 +663,7 @@ struct sctp_nagle_log {
};
struct sctp_sbwake_log {
- void *stcb;
+ void *stcb; /* FIXME: LP64 issue */
uint16_t send_q;
uint16_t sent_q;
uint16_t flight;
@@ -680,15 +682,15 @@ struct sctp_misc_info {
};
struct sctp_log_closing {
- void *inp;
- void *stcb;
+ void *inp; /* FIXME: LP64 issue */
+ void *stcb; /* FIXME: LP64 issue */
uint32_t sctp_flags;
uint16_t state;
int16_t loc;
};
struct sctp_mbuf_log {
- struct mbuf *mp;
+ struct mbuf *mp; /* FIXME: LP64 issue */
caddr_t ext;
caddr_t data;
uint16_t size;
@@ -722,189 +724,199 @@ struct sctp_cwnd_log {
};
struct sctp_cwnd_log_req {
- int num_in_log; /* Number in log */
- int num_ret; /* Number returned */
- int start_at; /* start at this one */
- int end_at; /* end at this one */
+ int32_t num_in_log; /* Number in log */
+ int32_t num_ret; /* Number returned */
+ int32_t start_at; /* start at this one */
+ int32_t end_at; /* end at this one */
struct sctp_cwnd_log log[0];
};
struct sctpstat {
/* MIB according to RFC 3873 */
- u_long sctps_currestab; /* sctpStats 1 (Gauge32) */
- u_long sctps_activeestab; /* sctpStats 2 (Counter32) */
- u_long sctps_restartestab;
- u_long sctps_collisionestab;
- u_long sctps_passiveestab; /* sctpStats 3 (Counter32) */
- u_long sctps_aborted; /* sctpStats 4 (Counter32) */
- u_long sctps_shutdown; /* sctpStats 5 (Counter32) */
- u_long sctps_outoftheblue; /* sctpStats 6 (Counter32) */
- u_long sctps_checksumerrors; /* sctpStats 7 (Counter32) */
- u_long sctps_outcontrolchunks; /* sctpStats 8 (Counter64) */
- u_long sctps_outorderchunks; /* sctpStats 9 (Counter64) */
- u_long sctps_outunorderchunks; /* sctpStats 10 (Counter64) */
- u_long sctps_incontrolchunks; /* sctpStats 11 (Counter64) */
- u_long sctps_inorderchunks; /* sctpStats 12 (Counter64) */
- u_long sctps_inunorderchunks; /* sctpStats 13 (Counter64) */
- u_long sctps_fragusrmsgs; /* sctpStats 14 (Counter64) */
- u_long sctps_reasmusrmsgs; /* sctpStats 15 (Counter64) */
- u_long sctps_outpackets;/* sctpStats 16 (Counter64) */
- u_long sctps_inpackets; /* sctpStats 17 (Counter64) */
- struct timeval sctps_discontinuitytime; /* sctpStats 18 (TimeStamp) */
+ uint32_t sctps_currestab; /* sctpStats 1 (Gauge32) */
+ uint32_t sctps_activeestab; /* sctpStats 2 (Counter32) */
+ uint32_t sctps_restartestab;
+ uint32_t sctps_collisionestab;
+ uint32_t sctps_passiveestab; /* sctpStats 3 (Counter32) */
+ uint32_t sctps_aborted; /* sctpStats 4 (Counter32) */
+ uint32_t sctps_shutdown;/* sctpStats 5 (Counter32) */
+ uint32_t sctps_outoftheblue; /* sctpStats 6 (Counter32) */
+ uint32_t sctps_checksumerrors; /* sctpStats 7 (Counter32) */
+ uint32_t sctps_outcontrolchunks; /* sctpStats 8 (Counter64) */
+ uint32_t sctps_outorderchunks; /* sctpStats 9 (Counter64) */
+ uint32_t sctps_outunorderchunks; /* sctpStats 10 (Counter64) */
+ uint32_t sctps_incontrolchunks; /* sctpStats 11 (Counter64) */
+ uint32_t sctps_inorderchunks; /* sctpStats 12 (Counter64) */
+ uint32_t sctps_inunorderchunks; /* sctpStats 13 (Counter64) */
+ uint32_t sctps_fragusrmsgs; /* sctpStats 14 (Counter64) */
+ uint32_t sctps_reasmusrmsgs; /* sctpStats 15 (Counter64) */
+ uint32_t sctps_outpackets; /* sctpStats 16 (Counter64) */
+ uint32_t sctps_inpackets; /* sctpStats 17 (Counter64) */
+
/* input statistics: */
- u_long sctps_recvpackets; /* total input packets */
- u_long sctps_recvdatagrams; /* total input datagrams */
- u_long sctps_recvpktwithdata; /* total packets that had data */
- u_long sctps_recvsacks; /* total input SACK chunks */
- u_long sctps_recvdata; /* total input DATA chunks */
- u_long sctps_recvdupdata; /* total input duplicate DATA chunks */
- u_long sctps_recvheartbeat; /* total input HB chunks */
- u_long sctps_recvheartbeatack; /* total input HB-ACK chunks */
- u_long sctps_recvecne; /* total input ECNE chunks */
- u_long sctps_recvauth; /* total input AUTH chunks */
- u_long sctps_recvauthmissing; /* total input chunks missing AUTH */
- u_long sctps_recvivalhmacid; /* total number of invalid HMAC ids
+ uint32_t sctps_recvpackets; /* total input packets */
+ uint32_t sctps_recvdatagrams; /* total input datagrams */
+ uint32_t sctps_recvpktwithdata; /* total packets that had data */
+ uint32_t sctps_recvsacks; /* total input SACK chunks */
+ uint32_t sctps_recvdata;/* total input DATA chunks */
+ uint32_t sctps_recvdupdata; /* total input duplicate DATA chunks */
+ uint32_t sctps_recvheartbeat; /* total input HB chunks */
+ uint32_t sctps_recvheartbeatack; /* total input HB-ACK chunks */
+ uint32_t sctps_recvecne;/* total input ECNE chunks */
+ uint32_t sctps_recvauth;/* total input AUTH chunks */
+ uint32_t sctps_recvauthmissing; /* total input chunks missing AUTH */
+ uint32_t sctps_recvivalhmacid; /* total number of invalid HMAC ids
* received */
- u_long sctps_recvivalkeyid; /* total number of invalid secret ids
+ uint32_t sctps_recvivalkeyid; /* total number of invalid secret ids
* received */
- u_long sctps_recvauthfailed; /* total number of auth failed */
- u_long sctps_recvexpress; /* total fast path receives all one
+ uint32_t sctps_recvauthfailed; /* total number of auth failed */
+ uint32_t sctps_recvexpress; /* total fast path receives all one
* chunk */
- u_long sctps_recvexpressm; /* total fast path multi-part data */
+ uint32_t sctps_recvexpressm; /* total fast path multi-part data */
/* output statistics: */
- u_long sctps_sendpackets; /* total output packets */
- u_long sctps_sendsacks; /* total output SACKs */
- u_long sctps_senddata; /* total output DATA chunks */
- u_long sctps_sendretransdata; /* total output retransmitted DATA
+ uint32_t sctps_sendpackets; /* total output packets */
+ uint32_t sctps_sendsacks; /* total output SACKs */
+ uint32_t sctps_senddata;/* total output DATA chunks */
+ uint32_t sctps_sendretransdata; /* total output retransmitted DATA
* chunks */
- u_long sctps_sendfastretrans; /* total output fast retransmitted
+ uint32_t sctps_sendfastretrans; /* total output fast retransmitted
* DATA chunks */
- u_long sctps_sendmultfastretrans; /* total FR's that happened
+ uint32_t sctps_sendmultfastretrans; /* total FR's that happened
* more than once to same
* chunk (u-del multi-fr
* algo). */
- u_long sctps_sendheartbeat; /* total output HB chunks */
- u_long sctps_sendecne; /* total output ECNE chunks */
- u_long sctps_sendauth; /* total output AUTH chunks FIXME */
- u_long sctps_senderrors;/* ip_output error counter */
+ uint32_t sctps_sendheartbeat; /* total output HB chunks */
+ uint32_t sctps_sendecne;/* total output ECNE chunks */
+ uint32_t sctps_sendauth;/* total output AUTH chunks FIXME */
+ uint32_t sctps_senderrors; /* ip_output error counter */
/* PCKDROPREP statistics: */
- u_long sctps_pdrpfmbox; /* Packet drop from middle box */
- u_long sctps_pdrpfehos; /* P-drop from end host */
- u_long sctps_pdrpmbda; /* P-drops with data */
- u_long sctps_pdrpmbct; /* P-drops, non-data, non-endhost */
- u_long sctps_pdrpbwrpt; /* P-drop, non-endhost, bandwidth rep only */
- u_long sctps_pdrpcrupt; /* P-drop, not enough for chunk header */
- u_long sctps_pdrpnedat; /* P-drop, not enough data to confirm */
- u_long sctps_pdrppdbrk; /* P-drop, where process_chunk_drop said break */
- u_long sctps_pdrptsnnf; /* P-drop, could not find TSN */
- u_long sctps_pdrpdnfnd; /* P-drop, attempt reverse TSN lookup */
- u_long sctps_pdrpdiwnp; /* P-drop, e-host confirms zero-rwnd */
- u_long sctps_pdrpdizrw; /* P-drop, midbox confirms no space */
- u_long sctps_pdrpbadd; /* P-drop, data did not match TSN */
- u_long sctps_pdrpmark; /* P-drop, TSN's marked for Fast Retran */
+ uint32_t sctps_pdrpfmbox; /* Packet drop from middle box */
+ uint32_t sctps_pdrpfehos; /* P-drop from end host */
+ uint32_t sctps_pdrpmbda;/* P-drops with data */
+ uint32_t sctps_pdrpmbct;/* P-drops, non-data, non-endhost */
+ uint32_t sctps_pdrpbwrpt; /* P-drop, non-endhost, bandwidth rep
+ * only */
+ uint32_t sctps_pdrpcrupt; /* P-drop, not enough for chunk header */
+ uint32_t sctps_pdrpnedat; /* P-drop, not enough data to confirm */
+ uint32_t sctps_pdrppdbrk; /* P-drop, where process_chunk_drop
+ * said break */
+ uint32_t sctps_pdrptsnnf; /* P-drop, could not find TSN */
+ uint32_t sctps_pdrpdnfnd; /* P-drop, attempt reverse TSN lookup */
+ uint32_t sctps_pdrpdiwnp; /* P-drop, e-host confirms zero-rwnd */
+ uint32_t sctps_pdrpdizrw; /* P-drop, midbox confirms no space */
+ uint32_t sctps_pdrpbadd;/* P-drop, data did not match TSN */
+ uint32_t sctps_pdrpmark;/* P-drop, TSN's marked for Fast Retran */
/* timeouts */
- u_long sctps_timoiterator; /* Number of iterator timers that
+ uint32_t sctps_timoiterator; /* Number of iterator timers that
* fired */
- u_long sctps_timodata; /* Number of T3 data time outs */
- u_long sctps_timowindowprobe; /* Number of window probe (T3) timers
+ uint32_t sctps_timodata;/* Number of T3 data time outs */
+ uint32_t sctps_timowindowprobe; /* Number of window probe (T3) timers
* that fired */
- u_long sctps_timoinit; /* Number of INIT timers that fired */
- u_long sctps_timosack; /* Number of sack timers that fired */
- u_long sctps_timoshutdown; /* Number of shutdown timers that
+ uint32_t sctps_timoinit;/* Number of INIT timers that fired */
+ uint32_t sctps_timosack;/* Number of sack timers that fired */
+ uint32_t sctps_timoshutdown; /* Number of shutdown timers that
* fired */
- u_long sctps_timoheartbeat; /* Number of heartbeat timers that
+ uint32_t sctps_timoheartbeat; /* Number of heartbeat timers that
* fired */
- u_long sctps_timocookie;/* Number of times a cookie timeout fired */
- u_long sctps_timosecret;/* Number of times an endpoint changed its
- * cookie secret */
- u_long sctps_timopathmtu; /* Number of PMTU timers that fired */
- u_long sctps_timoshutdownack; /* Number of shutdown ack timers that
+ uint32_t sctps_timocookie; /* Number of times a cookie timeout
* fired */
- u_long sctps_timoshutdownguard; /* Number of shutdown guard timers
- * that fired */
- u_long sctps_timostrmrst; /* Number of stream reset timers that
+ uint32_t sctps_timosecret; /* Number of times an endpoint changed
+ * its cookie secret */
+ uint32_t sctps_timopathmtu; /* Number of PMTU timers that fired */
+ uint32_t sctps_timoshutdownack; /* Number of shutdown ack timers that
* fired */
- u_long sctps_timoearlyfr; /* Number of early FR timers that
+ uint32_t sctps_timoshutdownguard; /* Number of shutdown guard
+ * timers that fired */
+ uint32_t sctps_timostrmrst; /* Number of stream reset timers that
* fired */
- u_long sctps_timoasconf;/* Number of times an asconf timer fired */
- u_long sctps_timoautoclose; /* Number of times auto close timer
+ uint32_t sctps_timoearlyfr; /* Number of early FR timers that
* fired */
- u_long sctps_timoassockill; /* Number of asoc free timers expired */
- u_long sctps_timoinpkill; /* Number of inp free timers expired */
+ uint32_t sctps_timoasconf; /* Number of times an asconf timer
+ * fired */
+ uint32_t sctps_timoautoclose; /* Number of times auto close timer
+ * fired */
+ uint32_t sctps_timoassockill; /* Number of asoc free timers expired */
+ uint32_t sctps_timoinpkill; /* Number of inp free timers expired */
/* Early fast retransmission counters */
- u_long sctps_earlyfrstart;
- u_long sctps_earlyfrstop;
- u_long sctps_earlyfrmrkretrans;
- u_long sctps_earlyfrstpout;
- u_long sctps_earlyfrstpidsck1;
- u_long sctps_earlyfrstpidsck2;
- u_long sctps_earlyfrstpidsck3;
- u_long sctps_earlyfrstpidsck4;
- u_long sctps_earlyfrstrid;
- u_long sctps_earlyfrstrout;
- u_long sctps_earlyfrstrtmr;
+ uint32_t sctps_earlyfrstart;
+ uint32_t sctps_earlyfrstop;
+ uint32_t sctps_earlyfrmrkretrans;
+ uint32_t sctps_earlyfrstpout;
+ uint32_t sctps_earlyfrstpidsck1;
+ uint32_t sctps_earlyfrstpidsck2;
+ uint32_t sctps_earlyfrstpidsck3;
+ uint32_t sctps_earlyfrstpidsck4;
+ uint32_t sctps_earlyfrstrid;
+ uint32_t sctps_earlyfrstrout;
+ uint32_t sctps_earlyfrstrtmr;
/* otheres */
- u_long sctps_hdrops; /* packet shorter than header */
- u_long sctps_badsum; /* checksum error */
- u_long sctps_noport; /* no endpoint for port */
- u_long sctps_badvtag; /* bad v-tag */
- u_long sctps_badsid; /* bad SID */
- u_long sctps_nomem; /* no memory */
- u_long sctps_fastretransinrtt; /* number of multiple FR in a RTT
- * window */
- u_long sctps_markedretrans;
- u_long sctps_naglesent; /* nagle allowed sending */
- u_long sctps_naglequeued; /* nagle does't allow sending */
- u_long sctps_maxburstqueued; /* max burst dosn't allow sending */
- u_long sctps_ifnomemqueued; /* look ahead tells us no memory in
+ uint32_t sctps_hdrops; /* packet shorter than header */
+ uint32_t sctps_badsum; /* checksum error */
+ uint32_t sctps_noport; /* no endpoint for port */
+ uint32_t sctps_badvtag; /* bad v-tag */
+ uint32_t sctps_badsid; /* bad SID */
+ uint32_t sctps_nomem; /* no memory */
+ uint32_t sctps_fastretransinrtt; /* number of multiple FR in a
+ * RTT window */
+ uint32_t sctps_markedretrans;
+ uint32_t sctps_naglesent; /* nagle allowed sending */
+ uint32_t sctps_naglequeued; /* nagle does't allow sending */
+ uint32_t sctps_maxburstqueued; /* max burst dosn't allow sending */
+ uint32_t sctps_ifnomemqueued; /* look ahead tells us no memory in
* interface ring buffer OR we had a
* send error and are queuing one
* send. */
- u_long sctps_windowprobed; /* total number of window probes sent */
- u_long sctps_lowlevelerr; /* total times an output error causes
+ uint32_t sctps_windowprobed; /* total number of window probes sent */
+ uint32_t sctps_lowlevelerr; /* total times an output error causes
* us to clamp down on next user send. */
- u_long sctps_lowlevelerrusr; /* total times sctp_senderrors were
+ uint32_t sctps_lowlevelerrusr; /* total times sctp_senderrors were
* caused from a user send from a user
* invoked send not a sack response */
- u_long sctps_datadropchklmt; /* Number of in data drops due to
+ uint32_t sctps_datadropchklmt; /* Number of in data drops due to
* chunk limit reached */
- u_long sctps_datadroprwnd; /* Number of in data drops due to rwnd
+ uint32_t sctps_datadroprwnd; /* Number of in data drops due to rwnd
* limit reached */
- u_long sctps_ecnereducedcwnd; /* Number of times a ECN reduced the
+ uint32_t sctps_ecnereducedcwnd; /* Number of times a ECN reduced the
* cwnd */
- u_long sctps_vtagexpress; /* Used express lookup via vtag */
- u_long sctps_vtagbogus; /* Collision in express lookup. */
- u_long sctps_primary_randry; /* Number of times the sender ran dry
+ uint32_t sctps_vtagexpress; /* Used express lookup via vtag */
+ uint32_t sctps_vtagbogus; /* Collision in express lookup. */
+ uint32_t sctps_primary_randry; /* Number of times the sender ran dry
* of user data on primary */
- u_long sctps_cmt_randry;/* Same for above */
- u_long sctps_slowpath_sack; /* Sacks the slow way */
- u_long sctps_wu_sacks_sent; /* Window Update only sacks sent */
- u_long sctps_sends_with_flags; /* number of sends with sinfo_flags
- * !=0 */
- u_long sctps_sends_with_unord /* number of undordered sends */ ;
- u_long sctps_sends_with_eof; /* number of sends with EOF flag set */
- u_long sctps_sends_with_abort; /* number of sends with ABORT flag set */
- u_long sctps_protocol_drain_calls; /* number of times protocol
+ uint32_t sctps_cmt_randry; /* Same for above */
+ uint32_t sctps_slowpath_sack; /* Sacks the slow way */
+ uint32_t sctps_wu_sacks_sent; /* Window Update only sacks sent */
+ uint32_t sctps_sends_with_flags; /* number of sends with
+ * sinfo_flags !=0 */
+ uint32_t sctps_sends_with_unord /* number of undordered sends */ ;
+ uint32_t sctps_sends_with_eof; /* number of sends with EOF flag set */
+ uint32_t sctps_sends_with_abort; /* number of sends with ABORT
+ * flag set */
+ uint32_t sctps_protocol_drain_calls; /* number of times protocol
* drain called */
- u_long sctps_protocol_drains_done; /* number of times we did a
+ uint32_t sctps_protocol_drains_done; /* number of times we did a
* protocol drain */
- u_long sctps_read_peeks;/* Number of times recv was called with peek */
- u_long sctps_cached_chk;/* Number of cached chunks used */
- u_long sctps_cached_strmoq; /* Number of cached stream oq's used */
- u_long sctps_left_abandon; /* Number of unread message abandonded
+ uint32_t sctps_read_peeks; /* Number of times recv was called
+ * with peek */
+ uint32_t sctps_cached_chk; /* Number of cached chunks used */
+ uint32_t sctps_cached_strmoq; /* Number of cached stream oq's used */
+ uint32_t sctps_left_abandon; /* Number of unread message abandonded
* by close */
- u_long sctps_send_burst_avoid; /* Send burst avoidance, already max
- * burst inflight to net */
- u_long sctps_send_cwnd_avoid; /* Send cwnd full avoidance, already
+ uint32_t sctps_send_burst_avoid; /* Send burst avoidance,
+ * already max burst inflight
+ * to net */
+ uint32_t sctps_send_cwnd_avoid; /* Send cwnd full avoidance, already
* max burst inflight to net */
- u_long sctps_fwdtsn_map_over; /* number of map array over-runs via
+ uint32_t sctps_fwdtsn_map_over; /* number of map array over-runs via
* fwd-tsn's */
+
+ struct timeval sctps_discontinuitytime; /* sctpStats 18 (TimeStamp) */
};
#define SCTP_STAT_INCR(_x) SCTP_STAT_INCR_BY(_x,1)
#define SCTP_STAT_DECR(_x) SCTP_STAT_DECR_BY(_x,1)
-#define SCTP_STAT_INCR_BY(_x,_d) atomic_add_long(&sctpstat._x, _d)
-#define SCTP_STAT_DECR_BY(_x,_d) atomic_subtract_long(&sctpstat._x, _d)
+#define SCTP_STAT_INCR_BY(_x,_d) atomic_add_int(&sctpstat._x, _d)
+#define SCTP_STAT_DECR_BY(_x,_d) atomic_subtract_int(&sctpstat._x, _d)
+
/* The following macros are for handling MIB values, */
#define SCTP_STAT_INCR_COUNTER32(_x) SCTP_STAT_INCR(_x)
#define SCTP_STAT_INCR_COUNTER64(_x) SCTP_STAT_INCR(_x)
@@ -913,8 +925,6 @@ struct sctpstat {
#define SCTP_STAT_DECR_COUNTER64(_x) SCTP_STAT_DECR(_x)
#define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x)
-#define SCTP_ALIGN_64_SA 36
-
union sctp_sockstore {
#if defined(INET) || !defined(_KERNEL)
struct sockaddr_in sin;
@@ -923,28 +933,24 @@ union sctp_sockstore {
struct sockaddr_in6 sin6;
#endif
struct sockaddr sa;
- uint8_t reserved[SCTP_ALIGN_64_SA];
};
struct xsctp_inpcb {
uint32_t last;
- uint16_t local_port;
uint32_t flags;
uint32_t features;
uint32_t total_sends;
uint32_t total_recvs;
uint32_t total_nospaces;
uint32_t fragmentation_point;
+ uint16_t local_port;
uint16_t qlen;
uint16_t maxqlen;
- /* add more endpoint specific data here */
};
struct xsctp_tcb {
- uint32_t last;
- uint16_t local_port; /* sctpAssocEntry 3 */
- uint16_t remote_port; /* sctpAssocEntry 4 */
union sctp_sockstore primary_addr; /* sctpAssocEntry 5/6 */
+ uint32_t last;
uint32_t heartbeat_interval; /* sctpAssocEntry 7 */
uint32_t state; /* sctpAssocEntry 8 */
uint32_t in_streams; /* sctpAssocEntry 9 */
@@ -954,8 +960,6 @@ struct xsctp_tcb {
uint32_t T1_expireries; /* sctpAssocEntry 13 */
uint32_t T2_expireries; /* sctpAssocEntry 14 */
uint32_t retransmitted_tsns; /* sctpAssocEntry 15 */
- struct timeval start_time; /* sctpAssocEntry 16 */
- struct timeval discontinuity_time; /* sctpAssocEntry 17 */
uint32_t total_sends;
uint32_t total_recvs;
uint32_t local_tag;
@@ -966,22 +970,21 @@ struct xsctp_tcb {
uint32_t cumulative_tsn_ack;
uint32_t mtu;
uint32_t refcnt;
- /* add more association specific data here */
+ uint16_t local_port; /* sctpAssocEntry 3 */
+ uint16_t remote_port; /* sctpAssocEntry 4 */
+ struct timeval start_time; /* sctpAssocEntry 16 */
+ struct timeval discontinuity_time; /* sctpAssocEntry 17 */
};
struct xsctp_laddr {
- uint32_t last;
union sctp_sockstore address; /* sctpAssocLocalAddrEntry 1/2 */
+ uint32_t last;
struct timeval start_time; /* sctpAssocLocalAddrEntry 3 */
- /* add more local address specific data */
};
struct xsctp_raddr {
- uint32_t last;
union sctp_sockstore address; /* sctpAssocLocalRemEntry 1/2 */
- uint8_t active; /* sctpAssocLocalRemEntry 3 */
- uint8_t confirmed; /* */
- uint8_t heartbeat_enabled; /* sctpAssocLocalRemEntry 4 */
+ uint32_t last;
uint32_t rto; /* sctpAssocLocalRemEntry 5 */
uint32_t max_path_rtx; /* sctpAssocLocalRemEntry 6 */
uint32_t rtx; /* sctpAssocLocalRemEntry 7 */
@@ -989,8 +992,10 @@ struct xsctp_raddr {
uint32_t cwnd; /* */
uint32_t flight_size; /* */
uint32_t mtu; /* */
+ uint8_t active; /* sctpAssocLocalRemEntry 3 */
+ uint8_t confirmed; /* */
+ uint8_t heartbeat_enabled; /* sctpAssocLocalRemEntry 4 */
struct timeval start_time; /* sctpAssocLocalRemEntry 8 */
- /* add more remote address specific data */
};
/*
diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c
index 3d607b6..74a0f64 100644
--- a/sys/netinet/sctputil.c
+++ b/sys/netinet/sctputil.c
@@ -3358,11 +3358,11 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb,
sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), SCTP_STRRESET_INBOUND_STR);
break;
case SCTP_NOTIFY_STR_RESET_FAILED_OUT:
- sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), (SCTP_STRRESET_OUTBOUND_STR | SCTP_STRRESET_INBOUND_STR));
+ sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), (SCTP_STRRESET_OUTBOUND_STR | SCTP_STRRESET_FAILED));
break;
case SCTP_NOTIFY_STR_RESET_FAILED_IN:
- sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), (SCTP_STRRESET_INBOUND_STR | SCTP_STRRESET_INBOUND_STR));
+ sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), (SCTP_STRRESET_INBOUND_STR | SCTP_STRRESET_FAILED));
break;
case SCTP_NOTIFY_ASCONF_ADD_IP:
OpenPOWER on IntegriCloud