sctp: minor cleanups, no functional change intended
This commit is contained in:
parent
b4cb3fe0e3
commit
aab1d593b2
@ -2444,10 +2444,10 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
|
||||
if ((uint32_t)diff.tv_sec > UINT32_MAX / 1000000) {
|
||||
staleness = UINT32_MAX;
|
||||
} else {
|
||||
staleness = diff.tv_sec * 1000000;
|
||||
staleness = (uint32_t)diff.tv_sec * 1000000;
|
||||
}
|
||||
if (UINT32_MAX - staleness >= (uint32_t)diff.tv_usec) {
|
||||
staleness += diff.tv_usec;
|
||||
staleness += (uint32_t)diff.tv_usec;
|
||||
} else {
|
||||
staleness = UINT32_MAX;
|
||||
}
|
||||
|
@ -11328,7 +11328,7 @@ sctp_send_hb(struct sctp_tcb *stcb, struct sctp_nets *net, int so_locked)
|
||||
/* Fill out hb parameter */
|
||||
hb->heartbeat.hb_info.ph.param_type = htons(SCTP_HEARTBEAT_INFO);
|
||||
hb->heartbeat.hb_info.ph.param_length = htons(sizeof(struct sctp_heartbeat_info_param));
|
||||
hb->heartbeat.hb_info.time_value_1 = now.tv_sec;
|
||||
hb->heartbeat.hb_info.time_value_1 = (uint32_t)now.tv_sec;
|
||||
hb->heartbeat.hb_info.time_value_2 = now.tv_usec;
|
||||
/* Did our user request this one, put it in */
|
||||
hb->heartbeat.hb_info.addr_family = (uint8_t)net->ro._l_addr.sa.sa_family;
|
||||
@ -12847,7 +12847,7 @@ sctp_lower_sosend(struct socket *so,
|
||||
SCTP_TCB_UNLOCK(stcb);
|
||||
hold_tcblock = 0;
|
||||
} else {
|
||||
atomic_add_int(&stcb->asoc.sb_send_resv, sndlen);
|
||||
atomic_add_int(&stcb->asoc.sb_send_resv, (int)sndlen);
|
||||
}
|
||||
local_soresv = sndlen;
|
||||
if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
|
||||
@ -13684,7 +13684,7 @@ sctp_lower_sosend(struct socket *so,
|
||||
out_unlocked:
|
||||
|
||||
if (local_soresv && stcb) {
|
||||
atomic_subtract_int(&stcb->asoc.sb_send_resv, sndlen);
|
||||
atomic_subtract_int(&stcb->asoc.sb_send_resv, (int)sndlen);
|
||||
}
|
||||
if (create_lock_applied) {
|
||||
SCTP_ASOC_CREATE_UNLOCK(inp);
|
||||
|
@ -2576,7 +2576,7 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id)
|
||||
|
||||
/* Setup the initial secret */
|
||||
(void)SCTP_GETTIME_TIMEVAL(&time);
|
||||
m->time_of_secret_change = time.tv_sec;
|
||||
m->time_of_secret_change = (unsigned int)time.tv_sec;
|
||||
|
||||
for (i = 0; i < SCTP_NUMBER_OF_SECRETS; i++) {
|
||||
m->secret_key[0][i] = sctp_select_initial_TSN(m);
|
||||
|
@ -542,8 +542,8 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
|
||||
min_wait.tv_sec = min_wait.tv_usec = 0;
|
||||
}
|
||||
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) {
|
||||
sctp_log_fr(cur_rto, 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);
|
||||
sctp_log_fr(cur_rto, (uint32_t)now.tv_sec, now.tv_usec, SCTP_FR_T3_MARK_TIME);
|
||||
sctp_log_fr(0, (uint32_t)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
|
||||
@ -590,7 +590,7 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
|
||||
/* validate its been outstanding long enough */
|
||||
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) {
|
||||
sctp_log_fr(chk->rec.data.tsn,
|
||||
chk->sent_rcv_time.tv_sec,
|
||||
(uint32_t)chk->sent_rcv_time.tv_sec,
|
||||
chk->sent_rcv_time.tv_usec,
|
||||
SCTP_FR_T3_MARK_TIME);
|
||||
}
|
||||
@ -602,7 +602,7 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
|
||||
*/
|
||||
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) {
|
||||
sctp_log_fr(0,
|
||||
chk->sent_rcv_time.tv_sec,
|
||||
(uint32_t)chk->sent_rcv_time.tv_sec,
|
||||
chk->sent_rcv_time.tv_usec,
|
||||
SCTP_FR_T3_STOPPED);
|
||||
}
|
||||
@ -853,11 +853,11 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp,
|
||||
if (net != stcb->asoc.primary_destination) {
|
||||
/* send a immediate HB if our RTO is stale */
|
||||
struct timeval now;
|
||||
unsigned int ms_goneby;
|
||||
uint32_t ms_goneby;
|
||||
|
||||
(void)SCTP_GETTIME_TIMEVAL(&now);
|
||||
if (net->last_sent_time.tv_sec) {
|
||||
ms_goneby = (now.tv_sec - net->last_sent_time.tv_sec) * 1000;
|
||||
ms_goneby = (uint32_t)(now.tv_sec - net->last_sent_time.tv_sec) * 1000;
|
||||
} else {
|
||||
ms_goneby = 0;
|
||||
}
|
||||
|
@ -2738,7 +2738,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
|
||||
sasoc->sasoc_asocmaxrxt = inp->sctp_ep.max_send_times;
|
||||
sasoc->sasoc_number_peer_destinations = 0;
|
||||
sasoc->sasoc_peer_rwnd = 0;
|
||||
sasoc->sasoc_local_rwnd = sbspace(&inp->sctp_socket->so_rcv);
|
||||
sasoc->sasoc_local_rwnd = (uint32_t)sbspace(&inp->sctp_socket->so_rcv);
|
||||
SCTP_INP_RUNLOCK(inp);
|
||||
} else {
|
||||
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
|
||||
@ -2839,7 +2839,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
|
||||
{
|
||||
struct sctp_hmacalgo *shmac;
|
||||
sctp_hmaclist_t *hmaclist;
|
||||
uint32_t size;
|
||||
size_t size;
|
||||
int i;
|
||||
|
||||
SCTP_CHECK_AND_CAST(shmac, optval, struct sctp_hmacalgo, *optsize);
|
||||
@ -2855,7 +2855,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
|
||||
/* is there room for all of the hmac ids? */
|
||||
size = sizeof(*shmac) + (hmaclist->num_algo *
|
||||
sizeof(shmac->shmac_idents[0]));
|
||||
if ((size_t)(*optsize) < size) {
|
||||
if (*optsize < size) {
|
||||
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
|
||||
error = EINVAL;
|
||||
SCTP_INP_RUNLOCK(inp);
|
||||
|
@ -1936,7 +1936,7 @@ sctp_timeout_handler(void *t)
|
||||
type, inp, stcb, net));
|
||||
SCTP_STAT_INCR(sctps_timosecret);
|
||||
(void)SCTP_GETTIME_TIMEVAL(&tv);
|
||||
inp->sctp_ep.time_of_secret_change = tv.tv_sec;
|
||||
inp->sctp_ep.time_of_secret_change = (unsigned int)tv.tv_sec;
|
||||
inp->sctp_ep.last_secret_number =
|
||||
inp->sctp_ep.current_secret_number;
|
||||
inp->sctp_ep.current_secret_number++;
|
||||
@ -6081,7 +6081,7 @@ sctp_sorecvmsg(struct socket *so,
|
||||
copied_so_far += cp_len;
|
||||
freed_so_far += (uint32_t)cp_len;
|
||||
freed_so_far += MSIZE;
|
||||
atomic_subtract_int(&control->length, cp_len);
|
||||
atomic_subtract_int(&control->length, (int)cp_len);
|
||||
control->data = sctp_m_free(m);
|
||||
m = control->data;
|
||||
/*
|
||||
@ -6123,10 +6123,10 @@ sctp_sorecvmsg(struct socket *so,
|
||||
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SB_LOGGING_ENABLE) {
|
||||
sctp_sblog(&so->so_rcv, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBFREE, (int)cp_len);
|
||||
}
|
||||
atomic_subtract_int(&so->so_rcv.sb_cc, cp_len);
|
||||
atomic_subtract_int(&so->so_rcv.sb_cc, (int)cp_len);
|
||||
if ((control->do_not_ref_stcb == 0) &&
|
||||
stcb) {
|
||||
atomic_subtract_int(&stcb->asoc.sb_cc, cp_len);
|
||||
atomic_subtract_int(&stcb->asoc.sb_cc, (int)cp_len);
|
||||
}
|
||||
copied_so_far += cp_len;
|
||||
freed_so_far += (uint32_t)cp_len;
|
||||
@ -6135,7 +6135,7 @@ sctp_sorecvmsg(struct socket *so,
|
||||
sctp_sblog(&so->so_rcv, control->do_not_ref_stcb ? NULL : stcb,
|
||||
SCTP_LOG_SBRESULT, 0);
|
||||
}
|
||||
atomic_subtract_int(&control->length, cp_len);
|
||||
atomic_subtract_int(&control->length, (int)cp_len);
|
||||
} else {
|
||||
copied_so_far += cp_len;
|
||||
}
|
||||
@ -6233,9 +6233,9 @@ sctp_sorecvmsg(struct socket *so,
|
||||
}
|
||||
/*
|
||||
* We need to wait for more data a few things: - We don't
|
||||
* release the I/O lock so we don't get someone else reading.
|
||||
* - We must be sure to account for the case where what is added
|
||||
* is NOT to our control when we wakeup.
|
||||
* release the I/O lock so we don't get someone else
|
||||
* reading. - We must be sure to account for the case where
|
||||
* what is added is NOT to our control when we wakeup.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user