summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/netinet/sctputil.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/sys/netinet/sctputil.c')
-rw-r--r--freebsd/sys/netinet/sctputil.c180
1 files changed, 98 insertions, 82 deletions
diff --git a/freebsd/sys/netinet/sctputil.c b/freebsd/sys/netinet/sctputil.c
index 136b4bb6..79bb0620 100644
--- a/freebsd/sys/netinet/sctputil.c
+++ b/freebsd/sys/netinet/sctputil.c
@@ -96,7 +96,7 @@ sctp_log_closing(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int16_t loc)
sctp_clog.x.close.sctp_flags = inp->sctp_flags;
if (stcb) {
sctp_clog.x.close.stcb = (void *)stcb;
- sctp_clog.x.close.state = (uint16_t) stcb->asoc.state;
+ sctp_clog.x.close.state = (uint16_t)stcb->asoc.state;
} else {
sctp_clog.x.close.stcb = 0;
sctp_clog.x.close.state = 0;
@@ -229,12 +229,12 @@ sctp_log_mb(struct mbuf *m, int from)
struct sctp_cwnd_log sctp_clog;
sctp_clog.x.mb.mp = m;
- sctp_clog.x.mb.mbuf_flags = (uint8_t) (SCTP_BUF_GET_FLAGS(m));
- sctp_clog.x.mb.size = (uint16_t) (SCTP_BUF_LEN(m));
+ sctp_clog.x.mb.mbuf_flags = (uint8_t)(SCTP_BUF_GET_FLAGS(m));
+ sctp_clog.x.mb.size = (uint16_t)(SCTP_BUF_LEN(m));
sctp_clog.x.mb.data = SCTP_BUF_AT(m, 0);
if (SCTP_BUF_IS_EXTENDED(m)) {
sctp_clog.x.mb.ext = SCTP_BUF_EXTEND_BASE(m);
- sctp_clog.x.mb.refcnt = (uint8_t) (SCTP_BUF_EXTEND_REFCNT(m));
+ sctp_clog.x.mb.refcnt = (uint8_t)(SCTP_BUF_EXTEND_REFCNT(m));
} else {
sctp_clog.x.mb.ext = 0;
sctp_clog.x.mb.refcnt = 0;
@@ -270,11 +270,11 @@ sctp_log_strm_del(struct sctp_queued_to_read *control, struct sctp_queued_to_rea
}
sctp_clog.x.strlog.stcb = control->stcb;
sctp_clog.x.strlog.n_tsn = control->sinfo_tsn;
- sctp_clog.x.strlog.n_sseq = (uint16_t) control->mid;
+ sctp_clog.x.strlog.n_sseq = (uint16_t)control->mid;
sctp_clog.x.strlog.strm = control->sinfo_stream;
if (poschk != NULL) {
sctp_clog.x.strlog.e_tsn = poschk->sinfo_tsn;
- sctp_clog.x.strlog.e_sseq = (uint16_t) poschk->mid;
+ sctp_clog.x.strlog.e_sseq = (uint16_t)poschk->mid;
} else {
sctp_clog.x.strlog.e_tsn = 0;
sctp_clog.x.strlog.e_sseq = 0;
@@ -471,12 +471,12 @@ sctp_wakeup_log(struct sctp_tcb *stcb, uint32_t wake_cnt, int from)
sctp_clog.x.wake.sent_q = stcb->asoc.sent_queue_cnt;
if (stcb->asoc.stream_queue_cnt < 0xff)
- sctp_clog.x.wake.stream_qcnt = (uint8_t) stcb->asoc.stream_queue_cnt;
+ sctp_clog.x.wake.stream_qcnt = (uint8_t)stcb->asoc.stream_queue_cnt;
else
sctp_clog.x.wake.stream_qcnt = 0xff;
if (stcb->asoc.chunks_on_out_queue < 0xff)
- sctp_clog.x.wake.chunks_on_oque = (uint8_t) stcb->asoc.chunks_on_out_queue;
+ sctp_clog.x.wake.chunks_on_oque = (uint8_t)stcb->asoc.chunks_on_out_queue;
else
sctp_clog.x.wake.chunks_on_oque = 0xff;
@@ -492,7 +492,7 @@ sctp_wakeup_log(struct sctp_tcb *stcb, uint32_t wake_cnt, int from)
if (stcb->sctp_socket) {
struct socket *so = stcb->sctp_socket;
- sctp_clog.x.wake.sbflags = (uint8_t) ((so->so_snd.sb_flags & 0x00ff));
+ sctp_clog.x.wake.sbflags = (uint8_t)((so->so_snd.sb_flags & 0x00ff));
} else {
sctp_clog.x.wake.sbflags = 0xff;
}
@@ -511,12 +511,12 @@ sctp_log_block(uint8_t from, struct sctp_association *asoc, size_t sendlen)
struct sctp_cwnd_log sctp_clog;
sctp_clog.x.blk.onsb = asoc->total_output_queue_size;
- sctp_clog.x.blk.send_sent_qcnt = (uint16_t) (asoc->send_queue_cnt + asoc->sent_queue_cnt);
+ sctp_clog.x.blk.send_sent_qcnt = (uint16_t)(asoc->send_queue_cnt + asoc->sent_queue_cnt);
sctp_clog.x.blk.peer_rwnd = asoc->peers_rwnd;
- sctp_clog.x.blk.stream_qcnt = (uint16_t) asoc->stream_queue_cnt;
- sctp_clog.x.blk.chunks_on_oque = (uint16_t) asoc->chunks_on_out_queue;
- sctp_clog.x.blk.flight_size = (uint16_t) (asoc->total_flight / 1024);
- sctp_clog.x.blk.sndlen = (uint32_t) sendlen;
+ sctp_clog.x.blk.stream_qcnt = (uint16_t)asoc->stream_queue_cnt;
+ sctp_clog.x.blk.chunks_on_oque = (uint16_t)asoc->chunks_on_out_queue;
+ sctp_clog.x.blk.flight_size = (uint16_t)(asoc->total_flight / 1024);
+ sctp_clog.x.blk.sndlen = (uint32_t)sendlen;
SCTP_CTR6(KTR_SCTP, "SCTP:%d[%d]:%x-%x-%x-%x",
SCTP_LOG_EVENT_BLOCK,
from,
@@ -558,8 +558,8 @@ sctp_print_audit_report(void)
SCTP_PRINTF("\n");
cnt = 0;
}
- SCTP_PRINTF("%2.2x%2.2x ", (uint32_t) sctp_audit_data[i][0],
- (uint32_t) sctp_audit_data[i][1]);
+ SCTP_PRINTF("%2.2x%2.2x ", (uint32_t)sctp_audit_data[i][0],
+ (uint32_t)sctp_audit_data[i][1]);
cnt++;
if ((cnt % 14) == 0)
SCTP_PRINTF("\n");
@@ -577,8 +577,8 @@ sctp_print_audit_report(void)
SCTP_PRINTF("\n");
cnt = 0;
}
- SCTP_PRINTF("%2.2x%2.2x ", (uint32_t) sctp_audit_data[i][0],
- (uint32_t) sctp_audit_data[i][1]);
+ SCTP_PRINTF("%2.2x%2.2x ", (uint32_t)sctp_audit_data[i][0],
+ (uint32_t)sctp_audit_data[i][1]);
cnt++;
if ((cnt % 14) == 0)
SCTP_PRINTF("\n");
@@ -830,9 +830,9 @@ sctp_fill_random_store(struct sctp_pcb *m)
* numbers, but thats ok too since that is random as well :->
*/
m->store_at = 0;
- (void)sctp_hmac(SCTP_HMAC, (uint8_t *) m->random_numbers,
- sizeof(m->random_numbers), (uint8_t *) & m->random_counter,
- sizeof(m->random_counter), (uint8_t *) m->random_store);
+ (void)sctp_hmac(SCTP_HMAC, (uint8_t *)m->random_numbers,
+ sizeof(m->random_numbers), (uint8_t *)&m->random_counter,
+ sizeof(m->random_counter), (uint8_t *)m->random_store);
m->random_counter++;
}
@@ -869,7 +869,7 @@ retry:
sctp_fill_random_store(inp);
}
p = &inp->random_store[store_at];
- xp = (uint32_t *) p;
+ xp = (uint32_t *)p;
x = *xp;
return (x);
}
@@ -978,7 +978,7 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
asoc->nrsack_supported = inp->nrsack_supported;
asoc->pktdrop_supported = inp->pktdrop_supported;
asoc->idata_supported = inp->idata_supported;
- asoc->sctp_cmt_pf = (uint8_t) 0;
+ asoc->sctp_cmt_pf = (uint8_t)0;
asoc->sctp_frag_point = inp->sctp_frag_point;
asoc->sctp_features = inp->sctp_features;
asoc->default_dscp = inp->sctp_ep.default_dscp;
@@ -1484,8 +1484,10 @@ sctp_handle_addr_wq(void)
sctp_asconf_iterator_end, NULL, 0);
if (ret) {
SCTP_PRINTF("Failed to initiate iterator for handle_addr_wq\n");
- /* Freeing if we are stopping or put back on the
- * addr_wq. */
+ /*
+ * Freeing if we are stopping or put back on the
+ * addr_wq.
+ */
if (SCTP_BASE_VAR(sctp_pcb_initialized) == 0) {
sctp_asconf_iterator_end(asc, 0);
} else {
@@ -1522,7 +1524,7 @@ sctp_timeout_handler(void *t)
did_output = 1;
#ifdef SCTP_AUDITING_ENABLED
- sctp_audit_log(0xF0, (uint8_t) tmr->type);
+ sctp_audit_log(0xF0, (uint8_t)tmr->type);
sctp_auditing(3, inp, stcb, net);
#endif
@@ -1917,7 +1919,7 @@ sctp_timeout_handler(void *t)
break;
}
#ifdef SCTP_AUDITING_ENABLED
- sctp_audit_log(0xF1, (uint8_t) type);
+ sctp_audit_log(0xF1, (uint8_t)type);
if (inp)
sctp_auditing(5, inp, stcb, net);
#endif
@@ -2479,14 +2481,16 @@ sctp_calculate_rto(struct sctp_tcb *stcb,
}
timevalsub(&now, old);
/* store the current RTT in us */
- net->rtt = (uint64_t) 1000000 *(uint64_t) now.tv_sec +
- (uint64_t) now.tv_usec;
+ net->rtt = (uint64_t)1000000 *(uint64_t)now.tv_sec +
+ (uint64_t)now.tv_usec;
/* compute rtt in ms */
- rtt = (int32_t) (net->rtt / 1000);
+ rtt = (int32_t)(net->rtt / 1000);
if ((asoc->cc_functions.sctp_rtt_calculated) && (rtt_from_sack == SCTP_RTT_FROM_DATA)) {
- /* Tell the CC module that a new update has just occurred
- * from a sack */
+ /*
+ * Tell the CC module that a new update has just occurred
+ * from a sack
+ */
(*asoc->cc_functions.sctp_rtt_calculated) (stcb, net, &now);
}
/*
@@ -2562,7 +2566,7 @@ sctp_calculate_rto(struct sctp_tcb *stcb,
* is >= 'len' returns NULL if there there isn't 'len' bytes in the chain.
*/
caddr_t
-sctp_m_getptr(struct mbuf *m, int off, int len, uint8_t * in_ptr)
+sctp_m_getptr(struct mbuf *m, int off, int len, uint8_t *in_ptr)
{
uint32_t count;
uint8_t *ptr;
@@ -2611,7 +2615,7 @@ sctp_get_next_param(struct mbuf *m,
{
/* This just provides a typed signature to Peter's Pull routine */
return ((struct sctp_paramhdr *)sctp_m_getptr(m, offset, pull_limit,
- (uint8_t *) pull));
+ (uint8_t *)pull));
}
@@ -2974,7 +2978,7 @@ sctp_notify_send_failed(struct sctp_tcb *stcb, uint8_t sent, uint32_t error,
} else {
ssfe->ssfe_flags = SCTP_DATA_UNSENT;
}
- ssfe->ssfe_length = (uint32_t) (notifhdr_len + payload_len);
+ ssfe->ssfe_length = (uint32_t)(notifhdr_len + payload_len);
ssfe->ssfe_error = error;
/* not exactly what the user sent in, but should be close :) */
ssfe->ssfe_info.snd_sid = chk->rec.data.sid;
@@ -2992,11 +2996,11 @@ sctp_notify_send_failed(struct sctp_tcb *stcb, uint8_t sent, uint32_t error,
} else {
ssf->ssf_flags = SCTP_DATA_UNSENT;
}
- ssf->ssf_length = (uint32_t) (notifhdr_len + payload_len);
+ ssf->ssf_length = (uint32_t)(notifhdr_len + payload_len);
ssf->ssf_error = error;
/* not exactly what the user sent in, but should be close :) */
ssf->ssf_info.sinfo_stream = chk->rec.data.sid;
- ssf->ssf_info.sinfo_ssn = (uint16_t) chk->rec.data.mid;
+ ssf->ssf_info.sinfo_ssn = (uint16_t)chk->rec.data.mid;
ssf->ssf_info.sinfo_flags = chk->rec.data.rcv_flags;
ssf->ssf_info.sinfo_ppid = chk->rec.data.ppid;
ssf->ssf_info.sinfo_context = chk->rec.data.context;
@@ -3078,7 +3082,7 @@ sctp_notify_send_failed2(struct sctp_tcb *stcb, uint32_t error,
memset(ssfe, 0, notifhdr_len);
ssfe->ssfe_type = SCTP_SEND_FAILED_EVENT;
ssfe->ssfe_flags = SCTP_DATA_UNSENT;
- ssfe->ssfe_length = (uint32_t) (notifhdr_len + sp->length);
+ ssfe->ssfe_length = (uint32_t)(notifhdr_len + sp->length);
ssfe->ssfe_error = error;
/* not exactly what the user sent in, but should be close :) */
ssfe->ssfe_info.snd_sid = sp->sid;
@@ -3096,7 +3100,7 @@ sctp_notify_send_failed2(struct sctp_tcb *stcb, uint32_t error,
memset(ssf, 0, notifhdr_len);
ssf->ssf_type = SCTP_SEND_FAILED;
ssf->ssf_flags = SCTP_DATA_UNSENT;
- ssf->ssf_length = (uint32_t) (notifhdr_len + sp->length);
+ ssf->ssf_length = (uint32_t)(notifhdr_len + sp->length);
ssf->ssf_error = error;
/* not exactly what the user sent in, but should be close :) */
ssf->ssf_info.sinfo_stream = sp->sid;
@@ -3513,7 +3517,7 @@ sctp_notify_stream_reset_tsn(struct sctp_tcb *stcb, uint32_t sending_tsn, uint32
static void
sctp_notify_stream_reset(struct sctp_tcb *stcb,
- int number_entries, uint16_t * list, int flag)
+ int number_entries, uint16_t *list, int flag)
{
struct mbuf *m_notify;
struct sctp_queued_to_read *control;
@@ -3721,7 +3725,7 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb,
{
uint32_t val;
- val = *((uint32_t *) data);
+ val = *((uint32_t *)data);
sctp_notify_partial_delivery_indication(stcb, error, val, so_locked);
break;
@@ -3750,25 +3754,25 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb,
}
break;
case SCTP_NOTIFY_STR_RESET_SEND:
- sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), SCTP_STREAM_RESET_OUTGOING_SSN);
+ sctp_notify_stream_reset(stcb, error, ((uint16_t *)data), SCTP_STREAM_RESET_OUTGOING_SSN);
break;
case SCTP_NOTIFY_STR_RESET_RECV:
- sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), SCTP_STREAM_RESET_INCOMING);
+ sctp_notify_stream_reset(stcb, error, ((uint16_t *)data), SCTP_STREAM_RESET_INCOMING);
break;
case SCTP_NOTIFY_STR_RESET_FAILED_OUT:
- sctp_notify_stream_reset(stcb, error, ((uint16_t *) data),
+ sctp_notify_stream_reset(stcb, error, ((uint16_t *)data),
(SCTP_STREAM_RESET_OUTGOING_SSN | SCTP_STREAM_RESET_FAILED));
break;
case SCTP_NOTIFY_STR_RESET_DENIED_OUT:
- sctp_notify_stream_reset(stcb, error, ((uint16_t *) data),
+ sctp_notify_stream_reset(stcb, error, ((uint16_t *)data),
(SCTP_STREAM_RESET_OUTGOING_SSN | SCTP_STREAM_RESET_DENIED));
break;
case SCTP_NOTIFY_STR_RESET_FAILED_IN:
- sctp_notify_stream_reset(stcb, error, ((uint16_t *) data),
+ sctp_notify_stream_reset(stcb, error, ((uint16_t *)data),
(SCTP_STREAM_RESET_INCOMING | SCTP_STREAM_RESET_FAILED));
break;
case SCTP_NOTIFY_STR_RESET_DENIED_IN:
- sctp_notify_stream_reset(stcb, error, ((uint16_t *) data),
+ sctp_notify_stream_reset(stcb, error, ((uint16_t *)data),
(SCTP_STREAM_RESET_INCOMING | SCTP_STREAM_RESET_DENIED));
break;
case SCTP_NOTIFY_ASCONF_ADD_IP:
@@ -3788,17 +3792,17 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb,
break;
case SCTP_NOTIFY_AUTH_NEW_KEY:
sctp_notify_authentication(stcb, SCTP_AUTH_NEW_KEY, error,
- (uint16_t) (uintptr_t) data,
+ (uint16_t)(uintptr_t)data,
so_locked);
break;
case SCTP_NOTIFY_AUTH_FREE_KEY:
sctp_notify_authentication(stcb, SCTP_AUTH_FREE_KEY, error,
- (uint16_t) (uintptr_t) data,
+ (uint16_t)(uintptr_t)data,
so_locked);
break;
case SCTP_NOTIFY_NO_PEER_AUTH:
sctp_notify_authentication(stcb, SCTP_AUTH_NO_AUTH, error,
- (uint16_t) (uintptr_t) data,
+ (uint16_t)(uintptr_t)data,
so_locked);
break;
case SCTP_NOTIFY_SENDER_DRY:
@@ -4148,7 +4152,7 @@ sctp_handle_ootb(struct mbuf *m, int iphlen, int offset,
}
contains_init_chunk = 0;
ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, offset,
- sizeof(*ch), (uint8_t *) & chunk_buf);
+ sizeof(*ch), (uint8_t *)&chunk_buf);
while (ch != NULL) {
chk_length = ntohs(ch->chunk_length);
if (chk_length < sizeof(*ch)) {
@@ -4181,7 +4185,7 @@ sctp_handle_ootb(struct mbuf *m, int iphlen, int offset,
}
offset += SCTP_SIZE32(chk_length);
ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, offset,
- sizeof(*ch), (uint8_t *) & chunk_buf);
+ sizeof(*ch), (uint8_t *)&chunk_buf);
}
if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) ||
((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) &&
@@ -4197,7 +4201,7 @@ sctp_handle_ootb(struct mbuf *m, int iphlen, int offset,
* if there is return 1, else return 0.
*/
int
-sctp_is_there_an_abort_here(struct mbuf *m, int iphlen, uint32_t * vtagfill)
+sctp_is_there_an_abort_here(struct mbuf *m, int iphlen, uint32_t *vtagfill)
{
struct sctp_chunkhdr *ch;
struct sctp_init_chunk *init_chk, chunk_buf;
@@ -4206,7 +4210,7 @@ sctp_is_there_an_abort_here(struct mbuf *m, int iphlen, uint32_t * vtagfill)
offset = iphlen + sizeof(struct sctphdr);
ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, offset, sizeof(*ch),
- (uint8_t *) & chunk_buf);
+ (uint8_t *)&chunk_buf);
while (ch != NULL) {
chk_length = ntohs(ch->chunk_length);
if (chk_length < sizeof(*ch)) {
@@ -4221,7 +4225,7 @@ sctp_is_there_an_abort_here(struct mbuf *m, int iphlen, uint32_t * vtagfill)
if (ch->chunk_type == SCTP_INITIATION) {
/* need to update the Vtag */
init_chk = (struct sctp_init_chunk *)sctp_m_getptr(m,
- offset, sizeof(*init_chk), (uint8_t *) & chunk_buf);
+ offset, sizeof(*init_chk), (uint8_t *)&chunk_buf);
if (init_chk != NULL) {
*vtagfill = ntohl(init_chk->init.initiate_tag);
}
@@ -4229,7 +4233,7 @@ sctp_is_there_an_abort_here(struct mbuf *m, int iphlen, uint32_t * vtagfill)
/* Nope, move to the next chunk */
offset += SCTP_SIZE32(chk_length);
ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, offset,
- sizeof(*ch), (uint8_t *) & chunk_buf);
+ sizeof(*ch), (uint8_t *)&chunk_buf);
}
return (0);
}
@@ -4615,7 +4619,7 @@ sctp_generate_cause(uint16_t code, char *info)
if (info_len > (SCTP_MAX_CAUSE_LENGTH - sizeof(struct sctp_paramhdr))) {
return (NULL);
}
- len = (uint16_t) (sizeof(struct sctp_paramhdr) + info_len);
+ len = (uint16_t)(sizeof(struct sctp_paramhdr) + info_len);
m = sctp_get_mbuf_for_msg(len, 0, M_NOWAIT, 1, MT_DATA);
if (m != NULL) {
SCTP_BUF_LEN(m) = len;
@@ -4634,14 +4638,14 @@ sctp_generate_no_user_data_cause(uint32_t tsn)
struct sctp_error_no_user_data *no_user_data_cause;
uint16_t len;
- len = (uint16_t) sizeof(struct sctp_error_no_user_data);
+ len = (uint16_t)sizeof(struct sctp_error_no_user_data);
m = sctp_get_mbuf_for_msg(len, 0, M_NOWAIT, 1, MT_DATA);
if (m != NULL) {
SCTP_BUF_LEN(m) = len;
no_user_data_cause = mtod(m, struct sctp_error_no_user_data *);
no_user_data_cause->cause.code = htons(SCTP_CAUSE_NO_USER_DATA);
no_user_data_cause->cause.length = htons(len);
- no_user_data_cause->tsn = tsn; /* tsn is passed in as NBO */
+ no_user_data_cause->tsn = htonl(tsn);
}
return (m);
}
@@ -4794,8 +4798,10 @@ sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1,
do_wakeup_routine = 1;
tp1->sent = SCTP_FORWARD_TSN_SKIP;
TAILQ_REMOVE(&stcb->asoc.send_queue, tp1, sctp_next);
- /* on to the sent queue so we can wait for it to be
- * passed by. */
+ /*
+ * on to the sent queue so we can wait for it to be
+ * passed by.
+ */
TAILQ_INSERT_TAIL(&stcb->asoc.sent_queue, tp1,
sctp_next);
stcb->asoc.send_queue_cnt--;
@@ -5028,8 +5034,8 @@ sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock)
hash_head = &vrf->vrf_addr_hash[(hash_of_addr & vrf->vrf_addr_hashmark)];
if (hash_head == NULL) {
SCTP_PRINTF("hash_of_addr:%x mask:%x table:%x - ",
- hash_of_addr, (uint32_t) vrf->vrf_addr_hashmark,
- (uint32_t) (hash_of_addr & vrf->vrf_addr_hashmark));
+ hash_of_addr, (uint32_t)vrf->vrf_addr_hashmark,
+ (uint32_t)(hash_of_addr & vrf->vrf_addr_hashmark));
sctp_print_address(addr);
SCTP_PRINTF("No such bucket for address\n");
if (holds_lock == 0)
@@ -5071,7 +5077,7 @@ sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock)
}
static void
-sctp_user_rcvd(struct sctp_tcb *stcb, uint32_t * freed_so_far, int hold_rlock,
+sctp_user_rcvd(struct sctp_tcb *stcb, uint32_t *freed_so_far, int hold_rlock,
uint32_t rwnd_req)
{
/* User pulled some data, do we need a rwnd update? */
@@ -5233,11 +5239,11 @@ sctp_sorecvmsg(struct socket *so,
in_eeor_mode = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXPLICIT_EOR);
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_RECV_RWND_LOGGING_ENABLE) {
sctp_misc_ints(SCTP_SORECV_ENTER,
- rwnd_req, in_eeor_mode, so->so_rcv.sb_cc, (uint32_t) uio->uio_resid);
+ rwnd_req, in_eeor_mode, so->so_rcv.sb_cc, (uint32_t)uio->uio_resid);
}
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_RECV_RWND_LOGGING_ENABLE) {
sctp_misc_ints(SCTP_SORECV_ENTERPL,
- rwnd_req, block_allowed, so->so_rcv.sb_cc, (uint32_t) uio->uio_resid);
+ rwnd_req, block_allowed, so->so_rcv.sb_cc, (uint32_t)uio->uio_resid);
}
error = sblock(&so->so_rcv, (block_allowed ? SBL_WAIT : 0));
if (error) {
@@ -5288,8 +5294,10 @@ restart_nosblocks:
* connect.
*/
if (inp->sctp_flags & SCTP_PCB_FLAGS_WAS_ABORTED) {
- /* You were aborted, passive side
- * always hits here */
+ /*
+ * You were aborted, passive side
+ * always hits here
+ */
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, ECONNRESET);
error = ECONNRESET;
}
@@ -5388,8 +5396,10 @@ restart_nosblocks:
}
if ((control->length == 0) &&
(control->end_added == 1)) {
- /* Do we also need to check for (control->pdapi_aborted ==
- * 1)? */
+ /*
+ * Do we also need to check for (control->pdapi_aborted ==
+ * 1)?
+ */
if (hold_rlock == 0) {
hold_rlock = 1;
SCTP_INP_READ_LOCK(inp);
@@ -5530,7 +5540,7 @@ found_one:
/* First lets get off the sinfo and sockaddr info */
if ((sinfo != NULL) && (filling_sinfo != 0)) {
sinfo->sinfo_stream = control->sinfo_stream;
- sinfo->sinfo_ssn = (uint16_t) control->mid;
+ sinfo->sinfo_ssn = (uint16_t)control->mid;
sinfo->sinfo_flags = control->sinfo_flags;
sinfo->sinfo_ppid = control->sinfo_ppid;
sinfo->sinfo_context = control->sinfo_context;
@@ -5606,7 +5616,7 @@ found_one:
entry = &inp->readlog[index];
entry->vtag = control->sinfo_assoc_id;
entry->strm = control->sinfo_stream;
- entry->seq = (uint16_t) control->mid;
+ entry->seq = (uint16_t)control->mid;
entry->sz = control->length;
entry->flgs = control->sinfo_flags;
}
@@ -5732,8 +5742,10 @@ get_more_data:
atomic_subtract_int(&control->length, cp_len);
control->data = sctp_m_free(m);
m = control->data;
- /* been through it all, must hold sb
- * lock ok to null tail */
+ /*
+ * been through it all, must hold sb
+ * lock ok to null tail
+ */
if (control->data == NULL) {
#ifdef INVARIANTS
if ((control->end_added == 0) ||
@@ -5866,7 +5878,7 @@ get_more_data:
}
if ((uio->uio_resid == 0) ||
((in_eeor_mode) &&
- (copied_so_far >= (uint32_t) max(so->so_rcv.sb_lowat, 1)))) {
+ (copied_so_far >= (uint32_t)max(so->so_rcv.sb_lowat, 1)))) {
goto release;
}
/*
@@ -5952,8 +5964,10 @@ wait_some_more:
*/
SCTP_INP_READ_LOCK(inp);
if ((control->length > 0) && (control->data == NULL)) {
- /* big trouble.. we have the lock and its
- * corrupt? */
+ /*
+ * big trouble.. we have the lock and its
+ * corrupt?
+ */
#ifdef INVARIANTS
panic("Impossible data==NULL length !=0");
#endif
@@ -6084,13 +6098,13 @@ out:
if (stcb) {
sctp_misc_ints(SCTP_SORECV_DONE,
freed_so_far,
- (uint32_t) ((uio) ? (slen - uio->uio_resid) : slen),
+ (uint32_t)((uio) ? (slen - uio->uio_resid) : slen),
stcb->asoc.my_rwnd,
so->so_rcv.sb_cc);
} else {
sctp_misc_ints(SCTP_SORECV_DONE,
freed_so_far,
- (uint32_t) ((uio) ? (slen - uio->uio_resid) : slen),
+ (uint32_t)((uio) ? (slen - uio->uio_resid) : slen),
0,
so->so_rcv.sb_cc);
}
@@ -6668,8 +6682,10 @@ sctp_local_addr_count(struct sctp_tcb *stcb)
sin = &sctp_ifa->address.sin;
if (sin->sin_addr.s_addr == 0) {
- /* skip unspecified
- * addrs */
+ /*
+ * skip unspecified
+ * addrs
+ */
continue;
}
if (prison_check_ip4(stcb->sctp_ep->ip_inp.inp.inp_cred,
@@ -7099,7 +7115,7 @@ sctp_recv_icmp6_tunneled_packet(int cmd, struct sockaddr *sa, void *d, void *ctx
code = ICMP6_PARAMPROB_NEXTHEADER;
}
sctp6_notify(inp, stcb, net, type, code,
- (uint16_t) ntohl(ip6cp->ip6c_icmp6->icmp6_mtu));
+ (uint16_t)ntohl(ip6cp->ip6c_icmp6->icmp6_mtu));
} else {
if ((stcb == NULL) && (inp != NULL)) {
/* reduce inp's ref-count */