aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/netinet/sctp.h2
-rw-r--r--sys/netinet/sctp_asconf.c92
-rw-r--r--sys/netinet/sctp_asconf.h4
-rw-r--r--sys/netinet/sctp_auth.c121
-rw-r--r--sys/netinet/sctp_auth.h143
-rw-r--r--sys/netinet/sctp_bsd_addr.c9
-rw-r--r--sys/netinet/sctp_bsd_addr.h2
-rw-r--r--sys/netinet/sctp_cc_functions.c153
-rw-r--r--sys/netinet/sctp_crc32.c12
-rw-r--r--sys/netinet/sctp_header.h26
-rw-r--r--sys/netinet/sctp_indata.c112
-rw-r--r--sys/netinet/sctp_indata.h5
-rw-r--r--sys/netinet/sctp_input.c79
-rw-r--r--sys/netinet/sctp_input.h4
-rw-r--r--sys/netinet/sctp_output.c167
-rw-r--r--sys/netinet/sctp_output.h18
-rw-r--r--sys/netinet/sctp_pcb.c57
-rw-r--r--sys/netinet/sctp_pcb.h14
-rw-r--r--sys/netinet/sctp_peeloff.c2
-rw-r--r--sys/netinet/sctp_ss_functions.c4
-rw-r--r--sys/netinet/sctp_structs.h57
-rw-r--r--sys/netinet/sctp_sysctl.c24
-rw-r--r--sys/netinet/sctp_timer.c20
-rw-r--r--sys/netinet/sctp_uio.h68
-rw-r--r--sys/netinet/sctp_usrreq.c67
-rw-r--r--sys/netinet/sctp_var.h4
-rw-r--r--sys/netinet/sctputil.c223
-rw-r--r--sys/netinet/sctputil.h33
-rw-r--r--sys/netinet6/sctp6_usrreq.c11
-rw-r--r--sys/netinet6/sctp6_var.h4
30 files changed, 717 insertions, 820 deletions
diff --git a/sys/netinet/sctp.h b/sys/netinet/sctp.h
index 64fd54426382..5a86f108d0ca 100644
--- a/sys/netinet/sctp.h
+++ b/sys/netinet/sctp.h
@@ -419,7 +419,7 @@ struct sctp_error_unresolv_addr {
struct sctp_error_unrecognized_chunk {
struct sctp_error_cause cause; /* code=SCTP_CAUSE_UNRECOG_CHUNK */
- struct sctp_chunkhdr ch; /* header from chunk in error */
+ struct sctp_chunkhdr ch;/* header from chunk in error */
} SCTP_PACKED;
struct sctp_error_no_user_data {
diff --git a/sys/netinet/sctp_asconf.c b/sys/netinet/sctp_asconf.c
index 6a6a58533d4f..9c02ab0bee5b 100644
--- a/sys/netinet/sctp_asconf.c
+++ b/sys/netinet/sctp_asconf.c
@@ -99,7 +99,7 @@ sctp_asconf_success_response(uint32_t id)
}
static struct mbuf *
-sctp_asconf_error_response(uint32_t id, uint16_t cause, uint8_t * error_tlv,
+sctp_asconf_error_response(uint32_t id, uint16_t cause, uint8_t *error_tlv,
uint16_t tlv_length)
{
struct mbuf *m_reply = NULL;
@@ -134,7 +134,7 @@ sctp_asconf_error_response(uint32_t id, uint16_t cause, uint8_t * error_tlv,
return (NULL);
}
if (error_tlv != NULL) {
- tlv = (uint8_t *) (error + 1);
+ tlv = (uint8_t *)(error + 1);
memcpy(tlv, error_tlv, tlv_length);
}
SCTP_BUF_LEN(m_reply) = aph->ph.param_length;
@@ -224,7 +224,7 @@ sctp_process_asconf_add_ip(struct sockaddr *src, struct sctp_asconf_paramhdr *ap
#endif
default:
m_reply = sctp_asconf_error_response(aph->correlation_id,
- SCTP_CAUSE_INVALID_PARAM, (uint8_t *) aph,
+ SCTP_CAUSE_INVALID_PARAM, (uint8_t *)aph,
aparam_length);
return (m_reply);
} /* end switch */
@@ -239,7 +239,7 @@ sctp_process_asconf_add_ip(struct sockaddr *src, struct sctp_asconf_paramhdr *ap
/* add the address */
if (bad_address) {
m_reply = sctp_asconf_error_response(aph->correlation_id,
- SCTP_CAUSE_INVALID_PARAM, (uint8_t *) aph,
+ SCTP_CAUSE_INVALID_PARAM, (uint8_t *)aph,
aparam_length);
} else if (sctp_add_remote_addr(stcb, sa, &net, stcb->asoc.port,
SCTP_DONOT_SETSCOPE,
@@ -247,7 +247,7 @@ sctp_process_asconf_add_ip(struct sockaddr *src, struct sctp_asconf_paramhdr *ap
SCTPDBG(SCTP_DEBUG_ASCONF1,
"process_asconf_add_ip: error adding address\n");
m_reply = sctp_asconf_error_response(aph->correlation_id,
- SCTP_CAUSE_RESOURCE_SHORTAGE, (uint8_t *) aph,
+ SCTP_CAUSE_RESOURCE_SHORTAGE, (uint8_t *)aph,
aparam_length);
} else {
/* notify upper layer */
@@ -277,7 +277,6 @@ sctp_asconf_del_remote_addrs_except(struct sctp_tcb *stcb, struct sockaddr *src)
/* not found */
return (-1);
}
-
/* delete all destination addresses except the source */
TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
if (net != src_net) {
@@ -370,7 +369,7 @@ sctp_process_asconf_delete_ip(struct sockaddr *src,
#endif
default:
m_reply = sctp_asconf_error_response(aph->correlation_id,
- SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *) aph,
+ SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *)aph,
aparam_length);
return (m_reply);
}
@@ -380,11 +379,10 @@ sctp_process_asconf_delete_ip(struct sockaddr *src,
/* trying to delete the source address! */
SCTPDBG(SCTP_DEBUG_ASCONF1, "process_asconf_delete_ip: tried to delete source addr\n");
m_reply = sctp_asconf_error_response(aph->correlation_id,
- SCTP_CAUSE_DELETING_SRC_ADDR, (uint8_t *) aph,
+ SCTP_CAUSE_DELETING_SRC_ADDR, (uint8_t *)aph,
aparam_length);
return (m_reply);
}
-
/* if deleting 0.0.0.0/::0, delete all addresses except src addr */
if (zero_address && SCTP_BASE_SYSCTL(sctp_nat_friendly)) {
result = sctp_asconf_del_remote_addrs_except(stcb, src);
@@ -395,7 +393,7 @@ sctp_process_asconf_delete_ip(struct sockaddr *src,
/* what error to reply with?? */
m_reply =
sctp_asconf_error_response(aph->correlation_id,
- SCTP_CAUSE_REQUEST_REFUSED, (uint8_t *) aph,
+ SCTP_CAUSE_REQUEST_REFUSED, (uint8_t *)aph,
aparam_length);
} else if (response_required) {
m_reply =
@@ -403,7 +401,6 @@ sctp_process_asconf_delete_ip(struct sockaddr *src,
}
return (m_reply);
}
-
/* delete the address */
result = sctp_del_remote_addr(stcb, sa);
/*
@@ -415,7 +412,7 @@ sctp_process_asconf_delete_ip(struct sockaddr *src,
/* only one address in the asoc */
SCTPDBG(SCTP_DEBUG_ASCONF1, "process_asconf_delete_ip: tried to delete last IP addr!\n");
m_reply = sctp_asconf_error_response(aph->correlation_id,
- SCTP_CAUSE_DELETING_LAST_ADDR, (uint8_t *) aph,
+ SCTP_CAUSE_DELETING_LAST_ADDR, (uint8_t *)aph,
aparam_length);
} else {
if (response_required) {
@@ -497,7 +494,7 @@ sctp_process_asconf_set_primary(struct sockaddr *src,
#endif
default:
m_reply = sctp_asconf_error_response(aph->correlation_id,
- SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *) aph,
+ SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *)aph,
aparam_length);
return (m_reply);
}
@@ -568,7 +565,7 @@ sctp_process_asconf_set_primary(struct sockaddr *src,
"process_asconf_set_primary: set primary failed!\n");
/* must have been an invalid address, so report */
m_reply = sctp_asconf_error_response(aph->correlation_id,
- SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *) aph,
+ SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *)aph,
aparam_length);
}
@@ -619,7 +616,6 @@ sctp_handle_asconf(struct mbuf *m, unsigned int offset,
serial_num, asoc->asconf_seq_in + 1);
return;
}
-
/* it's the expected "next" sequence number, so process it */
asoc->asconf_seq_in = serial_num; /* update sequence */
/* get length of all the param's in the ASCONF */
@@ -644,7 +640,6 @@ sctp_handle_asconf(struct mbuf *m, unsigned int offset,
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_asconf_ack), ack);
}
}
-
m_ack = sctp_get_mbuf_for_msg(sizeof(struct sctp_asconf_ack_chunk), 0,
M_NOWAIT, 1, MT_DATA);
if (m_ack == NULL) {
@@ -665,7 +660,7 @@ sctp_handle_asconf(struct mbuf *m, unsigned int offset,
/* skip the lookup address parameter */
offset += sizeof(struct sctp_asconf_chunk);
- p_addr = (struct sctp_ipv6addr_param *)sctp_m_getptr(m, offset, sizeof(struct sctp_paramhdr), (uint8_t *) & aparam_buf);
+ p_addr = (struct sctp_ipv6addr_param *)sctp_m_getptr(m, offset, sizeof(struct sctp_paramhdr), (uint8_t *)&aparam_buf);
if (p_addr == NULL) {
SCTPDBG(SCTP_DEBUG_ASCONF1,
"handle_asconf: couldn't get lookup addr!\n");
@@ -675,7 +670,7 @@ sctp_handle_asconf(struct mbuf *m, unsigned int offset,
/* param_length is already validated in process_control... */
offset += ntohs(p_addr->ph.param_length); /* skip lookup addr */
/* get pointer to first asconf param in ASCONF */
- aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset, sizeof(struct sctp_asconf_paramhdr), (uint8_t *) & aparam_buf);
+ aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset, sizeof(struct sctp_asconf_paramhdr), (uint8_t *)&aparam_buf);
if (aph == NULL) {
SCTPDBG(SCTP_DEBUG_ASCONF1, "Empty ASCONF received?\n");
goto send_reply;
@@ -772,7 +767,7 @@ sctp_handle_asconf(struct mbuf *m, unsigned int offset,
/* get pointer to next asconf param */
aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset,
sizeof(struct sctp_asconf_paramhdr),
- (uint8_t *) & aparam_buf);
+ (uint8_t *)&aparam_buf);
if (aph == NULL) {
/* can't get an asconf paramhdr */
SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf: can't get asconf param hdr!\n");
@@ -821,7 +816,8 @@ send_reply:
* does the address match? returns 0 if not, 1 if so
*/
static uint32_t
-sctp_asconf_addr_match(struct sctp_asconf_addr *aa, struct sockaddr *sa){
+sctp_asconf_addr_match(struct sctp_asconf_addr *aa, struct sockaddr *sa)
+{
switch (sa->sa_family) {
#ifdef INET6
case AF_INET6:
@@ -860,7 +856,8 @@ sctp_asconf_addr_match(struct sctp_asconf_addr *aa, struct sockaddr *sa){
* does the address match? returns 0 if not, 1 if so
*/
static uint32_t
-sctp_addr_match(struct sctp_paramhdr *ph, struct sockaddr *sa){
+sctp_addr_match(struct sctp_paramhdr *ph, struct sockaddr *sa)
+{
#if defined(INET) || defined(INET6)
uint16_t param_type, param_length;
@@ -977,7 +974,6 @@ sctp_assoc_immediate_retrans(struct sctp_tcb *stcb, struct sctp_nets *dstnet)
if (stcb->asoc.deleted_primary == NULL) {
return;
}
-
if (!TAILQ_EMPTY(&stcb->asoc.sent_queue)) {
SCTPDBG(SCTP_DEBUG_ASCONF1, "assoc_immediate_retrans: Deleted primary is ");
SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, &stcb->asoc.deleted_primary->ro._l_addr.sa);
@@ -1081,7 +1077,6 @@ sctp_path_check_and_react(struct sctp_tcb *stcb, struct sctp_ifa *newifa)
}
return;
}
-
/* Multiple local addresses exsist in the association. */
TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
/* clear any cached route and source address */
@@ -1101,7 +1096,7 @@ sctp_path_check_and_react(struct sctp_tcb *stcb, struct sctp_ifa *newifa)
* NOT corresponding to the current nexthop, the path will
* not be changed.
*/
- SCTP_RTALLOC((sctp_route_t *) & net->ro,
+ SCTP_RTALLOC((sctp_route_t *)&net->ro,
stcb->sctp_ep->def_vrf_id,
stcb->sctp_ep->fibnum);
if (net->ro.ro_rt == NULL)
@@ -1111,7 +1106,7 @@ sctp_path_check_and_react(struct sctp_tcb *stcb, struct sctp_ifa *newifa)
switch (net->ro._l_addr.sa.sa_family) {
#ifdef INET
case AF_INET:
- if (sctp_v4src_match_nexthop(newifa, (sctp_route_t *) & net->ro)) {
+ if (sctp_v4src_match_nexthop(newifa, (sctp_route_t *)&net->ro)) {
changed = 1;
}
break;
@@ -1119,7 +1114,7 @@ sctp_path_check_and_react(struct sctp_tcb *stcb, struct sctp_ifa *newifa)
#ifdef INET6
case AF_INET6:
if (sctp_v6src_match_nexthop(
- &newifa->address.sin6, (sctp_route_t *) & net->ro)) {
+ &newifa->address.sin6, (sctp_route_t *)&net->ro)) {
changed = 1;
}
break;
@@ -1328,7 +1323,6 @@ sctp_asconf_queue_add(struct sctp_tcb *stcb, struct sctp_ifa *ifa,
if (stcb->asoc.asconf_supported == 0) {
return (-1);
}
-
/*
* if this is deleting the last address from the assoc, mark it as
* pending.
@@ -1349,7 +1343,6 @@ sctp_asconf_queue_add(struct sctp_tcb *stcb, struct sctp_ifa *ifa,
return (-1);
}
}
-
/* queue an asconf parameter */
status = sctp_asconf_queue_mgmt(stcb, ifa, type);
@@ -1371,7 +1364,6 @@ sctp_asconf_queue_add(struct sctp_tcb *stcb, struct sctp_ifa *ifa,
stcb->asoc.asconf_addr_del_pending = NULL;
}
}
-
if (pending_delete_queued) {
struct sctp_nets *net;
@@ -1396,7 +1388,6 @@ sctp_asconf_queue_add(struct sctp_tcb *stcb, struct sctp_ifa *ifa,
SCTP_FROM_SCTP_ASCONF,
__LINE__);
}
-
/* queue in an advisory set primary too */
(void)sctp_asconf_queue_mgmt(stcb, ifa, SCTP_SET_PRIM_ADDR);
/* let caller know we should send this out immediately */
@@ -1694,13 +1685,11 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset,
serial_num, asoc->asconf_seq_out_acked + 1);
return;
}
-
if (serial_num == asoc->asconf_seq_out - 1) {
/* stop our timer */
sctp_timer_stop(SCTP_TIMER_TYPE_ASCONF, stcb->sctp_ep, stcb, net,
SCTP_FROM_SCTP_ASCONF + SCTP_LOC_5);
}
-
/* process the ASCONF-ACK contents */
ack_length = ntohs(cp->ch.chunk_length) -
sizeof(struct sctp_asconf_ack_chunk);
@@ -1789,7 +1778,7 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset,
* at any given time
*/
if (last_error_id == 0)
- last_error_id--; /* set to "max" value */
+ last_error_id--;/* set to "max" value */
TAILQ_FOREACH_SAFE(aa, &stcb->asoc.asconf_queue, next, aa_next) {
if (aa->sent == 1) {
/*
@@ -1829,7 +1818,8 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset,
#ifdef INET6
static uint32_t
-sctp_is_scopeid_in_nets(struct sctp_tcb *stcb, struct sockaddr *sa){
+sctp_is_scopeid_in_nets(struct sctp_tcb *stcb, struct sockaddr *sa)
+{
struct sockaddr_in6 *sin6, *net6;
struct sctp_nets *net;
@@ -2068,7 +2058,6 @@ sctp_asconf_iterator_ep_end(struct sctp_inpcb *inp, void *ptr, uint32_t val SCTP
laddr->action = 0;
break;
}
-
}
} else if (l->action == SCTP_DEL_IP_ADDRESS) {
LIST_FOREACH_SAFE(laddr, &inp->sctp_addr_list, sctp_nxt_addr, nladdr) {
@@ -2102,7 +2091,6 @@ sctp_asconf_iterator_stcb(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
if (ifa->vrf_id != stcb->asoc.vrf_id) {
continue;
}
-
/* Same checks again for assoc */
switch (ifa->address.sa.sa_family) {
#ifdef INET6
@@ -2281,7 +2269,8 @@ sctp_asconf_iterator_end(void *ptr, uint32_t val SCTP_UNUSED)
* returns: 0 = completed, -1 = error
*/
int32_t
-sctp_set_primary_ip_address_sa(struct sctp_tcb *stcb, struct sockaddr *sa){
+sctp_set_primary_ip_address_sa(struct sctp_tcb *stcb, struct sockaddr *sa)
+{
uint32_t vrf_id;
struct sctp_ifa *ifa;
@@ -2292,7 +2281,6 @@ sctp_set_primary_ip_address_sa(struct sctp_tcb *stcb, struct sockaddr *sa){
/* Invalid address */
return (-1);
}
-
/* queue an ASCONF:SET_PRIM_ADDR to be sent */
if (!sctp_asconf_queue_add(stcb, ifa, SCTP_SET_PRIM_ADDR)) {
/* set primary queuing succeeded */
@@ -2371,13 +2359,11 @@ sctp_is_addr_pending(struct sctp_tcb *stcb, struct sctp_ifa *sctp_ifa)
SCTPDBG(SCTP_DEBUG_ASCONF1, "is_addr_pending: param length(%u) too short\n", param_length);
break;
}
-
aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(chk->data, offset, param_length, aparam_buf);
if (aph == NULL) {
SCTPDBG(SCTP_DEBUG_ASCONF1, "is_addr_pending: couldn't get entire param\n");
break;
}
-
ph = (struct sctp_paramhdr *)(aph + 1);
if (sctp_addr_match(ph, &sctp_ifa->address.sa) != 0) {
switch (param_type) {
@@ -2392,7 +2378,6 @@ sctp_is_addr_pending(struct sctp_tcb *stcb, struct sctp_ifa *sctp_ifa)
}
last_param_type = param_type;
}
-
offset += SCTP_SIZE32(param_length);
if (offset >= asconf_limit) {
/* no more data in the mbuf chain */
@@ -2476,7 +2461,6 @@ sctp_find_valid_localaddr(struct sctp_tcb *stcb, int addr_locked)
if (sctp_ifa->localifa_flags & SCTP_ADDR_IFA_UNUSEABLE) {
continue;
}
-
sin6 = &sctp_ifa->address.sin6;
if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
/*
@@ -2770,7 +2754,7 @@ sctp_process_initack_addresses(struct sctp_tcb *stcb, struct mbuf *m,
/* go through the addresses in the init-ack */
ph = (struct sctp_paramhdr *)
sctp_m_getptr(m, offset, sizeof(struct sctp_paramhdr),
- (uint8_t *) & tmp_param);
+ (uint8_t *)&tmp_param);
while (ph != NULL) {
ptype = ntohs(ph->param_type);
plen = ntohs(ph->param_length);
@@ -2784,7 +2768,7 @@ sctp_process_initack_addresses(struct sctp_tcb *stcb, struct mbuf *m,
a6p = (struct sctp_ipv6addr_param *)
sctp_m_getptr(m, offset,
sizeof(struct sctp_ipv6addr_param),
- (uint8_t *) & addr6_store);
+ (uint8_t *)&addr6_store);
if (plen != sizeof(struct sctp_ipv6addr_param) ||
a6p == NULL) {
return;
@@ -2805,7 +2789,7 @@ sctp_process_initack_addresses(struct sctp_tcb *stcb, struct mbuf *m,
/* get the entire IPv4 address param */
a4p = (struct sctp_ipv4addr_param *)sctp_m_getptr(m, offset,
sizeof(struct sctp_ipv4addr_param),
- (uint8_t *) & addr4_store);
+ (uint8_t *)&addr4_store);
if (plen != sizeof(struct sctp_ipv4addr_param) ||
a4p == NULL) {
return;
@@ -2852,7 +2836,6 @@ sctp_process_initack_addresses(struct sctp_tcb *stcb, struct mbuf *m,
}
}
}
-
next_addr:
/*
* Sanity check: Make sure the length isn't 0, otherwise
@@ -2868,7 +2851,7 @@ next_addr:
if ((offset + sizeof(struct sctp_paramhdr)) > length)
return;
ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset,
- sizeof(struct sctp_paramhdr), (uint8_t *) & tmp_param);
+ sizeof(struct sctp_paramhdr), (uint8_t *)&tmp_param);
} /* while */
}
@@ -2878,7 +2861,8 @@ next_addr:
* 1 if found, 0 if not
*/
static uint32_t
-sctp_addr_in_initack(struct mbuf *m, uint32_t offset, uint32_t length, struct sockaddr *sa){
+sctp_addr_in_initack(struct mbuf *m, uint32_t offset, uint32_t length, struct sockaddr *sa)
+{
struct sctp_paramhdr tmp_param, *ph;
uint16_t plen, ptype;
#ifdef INET
@@ -2918,7 +2902,7 @@ sctp_addr_in_initack(struct mbuf *m, uint32_t offset, uint32_t length, struct so
}
/* go through the addresses in the init-ack */
ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset,
- sizeof(struct sctp_paramhdr), (uint8_t *) & tmp_param);
+ sizeof(struct sctp_paramhdr), (uint8_t *)&tmp_param);
while (ph != NULL) {
ptype = ntohs(ph->param_type);
plen = ntohs(ph->param_length);
@@ -2934,7 +2918,7 @@ sctp_addr_in_initack(struct mbuf *m, uint32_t offset, uint32_t length, struct so
a6p = (struct sctp_ipv6addr_param *)
sctp_m_getptr(m, offset,
sizeof(struct sctp_ipv6addr_param),
- (uint8_t *) & addr6_store);
+ (uint8_t *)&addr6_store);
if (a6p == NULL) {
return (0);
}
@@ -2964,7 +2948,7 @@ sctp_addr_in_initack(struct mbuf *m, uint32_t offset, uint32_t length, struct so
a4p = (struct sctp_ipv4addr_param *)
sctp_m_getptr(m, offset,
sizeof(struct sctp_ipv4addr_param),
- (uint8_t *) & addr4_store);
+ (uint8_t *)&addr4_store);
if (a4p == NULL) {
return (0);
}
@@ -2986,7 +2970,7 @@ sctp_addr_in_initack(struct mbuf *m, uint32_t offset, uint32_t length, struct so
}
ph = (struct sctp_paramhdr *)
sctp_m_getptr(m, offset, sizeof(struct sctp_paramhdr),
- (uint8_t *) & tmp_param);
+ (uint8_t *)&tmp_param);
} /* while */
/* not found! */
return (0);
@@ -3157,7 +3141,8 @@ 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, struct sctp_ifa *sctp_ifap){
+ uint32_t type, uint32_t vrf_id, struct sctp_ifa *sctp_ifap)
+{
struct sctp_ifa *ifa;
struct sctp_laddr *laddr, *nladdr;
@@ -3385,7 +3370,6 @@ sctp_asconf_send_nat_state_update(struct sctp_tcb *stcb,
if (vrf == NULL) {
goto skip_rest;
}
-
SCTP_IPI_ADDR_RLOCK();
LIST_FOREACH(sctp_ifnp, &vrf->ifnlist, next_ifn) {
LIST_FOREACH(sctp_ifap, &sctp_ifnp->ifalist, next_ifa) {
diff --git a/sys/netinet/sctp_asconf.h b/sys/netinet/sctp_asconf.h
index 581d504cbbb3..2a3722053b8d 100644
--- a/sys/netinet/sctp_asconf.h
+++ b/sys/netinet/sctp_asconf.h
@@ -60,10 +60,10 @@ sctp_addr_mgmt_ep_sa(struct sctp_inpcb *, struct sockaddr *,
uint32_t, uint32_t, struct sctp_ifa *);
-extern int
+extern int
sctp_asconf_iterator_ep(struct sctp_inpcb *inp, void *ptr,
uint32_t val);
-extern void
+extern void
sctp_asconf_iterator_stcb(struct sctp_inpcb *inp,
struct sctp_tcb *stcb,
void *ptr, uint32_t type);
diff --git a/sys/netinet/sctp_auth.c b/sys/netinet/sctp_auth.c
index 4a329abae106..c562bb7e17b6 100644
--- a/sys/netinet/sctp_auth.c
+++ b/sys/netinet/sctp_auth.c
@@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
void
-sctp_clear_chunklist(sctp_auth_chklist_t * chklist)
+sctp_clear_chunklist(sctp_auth_chklist_t *chklist)
{
memset(chklist, 0, sizeof(*chklist));
/* chklist->num_chunks = 0; */
@@ -75,14 +75,14 @@ sctp_alloc_chunklist(void)
}
void
-sctp_free_chunklist(sctp_auth_chklist_t * list)
+sctp_free_chunklist(sctp_auth_chklist_t *list)
{
if (list != NULL)
SCTP_FREE(list, SCTP_M_AUTH_CL);
}
sctp_auth_chklist_t *
-sctp_copy_chunklist(sctp_auth_chklist_t * list)
+sctp_copy_chunklist(sctp_auth_chklist_t *list)
{
sctp_auth_chklist_t *new_list;
@@ -104,7 +104,7 @@ sctp_copy_chunklist(sctp_auth_chklist_t * list)
* add a chunk to the required chunks list
*/
int
-sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t * list)
+sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t *list)
{
if (list == NULL)
return (-1);
@@ -130,7 +130,7 @@ sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t * list)
* delete a chunk from the required chunks list
*/
int
-sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklist_t * list)
+sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklist_t *list)
{
if (list == NULL)
return (-1);
@@ -146,7 +146,7 @@ sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklist_t * list)
}
size_t
-sctp_auth_get_chklist_size(const sctp_auth_chklist_t * list)
+sctp_auth_get_chklist_size(const sctp_auth_chklist_t *list)
{
if (list == NULL)
return (0);
@@ -159,7 +159,7 @@ sctp_auth_get_chklist_size(const sctp_auth_chklist_t * list)
* guarantee ptr has space for up to 256 bytes
*/
int
-sctp_serialize_auth_chunks(const sctp_auth_chklist_t * list, uint8_t * ptr)
+sctp_serialize_auth_chunks(const sctp_auth_chklist_t *list, uint8_t *ptr)
{
int i, count = 0;
@@ -176,7 +176,7 @@ sctp_serialize_auth_chunks(const sctp_auth_chklist_t * list, uint8_t * ptr)
}
int
-sctp_pack_auth_chunks(const sctp_auth_chklist_t * list, uint8_t * ptr)
+sctp_pack_auth_chunks(const sctp_auth_chklist_t *list, uint8_t *ptr)
{
int i, size = 0;
@@ -208,8 +208,8 @@ sctp_pack_auth_chunks(const sctp_auth_chklist_t * list, uint8_t * ptr)
}
int
-sctp_unpack_auth_chunks(const uint8_t * ptr, uint8_t num_chunks,
- sctp_auth_chklist_t * list)
+sctp_unpack_auth_chunks(const uint8_t *ptr, uint8_t num_chunks,
+ sctp_auth_chklist_t *list)
{
int i;
int size;
@@ -259,14 +259,14 @@ sctp_alloc_key(uint32_t keylen)
}
void
-sctp_free_key(sctp_key_t * key)
+sctp_free_key(sctp_key_t *key)
{
if (key != NULL)
SCTP_FREE(key, SCTP_M_AUTH_KY);
}
void
-sctp_print_key(sctp_key_t * key, const char *str)
+sctp_print_key(sctp_key_t *key, const char *str)
{
uint32_t i;
@@ -285,7 +285,7 @@ sctp_print_key(sctp_key_t * key, const char *str)
}
void
-sctp_show_key(sctp_key_t * key, const char *str)
+sctp_show_key(sctp_key_t *key, const char *str)
{
uint32_t i;
@@ -304,7 +304,8 @@ sctp_show_key(sctp_key_t * key, const char *str)
}
static uint32_t
-sctp_get_keylen(sctp_key_t * key) {
+sctp_get_keylen(sctp_key_t *key)
+{
if (key != NULL)
return (key->keylen);
else
@@ -330,7 +331,7 @@ sctp_generate_random_key(uint32_t keylen)
}
sctp_key_t *
-sctp_set_key(uint8_t * key, uint32_t keylen)
+sctp_set_key(uint8_t *key, uint32_t keylen)
{
sctp_key_t *new_key;
@@ -350,7 +351,7 @@ sctp_set_key(uint8_t * key, uint32_t keylen)
* 0 if key1 = key2
*/
static int
-sctp_compare_key(sctp_key_t * key1, sctp_key_t * key2)
+sctp_compare_key(sctp_key_t *key1, sctp_key_t *key2)
{
uint32_t maxlen;
uint32_t i;
@@ -401,7 +402,7 @@ sctp_compare_key(sctp_key_t * key1, sctp_key_t * key2)
* order for concatenation
*/
sctp_key_t *
-sctp_compute_hashkey(sctp_key_t * key1, sctp_key_t * key2, sctp_key_t * shared)
+sctp_compute_hashkey(sctp_key_t *key1, sctp_key_t *key2, sctp_key_t *shared)
{
uint32_t keylen;
sctp_key_t *new_key;
@@ -475,7 +476,7 @@ sctp_alloc_sharedkey(void)
}
void
-sctp_free_sharedkey(sctp_sharedkey_t * skey)
+sctp_free_sharedkey(sctp_sharedkey_t *skey)
{
if (skey == NULL)
return;
@@ -501,7 +502,7 @@ sctp_find_sharedkey(struct sctp_keyhead *shared_keys, uint16_t key_id)
int
sctp_insert_sharedkey(struct sctp_keyhead *shared_keys,
- sctp_sharedkey_t * new_skey)
+ sctp_sharedkey_t *new_skey)
{
sctp_sharedkey_t *skey;
@@ -595,7 +596,8 @@ sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id, int so_locked
}
static sctp_sharedkey_t *
-sctp_copy_sharedkey(const sctp_sharedkey_t * skey){
+sctp_copy_sharedkey(const sctp_sharedkey_t *skey)
+{
sctp_sharedkey_t *new_skey;
if (skey == NULL)
@@ -652,7 +654,7 @@ sctp_alloc_hmaclist(uint16_t num_hmacs)
}
void
-sctp_free_hmaclist(sctp_hmaclist_t * list)
+sctp_free_hmaclist(sctp_hmaclist_t *list)
{
if (list != NULL) {
SCTP_FREE(list, SCTP_M_AUTH_HL);
@@ -661,7 +663,7 @@ sctp_free_hmaclist(sctp_hmaclist_t * list)
}
int
-sctp_auth_add_hmacid(sctp_hmaclist_t * list, uint16_t hmac_id)
+sctp_auth_add_hmacid(sctp_hmaclist_t *list, uint16_t hmac_id)
{
int i;
@@ -689,7 +691,7 @@ sctp_auth_add_hmacid(sctp_hmaclist_t * list, uint16_t hmac_id)
}
sctp_hmaclist_t *
-sctp_copy_hmaclist(sctp_hmaclist_t * list)
+sctp_copy_hmaclist(sctp_hmaclist_t *list)
{
sctp_hmaclist_t *new_list;
int i;
@@ -727,7 +729,8 @@ sctp_default_supported_hmaclist(void)
* find the best HMAC id to use for the peer based on local support
*/
uint16_t
-sctp_negotiate_hmacid(sctp_hmaclist_t * peer, sctp_hmaclist_t * local) {
+sctp_negotiate_hmacid(sctp_hmaclist_t *peer, sctp_hmaclist_t *local)
+{
int i, j;
if ((local == NULL) || (peer == NULL))
@@ -753,7 +756,7 @@ sctp_negotiate_hmacid(sctp_hmaclist_t * peer, sctp_hmaclist_t * local) {
* caller must guarantee ptr has appropriate space
*/
int
-sctp_serialize_hmaclist(sctp_hmaclist_t * list, uint8_t * ptr)
+sctp_serialize_hmaclist(sctp_hmaclist_t *list, uint8_t *ptr)
{
int i;
uint16_t hmac_id;
@@ -799,7 +802,7 @@ sctp_alloc_authinfo(void)
}
void
-sctp_free_authinfo(sctp_authinfo_t * authinfo)
+sctp_free_authinfo(sctp_authinfo_t *authinfo)
{
if (authinfo == NULL)
return;
@@ -819,7 +822,8 @@ sctp_free_authinfo(sctp_authinfo_t * authinfo)
uint32_t
-sctp_get_auth_chunk_len(uint16_t hmac_algo) {
+sctp_get_auth_chunk_len(uint16_t hmac_algo)
+{
int size;
size = sizeof(struct sctp_auth_chunk) + sctp_get_hmac_digest_len(hmac_algo);
@@ -827,7 +831,8 @@ sctp_get_auth_chunk_len(uint16_t hmac_algo) {
}
uint32_t
-sctp_get_hmac_digest_len(uint16_t hmac_algo) {
+sctp_get_hmac_digest_len(uint16_t hmac_algo)
+{
switch (hmac_algo) {
case SCTP_AUTH_HMAC_ID_SHA1:
return (SCTP_AUTH_DIGEST_LEN_SHA1);
@@ -855,7 +860,7 @@ sctp_get_hmac_block_len(uint16_t hmac_algo)
}
static void
-sctp_hmac_init(uint16_t hmac_algo, sctp_hash_context_t * ctx)
+sctp_hmac_init(uint16_t hmac_algo, sctp_hash_context_t *ctx)
{
switch (hmac_algo) {
case SCTP_AUTH_HMAC_ID_SHA1:
@@ -872,8 +877,8 @@ sctp_hmac_init(uint16_t hmac_algo, sctp_hash_context_t * ctx)
}
static void
-sctp_hmac_update(uint16_t hmac_algo, sctp_hash_context_t * ctx,
- uint8_t * text, uint32_t textlen)
+sctp_hmac_update(uint16_t hmac_algo, sctp_hash_context_t *ctx,
+ uint8_t *text, uint32_t textlen)
{
switch (hmac_algo) {
case SCTP_AUTH_HMAC_ID_SHA1:
@@ -890,8 +895,8 @@ sctp_hmac_update(uint16_t hmac_algo, sctp_hash_context_t * ctx,
}
static void
-sctp_hmac_final(uint16_t hmac_algo, sctp_hash_context_t * ctx,
- uint8_t * digest)
+sctp_hmac_final(uint16_t hmac_algo, sctp_hash_context_t *ctx,
+ uint8_t *digest)
{
switch (hmac_algo) {
case SCTP_AUTH_HMAC_ID_SHA1:
@@ -918,8 +923,9 @@ sctp_hmac_final(uint16_t hmac_algo, sctp_hash_context_t * ctx,
* resultant digest.
*/
uint32_t
-sctp_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen,
- uint8_t * text, uint32_t textlen, uint8_t * digest) {
+sctp_hmac(uint16_t hmac_algo, uint8_t *key, uint32_t keylen,
+ uint8_t *text, uint32_t textlen, uint8_t *digest)
+{
uint32_t digestlen;
uint32_t blocklen;
sctp_hash_context_t ctx;
@@ -977,8 +983,9 @@ sctp_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen,
/* mbuf version */
uint32_t
-sctp_hmac_m(uint16_t hmac_algo, uint8_t * key, uint32_t keylen,
- struct mbuf *m, uint32_t m_offset, uint8_t * digest, uint32_t trailer){
+sctp_hmac_m(uint16_t hmac_algo, uint8_t *key, uint32_t keylen,
+ struct mbuf *m, uint32_t m_offset, uint8_t *digest, uint32_t trailer)
+{
uint32_t digestlen;
uint32_t blocklen;
sctp_hash_context_t ctx;
@@ -1024,17 +1031,17 @@ sctp_hmac_m(uint16_t hmac_algo, uint8_t * key, uint32_t keylen,
sctp_hmac_update(hmac_algo, &ctx, ipad, blocklen);
/* find the correct starting mbuf and offset (get start of text) */
m_tmp = m;
- while ((m_tmp != NULL) && (m_offset >= (uint32_t) SCTP_BUF_LEN(m_tmp))) {
+ while ((m_tmp != NULL) && (m_offset >= (uint32_t)SCTP_BUF_LEN(m_tmp))) {
m_offset -= SCTP_BUF_LEN(m_tmp);
m_tmp = SCTP_BUF_NEXT(m_tmp);
}
/* now use the rest of the mbuf chain for the text */
while (m_tmp != NULL) {
if ((SCTP_BUF_NEXT(m_tmp) == NULL) && trailer) {
- sctp_hmac_update(hmac_algo, &ctx, mtod(m_tmp, uint8_t *) + m_offset,
+ sctp_hmac_update(hmac_algo, &ctx, mtod(m_tmp, uint8_t *)+m_offset,
SCTP_BUF_LEN(m_tmp) - (trailer + m_offset));
} else {
- sctp_hmac_update(hmac_algo, &ctx, mtod(m_tmp, uint8_t *) + m_offset,
+ sctp_hmac_update(hmac_algo, &ctx, mtod(m_tmp, uint8_t *)+m_offset,
SCTP_BUF_LEN(m_tmp) - m_offset);
}
@@ -1059,9 +1066,9 @@ sctp_hmac_m(uint16_t hmac_algo, uint8_t * key, uint32_t keylen,
* Returns -1 on error, 0 on success.
*/
int
-sctp_verify_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen,
- uint8_t * text, uint32_t textlen,
- uint8_t * digest, uint32_t digestlen)
+sctp_verify_hmac(uint16_t hmac_algo, uint8_t *key, uint32_t keylen,
+ uint8_t *text, uint32_t textlen,
+ uint8_t *digest, uint32_t digestlen)
{
uint32_t len;
uint8_t temp[SCTP_AUTH_DIGEST_LEN_MAX];
@@ -1092,8 +1099,9 @@ sctp_verify_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen,
* the keylen exceeds the HMAC block len).
*/
uint32_t
-sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t * key, uint8_t * text,
- uint32_t textlen, uint8_t * digest) {
+sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t *key, uint8_t *text,
+ uint32_t textlen, uint8_t *digest)
+{
uint32_t digestlen;
uint32_t blocklen;
sctp_hash_context_t ctx;
@@ -1126,8 +1134,9 @@ sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t * key, uint8_t * text,
/* mbuf version */
uint32_t
-sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t * key, struct mbuf *m,
- uint32_t m_offset, uint8_t * digest){
+sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t *key, struct mbuf *m,
+ uint32_t m_offset, uint8_t *digest)
+{
uint32_t digestlen;
uint32_t blocklen;
sctp_hash_context_t ctx;
@@ -1157,7 +1166,7 @@ sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t * key, struct mbuf *m,
}
int
-sctp_auth_is_supported_hmac(sctp_hmaclist_t * list, uint16_t id)
+sctp_auth_is_supported_hmac(sctp_hmaclist_t *list, uint16_t id)
{
int i;
@@ -1300,7 +1309,6 @@ sctp_auth_setactivekey(struct sctp_tcb *stcb, uint16_t keyid)
/* can't reactivate a deactivated key with other refcounts */
return (-1);
}
-
/* set the (new) active key */
stcb->asoc.authinfo.active_keyid = keyid;
/* reset the deactivated flag */
@@ -1355,7 +1363,6 @@ sctp_deact_sharedkey(struct sctp_tcb *stcb, uint16_t keyid)
sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb, keyid, 0,
SCTP_SO_LOCKED);
}
-
/* mark the key as deactivated */
skey->deactivated = 1;
@@ -1417,7 +1424,7 @@ sctp_auth_get_cookie_params(struct sctp_tcb *stcb, struct mbuf *m,
length += offset;
phdr = (struct sctp_paramhdr *)sctp_m_getptr(m, offset,
- sizeof(struct sctp_paramhdr), (uint8_t *) & tmp_param);
+ sizeof(struct sctp_paramhdr), (uint8_t *)&tmp_param);
while (phdr != NULL) {
ptype = ntohs(phdr->param_type);
plen = ntohs(phdr->param_length);
@@ -1484,7 +1491,7 @@ sctp_auth_get_cookie_params(struct sctp_tcb *stcb, struct mbuf *m,
if (offset + sizeof(struct sctp_paramhdr) > length)
break;
phdr = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, sizeof(struct sctp_paramhdr),
- (uint8_t *) & tmp_param);
+ (uint8_t *)&tmp_param);
}
/* concatenate the full random key */
keylen = sizeof(*p_random) + random_len + sizeof(*hmacs) + hmacs_len;
@@ -1575,7 +1582,6 @@ sctp_fill_hmac_digest_m(struct mbuf *m, uint32_t auth_offset,
"Assoc Key");
#endif
}
-
/* set in the active key id */
auth->shared_key_id = htons(keyid);
@@ -1597,14 +1603,14 @@ sctp_zero_m(struct mbuf *m, uint32_t m_offset, uint32_t size)
/* find the correct starting mbuf and offset (get start position) */
m_tmp = m;
- while ((m_tmp != NULL) && (m_offset >= (uint32_t) SCTP_BUF_LEN(m_tmp))) {
+ while ((m_tmp != NULL) && (m_offset >= (uint32_t)SCTP_BUF_LEN(m_tmp))) {
m_offset -= SCTP_BUF_LEN(m_tmp);
m_tmp = SCTP_BUF_NEXT(m_tmp);
}
/* now use the rest of the mbuf chain */
while ((m_tmp != NULL) && (size > 0)) {
- data = mtod(m_tmp, uint8_t *) + m_offset;
- if (size > (uint32_t) (SCTP_BUF_LEN(m_tmp) - m_offset)) {
+ data = mtod(m_tmp, uint8_t *)+m_offset;
+ if (size > (uint32_t)(SCTP_BUF_LEN(m_tmp) - m_offset)) {
memset(data, 0, SCTP_BUF_LEN(m_tmp) - m_offset);
size -= SCTP_BUF_LEN(m_tmp) - m_offset;
} else {
@@ -1763,7 +1769,6 @@ sctp_notify_authentication(struct sctp_tcb *stcb, uint32_t indication,
/* If the socket is gone we are out of here */
return;
}
-
if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_AUTHEVNT))
/* event not enabled */
return;
@@ -1924,7 +1929,6 @@ sctp_validate_init_auth_params(struct mbuf *m, int offset, int limit)
if (num_chunks)
got_chklist = 1;
}
-
offset += SCTP_SIZE32(plen);
if (offset >= limit) {
break;
@@ -2019,7 +2023,6 @@ sctp_initialize_auth_params(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
new_key->key[keylen++] = i;
}
}
-
/* append in the HMACs */
ph = (struct sctp_paramhdr *)(new_key->key + keylen);
ph->param_type = htons(SCTP_HMAC_LIST);
diff --git a/sys/netinet/sctp_auth.h b/sys/netinet/sctp_auth.h
index 05a4d4630ccd..66990c309338 100644
--- a/sys/netinet/sctp_auth.h
+++ b/sys/netinet/sctp_auth.h
@@ -53,12 +53,12 @@ __FBSDID("$FreeBSD$");
typedef union sctp_hash_context {
SCTP_SHA1_CTX sha1;
SCTP_SHA256_CTX sha256;
-} sctp_hash_context_t;
+} sctp_hash_context_t;
typedef struct sctp_key {
uint32_t keylen;
uint8_t key[];
-} sctp_key_t;
+} sctp_key_t;
typedef struct sctp_shared_key {
LIST_ENTRY(sctp_shared_key) next;
@@ -66,7 +66,7 @@ typedef struct sctp_shared_key {
uint32_t refcount; /* reference count */
uint16_t keyid; /* shared key ID */
uint8_t deactivated; /* key is deactivated */
-} sctp_sharedkey_t;
+} sctp_sharedkey_t;
LIST_HEAD(sctp_keyhead, sctp_shared_key);
@@ -74,26 +74,26 @@ LIST_HEAD(sctp_keyhead, sctp_shared_key);
typedef struct sctp_auth_chklist {
uint8_t chunks[256];
uint8_t num_chunks;
-} sctp_auth_chklist_t;
+} sctp_auth_chklist_t;
/* hmac algos supported list */
typedef struct sctp_hmaclist {
uint16_t max_algo; /* max algorithms allocated */
uint16_t num_algo; /* num algorithms used */
uint16_t hmac[];
-} sctp_hmaclist_t;
+} sctp_hmaclist_t;
/* authentication info */
typedef struct sctp_authinformation {
sctp_key_t *random; /* local random key (concatenated) */
uint32_t random_len; /* local random number length for param */
- sctp_key_t *peer_random; /* peer's random key (concatenated) */
+ sctp_key_t *peer_random;/* peer's random key (concatenated) */
sctp_key_t *assoc_key; /* cached concatenated send key */
sctp_key_t *recv_key; /* cached concatenated recv key */
uint16_t active_keyid; /* active send keyid */
uint16_t assoc_keyid; /* current send keyid (cached) */
uint16_t recv_keyid; /* last recv keyid (cached) */
-} sctp_authinfo_t;
+} sctp_authinfo_t;
@@ -107,85 +107,92 @@ typedef struct sctp_authinformation {
*/
/* socket option api functions */
-extern sctp_auth_chklist_t * sctp_alloc_chunklist(void);
-extern void sctp_free_chunklist(sctp_auth_chklist_t * chklist);
-extern void sctp_clear_chunklist(sctp_auth_chklist_t * chklist);
-extern sctp_auth_chklist_t * sctp_copy_chunklist(sctp_auth_chklist_t * chklist);
-extern int sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t * list);
-extern int sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklist_t * list);
-extern size_t sctp_auth_get_chklist_size(const sctp_auth_chklist_t * list);
-extern int
-sctp_serialize_auth_chunks(const sctp_auth_chklist_t * list,
- uint8_t * ptr);
-extern int
-sctp_pack_auth_chunks(const sctp_auth_chklist_t * list,
- uint8_t * ptr);
-extern int
-sctp_unpack_auth_chunks(const uint8_t * ptr, uint8_t num_chunks,
- sctp_auth_chklist_t * list);
+extern sctp_auth_chklist_t *sctp_alloc_chunklist(void);
+extern void sctp_free_chunklist(sctp_auth_chklist_t *chklist);
+extern void sctp_clear_chunklist(sctp_auth_chklist_t *chklist);
+extern sctp_auth_chklist_t *sctp_copy_chunklist(sctp_auth_chklist_t *chklist);
+extern int sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t *list);
+extern int sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklist_t *list);
+extern size_t sctp_auth_get_chklist_size(const sctp_auth_chklist_t *list);
+extern int
+sctp_serialize_auth_chunks(const sctp_auth_chklist_t *list,
+ uint8_t *ptr);
+extern int
+sctp_pack_auth_chunks(const sctp_auth_chklist_t *list,
+ uint8_t *ptr);
+extern int
+sctp_unpack_auth_chunks(const uint8_t *ptr, uint8_t num_chunks,
+ sctp_auth_chklist_t *list);
/* key handling */
-extern sctp_key_t * sctp_alloc_key(uint32_t keylen);
-extern void sctp_free_key(sctp_key_t * key);
-extern void sctp_print_key(sctp_key_t * key, const char *str);
-extern void sctp_show_key(sctp_key_t * key, const char *str);
-extern sctp_key_t * sctp_generate_random_key(uint32_t keylen);
-extern sctp_key_t * sctp_set_key(uint8_t * key, uint32_t keylen);
-extern sctp_key_t * sctp_compute_hashkey(sctp_key_t * key1, sctp_key_t * key2,
- sctp_key_t * shared);
+extern sctp_key_t *sctp_alloc_key(uint32_t keylen);
+extern void sctp_free_key(sctp_key_t *key);
+extern void sctp_print_key(sctp_key_t *key, const char *str);
+extern void sctp_show_key(sctp_key_t *key, const char *str);
+extern sctp_key_t *sctp_generate_random_key(uint32_t keylen);
+extern sctp_key_t *sctp_set_key(uint8_t *key, uint32_t keylen);
+extern sctp_key_t *
+sctp_compute_hashkey(sctp_key_t *key1, sctp_key_t *key2,
+ sctp_key_t *shared);
/* shared key handling */
-extern sctp_sharedkey_t * sctp_alloc_sharedkey(void);
-extern void sctp_free_sharedkey(sctp_sharedkey_t * skey);
-extern sctp_sharedkey_t * sctp_find_sharedkey(struct sctp_keyhead *shared_keys,
+extern sctp_sharedkey_t *sctp_alloc_sharedkey(void);
+extern void sctp_free_sharedkey(sctp_sharedkey_t *skey);
+extern sctp_sharedkey_t *
+sctp_find_sharedkey(struct sctp_keyhead *shared_keys,
uint16_t key_id);
-extern int
+extern int
sctp_insert_sharedkey(struct sctp_keyhead *shared_keys,
- sctp_sharedkey_t * new_skey);
-extern int
+ sctp_sharedkey_t *new_skey);
+extern int
sctp_copy_skeylist(const struct sctp_keyhead *src,
struct sctp_keyhead *dest);
/* ref counts on shared keys, by key id */
extern void sctp_auth_key_acquire(struct sctp_tcb *stcb, uint16_t keyid);
-extern void
+extern void
sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t keyid,
int so_locked);
/* hmac list handling */
-extern sctp_hmaclist_t * sctp_alloc_hmaclist(uint16_t num_hmacs);
-extern void sctp_free_hmaclist(sctp_hmaclist_t * list);
-extern int sctp_auth_add_hmacid(sctp_hmaclist_t * list, uint16_t hmac_id);
-extern sctp_hmaclist_t * sctp_copy_hmaclist(sctp_hmaclist_t * list);
-extern sctp_hmaclist_t * sctp_default_supported_hmaclist(void);
-extern uint16_t sctp_negotiate_hmacid(sctp_hmaclist_t * peer,
- sctp_hmaclist_t * local);
-extern int sctp_serialize_hmaclist(sctp_hmaclist_t * list, uint8_t * ptr);
-extern int
+extern sctp_hmaclist_t *sctp_alloc_hmaclist(uint16_t num_hmacs);
+extern void sctp_free_hmaclist(sctp_hmaclist_t *list);
+extern int sctp_auth_add_hmacid(sctp_hmaclist_t *list, uint16_t hmac_id);
+extern sctp_hmaclist_t *sctp_copy_hmaclist(sctp_hmaclist_t *list);
+extern sctp_hmaclist_t *sctp_default_supported_hmaclist(void);
+extern uint16_t
+sctp_negotiate_hmacid(sctp_hmaclist_t *peer,
+ sctp_hmaclist_t *local);
+extern int sctp_serialize_hmaclist(sctp_hmaclist_t *list, uint8_t *ptr);
+extern int
sctp_verify_hmac_param(struct sctp_auth_hmac_algo *hmacs,
uint32_t num_hmacs);
-extern sctp_authinfo_t * sctp_alloc_authinfo(void);
-extern void sctp_free_authinfo(sctp_authinfo_t * authinfo);
+extern sctp_authinfo_t *sctp_alloc_authinfo(void);
+extern void sctp_free_authinfo(sctp_authinfo_t *authinfo);
/* keyed-HMAC functions */
extern uint32_t sctp_get_auth_chunk_len(uint16_t hmac_algo);
extern uint32_t sctp_get_hmac_digest_len(uint16_t hmac_algo);
-extern uint32_t sctp_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen,
- uint8_t * text, uint32_t textlen, uint8_t * digest);
-extern int
-sctp_verify_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen,
- uint8_t * text, uint32_t textlen, uint8_t * digest, uint32_t digestlen);
-extern uint32_t sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t * key,
- uint8_t * text, uint32_t textlen, uint8_t * digest);
-extern int sctp_auth_is_supported_hmac(sctp_hmaclist_t * list, uint16_t id);
+extern uint32_t
+sctp_hmac(uint16_t hmac_algo, uint8_t *key, uint32_t keylen,
+ uint8_t *text, uint32_t textlen, uint8_t *digest);
+extern int
+sctp_verify_hmac(uint16_t hmac_algo, uint8_t *key, uint32_t keylen,
+ uint8_t *text, uint32_t textlen, uint8_t *digest, uint32_t digestlen);
+extern uint32_t
+sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t *key,
+ uint8_t *text, uint32_t textlen, uint8_t *digest);
+extern int sctp_auth_is_supported_hmac(sctp_hmaclist_t *list, uint16_t id);
/* mbuf versions */
-extern uint32_t sctp_hmac_m(uint16_t hmac_algo, uint8_t * key, uint32_t keylen,
- struct mbuf *m, uint32_t m_offset, uint8_t * digest, uint32_t trailer);
-extern uint32_t sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t * key,
- struct mbuf *m, uint32_t m_offset, uint8_t * digest);
+extern uint32_t
+sctp_hmac_m(uint16_t hmac_algo, uint8_t *key, uint32_t keylen,
+ struct mbuf *m, uint32_t m_offset, uint8_t *digest, uint32_t trailer);
+extern uint32_t
+sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t *key,
+ struct mbuf *m, uint32_t m_offset, uint8_t *digest);
/*
* authentication routines
@@ -199,26 +206,26 @@ extern int sctp_auth_setactivekey_ep(struct sctp_inpcb *inp, uint16_t keyid);
extern int sctp_deact_sharedkey(struct sctp_tcb *stcb, uint16_t keyid);
extern int sctp_deact_sharedkey_ep(struct sctp_inpcb *inp, uint16_t keyid);
-extern void
+extern void
sctp_auth_get_cookie_params(struct sctp_tcb *stcb, struct mbuf *m,
uint32_t offset, uint32_t length);
-extern void
+extern void
sctp_fill_hmac_digest_m(struct mbuf *m, uint32_t auth_offset,
struct sctp_auth_chunk *auth, struct sctp_tcb *stcb, uint16_t key_id);
extern struct mbuf *
sctp_add_auth_chunk(struct mbuf *m, struct mbuf **m_end,
- struct sctp_auth_chunk **auth_ret, uint32_t * offset,
+ struct sctp_auth_chunk **auth_ret, uint32_t *offset,
struct sctp_tcb *stcb, uint8_t chunk);
-extern int
+extern int
sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_auth_chunk *ch,
struct mbuf *m, uint32_t offset);
-extern void
+extern void
sctp_notify_authentication(struct sctp_tcb *stcb,
uint32_t indication, uint16_t keyid, uint16_t alt_keyid, int so_locked);
-extern int
+extern int
sctp_validate_init_auth_params(struct mbuf *m, int offset,
int limit);
-extern void
+extern void
sctp_initialize_auth_params(struct sctp_inpcb *inp,
struct sctp_tcb *stcb);
diff --git a/sys/netinet/sctp_bsd_addr.c b/sys/netinet/sctp_bsd_addr.c
index 1bdc45e822c0..4b17bb50ba3f 100644
--- a/sys/netinet/sctp_bsd_addr.c
+++ b/sys/netinet/sctp_bsd_addr.c
@@ -146,7 +146,8 @@ sctp_gather_internal_ifa_flags(struct sctp_ifa *ifa)
static uint32_t
-sctp_is_desired_interface_type(struct ifnet *ifn){
+sctp_is_desired_interface_type(struct ifnet *ifn)
+{
int result;
/* check the interface type to see if it's one we care about */
@@ -304,12 +305,10 @@ sctp_addr_change(struct ifaddr *ifa, int cmd)
SCTP_BASE_VAR(first_time) = 1;
sctp_init_ifns_for_vrf(SCTP_DEFAULT_VRFID);
}
-
if ((cmd != RTM_ADD) && (cmd != RTM_DELETE)) {
/* don't know what to do with this */
return;
}
-
if (ifa->ifa_addr == NULL) {
return;
}
@@ -477,7 +476,7 @@ again_locked:
lenat++;
*lenat = value;
lenat++;
- tick_tock = (uint32_t *) lenat;
+ tick_tock = (uint32_t *)lenat;
lenat++;
*tick_tock = sctp_get_tick_count();
copyto = (void *)lenat;
@@ -498,7 +497,7 @@ no_log:
int
-sctp_copy_out_packet_log(uint8_t * target, int length)
+sctp_copy_out_packet_log(uint8_t *target, int length)
{
/*
* We wind through the packet log starting at start copying up to
diff --git a/sys/netinet/sctp_bsd_addr.h b/sys/netinet/sctp_bsd_addr.h
index 365430914aa2..f2191a9bcacb 100644
--- a/sys/netinet/sctp_bsd_addr.h
+++ b/sys/netinet/sctp_bsd_addr.h
@@ -55,7 +55,7 @@ void sctp_gather_internal_ifa_flags(struct sctp_ifa *ifa);
#ifdef SCTP_PACKET_LOGGING
void sctp_packet_log(struct mbuf *m);
-int sctp_copy_out_packet_log(uint8_t * target, int length);
+int sctp_copy_out_packet_log(uint8_t *target, int length);
#endif
diff --git a/sys/netinet/sctp_cc_functions.c b/sys/netinet/sctp_cc_functions.c
index d6713b92ffd2..fe881e037668 100644
--- a/sys/netinet/sctp_cc_functions.c
+++ b/sys/netinet/sctp_cc_functions.c
@@ -124,14 +124,13 @@ sctp_cwnd_update_after_fr(struct sctp_tcb *stcb,
t_ssthresh += net->ssthresh;
t_cwnd += net->cwnd;
if (net->lastsa > 0) {
- t_ucwnd_sbw += (uint64_t) net->cwnd / (uint64_t) net->lastsa;
+ t_ucwnd_sbw += (uint64_t)net->cwnd / (uint64_t)net->lastsa;
}
}
if (t_ucwnd_sbw == 0) {
t_ucwnd_sbw = 1;
}
}
-
/*-
* CMT fast recovery code. Need to debug. ((sctp_cmt_on_off > 0) &&
* (net->fast_retran_loss_recovery == 0)))
@@ -153,10 +152,10 @@ sctp_cwnd_update_after_fr(struct sctp_tcb *stcb,
if ((asoc->sctp_cmt_on_off == SCTP_CMT_RPV1) ||
(asoc->sctp_cmt_on_off == SCTP_CMT_RPV2)) {
if (asoc->sctp_cmt_on_off == SCTP_CMT_RPV1) {
- net->ssthresh = (uint32_t) (((uint64_t) 4 *
- (uint64_t) net->mtu *
- (uint64_t) net->ssthresh) /
- (uint64_t) t_ssthresh);
+ net->ssthresh = (uint32_t)(((uint64_t)4 *
+ (uint64_t)net->mtu *
+ (uint64_t)net->ssthresh) /
+ (uint64_t)t_ssthresh);
}
if (asoc->sctp_cmt_on_off == SCTP_CMT_RPV2) {
@@ -174,10 +173,10 @@ sctp_cwnd_update_after_fr(struct sctp_tcb *stcb,
* Short Version => Equal to
* Contel Version MBe
*/
- net->ssthresh = (uint32_t) (((uint64_t) 4 *
- (uint64_t) net->mtu *
- (uint64_t) net->cwnd) /
- ((uint64_t) srtt *
+ net->ssthresh = (uint32_t)(((uint64_t)4 *
+ (uint64_t)net->mtu *
+ (uint64_t)net->cwnd) /
+ ((uint64_t)srtt *
t_ucwnd_sbw));
/* INCREASE FACTOR */ ;
}
@@ -256,7 +255,7 @@ cc_bw_same(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw,
{
uint64_t oth, probepoint;
- probepoint = (((uint64_t) net->cwnd) << 32);
+ probepoint = (((uint64_t)net->cwnd) << 32);
if (net->rtt > net->cc_mod.rtcc.lbw_rtt + rtt_offset) {
/*
* rtt increased we don't update bw.. so we don't update the
@@ -392,7 +391,7 @@ cc_bw_decrease(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, uint6
uint64_t oth, probepoint;
/* Bandwidth decreased. */
- probepoint = (((uint64_t) net->cwnd) << 32);
+ probepoint = (((uint64_t)net->cwnd) << 32);
if (net->rtt > net->cc_mod.rtcc.lbw_rtt + rtt_offset) {
/* rtt increased */
/* Did we add more */
@@ -537,7 +536,7 @@ cc_bw_increase(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, uint6
* attention to the inst_ind since our overall sum is increasing.
*/
/* PROBE POINT 0 */
- probepoint = (((uint64_t) net->cwnd) << 32);
+ probepoint = (((uint64_t)net->cwnd) << 32);
SDT_PROBE5(sctp, cwnd, net, rttvar,
vtag,
((net->cc_mod.rtcc.lbw << 32) | nbw),
@@ -619,8 +618,8 @@ cc_bw_limit(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw)
*/
bw_shift = SCTP_BASE_SYSCTL(sctp_rttvar_bw);
rtt = stcb->asoc.my_vtag;
- vtag = (rtt << 32) | (((uint32_t) (stcb->sctp_ep->sctp_lport)) << 16) | (stcb->rport);
- probepoint = (((uint64_t) net->cwnd) << 32);
+ vtag = (rtt << 32) | (((uint32_t)(stcb->sctp_ep->sctp_lport)) << 16) | (stcb->rport);
+ probepoint = (((uint64_t)net->cwnd) << 32);
rtt = net->rtt;
if (net->cc_mod.rtcc.rtt_set_this_sack) {
net->cc_mod.rtcc.rtt_set_this_sack = 0;
@@ -640,7 +639,7 @@ cc_bw_limit(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw)
probepoint |= ((0xb << 16) | inst_ind);
} else {
inst_ind = net->cc_mod.rtcc.last_inst_ind;
- inst_bw = bytes_for_this_rtt / (uint64_t) (net->rtt);
+ inst_bw = bytes_for_this_rtt / (uint64_t)(net->rtt);
/* Can't determine do not change */
probepoint |= ((0xc << 16) | inst_ind);
}
@@ -712,11 +711,11 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb,
if (srtt > 0) {
uint64_t tmp;
- t_ucwnd_sbw += (uint64_t) net->cwnd / (uint64_t) srtt;
- t_path_mptcp += (((uint64_t) net->cwnd) << SHIFT_MPTCP_MULTI_Z) /
- (((uint64_t) net->mtu) * (uint64_t) srtt);
- tmp = (((uint64_t) net->cwnd) << SHIFT_MPTCP_MULTI_N) /
- ((uint64_t) net->mtu * (uint64_t) (srtt * srtt));
+ t_ucwnd_sbw += (uint64_t)net->cwnd / (uint64_t)srtt;
+ t_path_mptcp += (((uint64_t)net->cwnd) << SHIFT_MPTCP_MULTI_Z) /
+ (((uint64_t)net->mtu) * (uint64_t)srtt);
+ tmp = (((uint64_t)net->cwnd) << SHIFT_MPTCP_MULTI_N) /
+ ((uint64_t)net->mtu * (uint64_t)(srtt * srtt));
if (tmp > max_path) {
max_path = tmp;
}
@@ -804,10 +803,10 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb,
} else {
uint64_t vtag, probepoint;
- probepoint = (((uint64_t) net->cwnd) << 32);
+ probepoint = (((uint64_t)net->cwnd) << 32);
probepoint |= ((0xa << 16) | 0);
vtag = (net->rtt << 32) |
- (((uint32_t) (stcb->sctp_ep->sctp_lport)) << 16) |
+ (((uint32_t)(stcb->sctp_ep->sctp_lport)) << 16) |
(stcb->rport);
SDT_PROBE5(sctp, cwnd, net, rttvar,
@@ -839,13 +838,13 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb,
old_cwnd = net->cwnd;
switch (asoc->sctp_cmt_on_off) {
case SCTP_CMT_RPV1:
- limit = (uint32_t) (((uint64_t) net->mtu *
- (uint64_t) SCTP_BASE_SYSCTL(sctp_L2_abc_variable) *
- (uint64_t) net->ssthresh) /
- (uint64_t) t_ssthresh);
- incr = (uint32_t) (((uint64_t) net->net_ack *
- (uint64_t) net->ssthresh) /
- (uint64_t) t_ssthresh);
+ limit = (uint32_t)(((uint64_t)net->mtu *
+ (uint64_t)SCTP_BASE_SYSCTL(sctp_L2_abc_variable) *
+ (uint64_t)net->ssthresh) /
+ (uint64_t)t_ssthresh);
+ incr = (uint32_t)(((uint64_t)net->net_ack *
+ (uint64_t)net->ssthresh) /
+ (uint64_t)t_ssthresh);
if (incr > limit) {
incr = limit;
}
@@ -862,14 +861,14 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb,
if (srtt == 0) {
srtt = 1;
}
- limit = (uint32_t) (((uint64_t) net->mtu *
- (uint64_t) SCTP_BASE_SYSCTL(sctp_L2_abc_variable) *
- (uint64_t) net->cwnd) /
- ((uint64_t) srtt * t_ucwnd_sbw));
+ limit = (uint32_t)(((uint64_t)net->mtu *
+ (uint64_t)SCTP_BASE_SYSCTL(sctp_L2_abc_variable) *
+ (uint64_t)net->cwnd) /
+ ((uint64_t)srtt * t_ucwnd_sbw));
/* INCREASE FACTOR */
- incr = (uint32_t) (((uint64_t) net->net_ack *
- (uint64_t) net->cwnd) /
- ((uint64_t) srtt * t_ucwnd_sbw));
+ incr = (uint32_t)(((uint64_t)net->net_ack *
+ (uint64_t)net->cwnd) /
+ ((uint64_t)srtt * t_ucwnd_sbw));
/* INCREASE FACTOR */
if (incr > limit) {
incr = limit;
@@ -879,11 +878,11 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb,
}
break;
case SCTP_CMT_MPTCP:
- limit = (uint32_t) (((uint64_t) net->mtu *
+ limit = (uint32_t)(((uint64_t)net->mtu *
mptcp_like_alpha *
- (uint64_t) SCTP_BASE_SYSCTL(sctp_L2_abc_variable)) >>
+ (uint64_t)SCTP_BASE_SYSCTL(sctp_L2_abc_variable)) >>
SHIFT_MPTCP_MULTI);
- incr = (uint32_t) (((uint64_t) net->net_ack *
+ incr = (uint32_t)(((uint64_t)net->net_ack *
mptcp_like_alpha) >>
SHIFT_MPTCP_MULTI);
if (incr > limit) {
@@ -933,9 +932,9 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb,
old_cwnd = net->cwnd;
switch (asoc->sctp_cmt_on_off) {
case SCTP_CMT_RPV1:
- incr = (uint32_t) (((uint64_t) net->mtu *
- (uint64_t) net->ssthresh) /
- (uint64_t) t_ssthresh);
+ incr = (uint32_t)(((uint64_t)net->mtu *
+ (uint64_t)net->ssthresh) /
+ (uint64_t)t_ssthresh);
if (incr == 0) {
incr = 1;
}
@@ -949,9 +948,9 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb,
if (srtt == 0) {
srtt = 1;
}
- incr = (uint32_t) ((uint64_t) net->mtu *
- (uint64_t) net->cwnd /
- ((uint64_t) srtt *
+ incr = (uint32_t)((uint64_t)net->mtu *
+ (uint64_t)net->cwnd /
+ ((uint64_t)srtt *
t_ucwnd_sbw));
/* INCREASE FACTOR */
if (incr == 0) {
@@ -959,8 +958,8 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb,
}
break;
case SCTP_CMT_MPTCP:
- incr = (uint32_t) ((mptcp_like_alpha *
- (uint64_t) net->cwnd) >>
+ incr = (uint32_t)((mptcp_like_alpha *
+ (uint64_t)net->cwnd) >>
SHIFT_MPTCP_MULTI);
if (incr > net->mtu) {
incr = net->mtu;
@@ -1034,7 +1033,7 @@ sctp_cwnd_update_after_timeout(struct sctp_tcb *stcb, struct sctp_nets *net)
srtt = lnet->lastsa;
/* lastsa>>3; we don't need to divide ... */
if (srtt > 0) {
- t_ucwnd_sbw += (uint64_t) lnet->cwnd / (uint64_t) srtt;
+ t_ucwnd_sbw += (uint64_t)lnet->cwnd / (uint64_t)srtt;
}
}
if (t_ssthresh < 1) {
@@ -1044,10 +1043,10 @@ sctp_cwnd_update_after_timeout(struct sctp_tcb *stcb, struct sctp_nets *net)
t_ucwnd_sbw = 1;
}
if (stcb->asoc.sctp_cmt_on_off == SCTP_CMT_RPV1) {
- net->ssthresh = (uint32_t) (((uint64_t) 4 *
- (uint64_t) net->mtu *
- (uint64_t) net->ssthresh) /
- (uint64_t) t_ssthresh);
+ net->ssthresh = (uint32_t)(((uint64_t)4 *
+ (uint64_t)net->mtu *
+ (uint64_t)net->ssthresh) /
+ (uint64_t)t_ssthresh);
} else {
uint64_t cc_delta;
@@ -1056,9 +1055,9 @@ sctp_cwnd_update_after_timeout(struct sctp_tcb *stcb, struct sctp_nets *net)
if (srtt == 0) {
srtt = 1;
}
- cc_delta = t_ucwnd_sbw * (uint64_t) srtt / 2;
+ cc_delta = t_ucwnd_sbw * (uint64_t)srtt / 2;
if (cc_delta < t_cwnd) {
- net->ssthresh = (uint32_t) ((uint64_t) t_cwnd - cc_delta);
+ net->ssthresh = (uint32_t)((uint64_t)t_cwnd - cc_delta);
} else {
net->ssthresh = net->mtu;
}
@@ -1120,7 +1119,6 @@ sctp_cwnd_update_after_ecn_echo_common(struct sctp_tcb *stcb, struct sctp_nets *
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT);
}
-
}
SCTP_STAT_INCR(sctps_ecnereducedcwnd);
} else {
@@ -1152,7 +1150,7 @@ sctp_cwnd_update_after_ecn_echo_common(struct sctp_tcb *stcb, struct sctp_nets *
static void
sctp_cwnd_update_after_packet_dropped(struct sctp_tcb *stcb,
struct sctp_nets *net, struct sctp_pktdrop_chunk *cp,
- uint32_t * bottle_bw, uint32_t * on_queue)
+ uint32_t *bottle_bw, uint32_t *on_queue)
{
uint32_t bw_avail;
unsigned int incr;
@@ -1170,7 +1168,7 @@ sctp_cwnd_update_after_packet_dropped(struct sctp_tcb *stcb,
*on_queue = net->flight_size;
}
/* rtt is measured in micro seconds, bottle_bw in bytes per second */
- bw_avail = (uint32_t) (((uint64_t) (*bottle_bw) * net->rtt) / (uint64_t) 1000000);
+ bw_avail = (uint32_t)(((uint64_t)(*bottle_bw) * net->rtt) / (uint64_t)1000000);
if (bw_avail > *bottle_bw) {
/*
* Cap the growth to no more than the bottle neck. This can
@@ -1320,7 +1318,7 @@ sctp_cwnd_update_rtcc_after_ecn_echo(struct sctp_tcb *stcb, struct sctp_nets *ne
static
-void
+void
sctp_cwnd_update_rtcc_tsn_acknowledged(struct sctp_nets *net,
struct sctp_tmit_chunk *tp1)
{
@@ -1349,9 +1347,9 @@ sctp_cwnd_new_rtcc_transmission_begins(struct sctp_tcb *stcb,
if (net->cc_mod.rtcc.lbw) {
/* Clear the old bw.. we went to 0 in-flight */
- vtag = (net->rtt << 32) | (((uint32_t) (stcb->sctp_ep->sctp_lport)) << 16) |
+ vtag = (net->rtt << 32) | (((uint32_t)(stcb->sctp_ep->sctp_lport)) << 16) |
(stcb->rport);
- probepoint = (((uint64_t) net->cwnd) << 32);
+ probepoint = (((uint64_t)net->cwnd) << 32);
/* Probe point 8 */
probepoint |= ((8 << 16) | 0);
SDT_PROBE5(sctp, cwnd, net, rttvar,
@@ -1412,10 +1410,10 @@ sctp_set_rtcc_initial_cc_param(struct sctp_tcb *stcb,
sctp_set_initial_cc_param(stcb, net);
stcb->asoc.use_precise_time = 1;
- probepoint = (((uint64_t) net->cwnd) << 32);
+ probepoint = (((uint64_t)net->cwnd) << 32);
probepoint |= ((9 << 16) | 0);
vtag = (net->rtt << 32) |
- (((uint32_t) (stcb->sctp_ep->sctp_lport)) << 16) |
+ (((uint32_t)(stcb->sctp_ep->sctp_lport)) << 16) |
(stcb->rport);
SDT_PROBE5(sctp, cwnd, net, rttvar,
vtag,
@@ -1636,7 +1634,7 @@ sctp_hs_cwnd_increase(struct sctp_tcb *stcb, struct sctp_nets *net)
}
}
net->last_hs_used = indx;
- incr = (((int32_t) sctp_cwnd_adjust[indx].increase) << 10);
+ incr = (((int32_t)sctp_cwnd_adjust[indx].increase) << 10);
net->cwnd += incr;
}
sctp_enforce_cwnd_limit(&stcb->asoc, net);
@@ -1662,7 +1660,7 @@ sctp_hs_cwnd_decrease(struct sctp_tcb *stcb, struct sctp_nets *net)
} else {
/* drop by the proper amount */
net->ssthresh = net->cwnd - (int)((net->cwnd / 100) *
- (int32_t) sctp_cwnd_adjust[net->last_hs_used].drop_percent);
+ (int32_t)sctp_cwnd_adjust[net->last_hs_used].drop_percent);
net->cwnd = net->ssthresh;
/* now where are we */
indx = net->last_hs_used;
@@ -1868,12 +1866,14 @@ between(uint32_t seq1, uint32_t seq2, uint32_t seq3)
}
static inline uint32_t
-htcp_cong_time(struct htcp *ca){
+htcp_cong_time(struct htcp *ca)
+{
return (sctp_get_tick_count() - ca->last_cong);
}
static inline uint32_t
-htcp_ccount(struct htcp *ca){
+htcp_ccount(struct htcp *ca)
+{
return (htcp_cong_time(ca) / ca->minRTT);
}
@@ -1889,7 +1889,8 @@ htcp_reset(struct htcp *ca)
#ifdef SCTP_NOT_USED
static uint32_t
-htcp_cwnd_undo(struct sctp_tcb *stcb, struct sctp_nets *net){
+htcp_cwnd_undo(struct sctp_tcb *stcb, struct sctp_nets *net)
+{
net->cc_mod.htcp_ca.last_cong = net->cc_mod.htcp_ca.undo_last_cong;
net->cc_mod.htcp_ca.maxRTT = net->cc_mod.htcp_ca.undo_maxRTT;
net->cc_mod.htcp_ca.old_maxB = net->cc_mod.htcp_ca.undo_old_maxB;
@@ -1934,7 +1935,6 @@ measure_achieved_throughput(struct sctp_nets *net)
net->cc_mod.htcp_ca.lasttime = now;
return;
}
-
net->cc_mod.htcp_ca.bytecount += net->net_ack;
if ((net->cc_mod.htcp_ca.bytecount >= net->cwnd - (((net->cc_mod.htcp_ca.alpha >> 7) ? (net->cc_mod.htcp_ca.alpha >> 7) : 1) * net->mtu)) &&
(now - net->cc_mod.htcp_ca.lasttime >= net->cc_mod.htcp_ca.minRTT) &&
@@ -1971,8 +1971,7 @@ htcp_beta_update(struct htcp *ca, uint32_t minRTT, uint32_t maxRTT)
return;
}
}
-
- if (ca->modeswitch && minRTT > (uint32_t) MSEC_TO_TICKS(10) && maxRTT) {
+ if (ca->modeswitch && minRTT > (uint32_t)MSEC_TO_TICKS(10) && maxRTT) {
ca->beta = (minRTT << 7) / maxRTT;
if (ca->beta < BETA_MIN)
ca->beta = BETA_MIN;
@@ -1991,11 +1990,10 @@ htcp_alpha_update(struct htcp *ca)
uint32_t factor = 1;
uint32_t diff = htcp_cong_time(ca);
- if (diff > (uint32_t) hz) {
+ if (diff > (uint32_t)hz) {
diff -= hz;
factor = 1 + (10 * diff + ((diff / 2) * (diff / 2) / hz)) / hz;
}
-
if (use_rtt_scaling && minRTT) {
uint32_t scale = (hz << 3) / (10 * minRTT);
@@ -2005,7 +2003,6 @@ htcp_alpha_update(struct htcp *ca)
if (!factor)
factor = 1;
}
-
ca->alpha = 2 * factor * ((1 << 7) - ca->beta);
if (!ca->alpha)
ca->alpha = ALPHA_BASE;
@@ -2037,7 +2034,8 @@ htcp_param_update(struct sctp_nets *net)
}
static uint32_t
-htcp_recalc_ssthresh(struct sctp_nets *net){
+htcp_recalc_ssthresh(struct sctp_nets *net)
+{
htcp_param_update(net);
return (max(((net->cwnd / net->mtu * net->cc_mod.htcp_ca.beta) >> 7) * net->mtu, 2U * net->mtu));
}
@@ -2059,14 +2057,12 @@ htcp_cong_avoid(struct sctp_tcb *stcb, struct sctp_nets *net)
sctp_log_cwnd(stcb, net, net->mtu,
SCTP_CWND_LOG_FROM_SS);
}
-
} else {
net->cwnd += net->net_ack;
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
sctp_log_cwnd(stcb, net, net->net_ack,
SCTP_CWND_LOG_FROM_SS);
}
-
}
sctp_enforce_cwnd_limit(&stcb->asoc, net);
} else {
@@ -2111,7 +2107,8 @@ htcp_cong_avoid(struct sctp_tcb *stcb, struct sctp_nets *net)
#ifdef SCTP_NOT_USED
/* Lower bound on congestion window. */
static uint32_t
-htcp_min_cwnd(struct sctp_tcb *stcb, struct sctp_nets *net){
+htcp_min_cwnd(struct sctp_tcb *stcb, struct sctp_nets *net)
+{
return (net->ssthresh);
}
#endif
diff --git a/sys/netinet/sctp_crc32.c b/sys/netinet/sctp_crc32.c
index aec6ea6b88a2..da5df194b8b3 100644
--- a/sys/netinet/sctp_crc32.c
+++ b/sys/netinet/sctp_crc32.c
@@ -51,7 +51,8 @@ __FBSDID("$FreeBSD$");
#endif
static uint32_t
-sctp_finalize_crc32c(uint32_t crc32c) {
+sctp_finalize_crc32c(uint32_t crc32c)
+{
uint32_t result;
#if BYTE_ORDER == BIG_ENDIAN
uint8_t byte0, byte1, byte2, byte3;
@@ -87,12 +88,13 @@ sctp_finalize_crc32c(uint32_t crc32c) {
* it is compiled on a kernel with SCTP support.
*/
uint32_t
-sctp_calculate_cksum(struct mbuf *m, uint32_t offset){
+sctp_calculate_cksum(struct mbuf *m, uint32_t offset)
+{
uint32_t base = 0xffffffff;
while (offset > 0) {
KASSERT(m != NULL, ("sctp_calculate_cksum, offset > length of mbuf chain"));
- if (offset < (uint32_t) m->m_len) {
+ if (offset < (uint32_t)m->m_len) {
break;
}
offset -= m->m_len;
@@ -129,7 +131,7 @@ sctp_delayed_cksum(struct mbuf *m, uint32_t offset)
SCTP_STAT_INCR(sctps_sendswcrc);
offset += offsetof(struct sctphdr, checksum);
- if (offset + sizeof(uint32_t) > (uint32_t) (m->m_len)) {
+ if (offset + sizeof(uint32_t) > (uint32_t)(m->m_len)) {
#ifdef INVARIANTS
panic("sctp_delayed_cksum(): m->m_len: %d, offset: %u.",
m->m_len, offset);
@@ -139,6 +141,6 @@ sctp_delayed_cksum(struct mbuf *m, uint32_t offset)
#endif
return;
}
- *(uint32_t *) (m->m_data + offset) = checksum;
+ *(uint32_t *)(m->m_data + offset) = checksum;
}
#endif
diff --git a/sys/netinet/sctp_header.h b/sys/netinet/sctp_header.h
index 8c4137a50ca7..685ed78ac63d 100644
--- a/sys/netinet/sctp_header.h
+++ b/sys/netinet/sctp_header.h
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
* Parameter structures
*/
struct sctp_ipv4addr_param {
- struct sctp_paramhdr ph; /* type=SCTP_IPV4_PARAM_TYPE, len=8 */
+ struct sctp_paramhdr ph;/* type=SCTP_IPV4_PARAM_TYPE, len=8 */
uint32_t addr; /* IPV4 address */
} SCTP_PACKED;
@@ -56,20 +56,20 @@ struct sctp_ipv4addr_param {
struct sctp_ipv6addr_param {
- struct sctp_paramhdr ph; /* type=SCTP_IPV6_PARAM_TYPE, len=20 */
+ struct sctp_paramhdr ph;/* type=SCTP_IPV6_PARAM_TYPE, len=20 */
uint8_t addr[SCTP_V6_ADDR_BYTES]; /* IPV6 address */
} SCTP_PACKED;
/* Cookie Preservative */
struct sctp_cookie_perserve_param {
- struct sctp_paramhdr ph; /* type=SCTP_COOKIE_PRESERVE, len=8 */
+ struct sctp_paramhdr ph;/* type=SCTP_COOKIE_PRESERVE, len=8 */
uint32_t time; /* time in ms to extend cookie */
} SCTP_PACKED;
#define SCTP_ARRAY_MIN_LEN 1
/* Host Name Address */
struct sctp_host_name_param {
- struct sctp_paramhdr ph; /* type=SCTP_HOSTNAME_ADDRESS */
+ struct sctp_paramhdr ph;/* type=SCTP_HOSTNAME_ADDRESS */
char name[SCTP_ARRAY_MIN_LEN]; /* host name */
} SCTP_PACKED;
@@ -80,7 +80,7 @@ struct sctp_host_name_param {
#define SCTP_MAX_ADDR_PARAMS_SIZE 12
/* supported address type */
struct sctp_supported_addr_param {
- struct sctp_paramhdr ph; /* type=SCTP_SUPPORTED_ADDRTYPE */
+ struct sctp_paramhdr ph;/* type=SCTP_SUPPORTED_ADDRTYPE */
uint16_t addr_type[2]; /* array of supported address types */
} SCTP_PACKED;
@@ -108,8 +108,8 @@ struct sctp_prsctp_supported_param {
/* draft-ietf-tsvwg-addip-sctp */
struct sctp_asconf_paramhdr { /* an ASCONF "parameter" */
- struct sctp_paramhdr ph; /* a SCTP parameter header */
- uint32_t correlation_id; /* correlation id for this param */
+ struct sctp_paramhdr ph;/* a SCTP parameter header */
+ uint32_t correlation_id;/* correlation id for this param */
} SCTP_PACKED;
struct sctp_asconf_addr_param { /* an ASCONF address parameter */
@@ -133,7 +133,7 @@ struct sctp_asconf_addrv4_param { /* an ASCONF address (v4) parameter */
#define SCTP_MAX_SUPPORTED_EXT 256
struct sctp_supported_chunk_types_param {
- struct sctp_paramhdr ph; /* type = 0x8008 len = x */
+ struct sctp_paramhdr ph;/* type = 0x8008 len = x */
uint8_t chunk_types[];
} SCTP_PACKED;
@@ -206,8 +206,8 @@ struct sctp_state_cookie { /* this is our definition... */
uint16_t peerport; /* port address of the peer in the INIT */
uint16_t myport; /* my port address used in the INIT */
- uint8_t ipv4_addr_legal; /* Are V4 addr legal? */
- uint8_t ipv6_addr_legal; /* Are V6 addr legal? */
+ uint8_t ipv4_addr_legal;/* Are V4 addr legal? */
+ uint8_t ipv6_addr_legal;/* Are V6 addr legal? */
uint8_t local_scope; /* IPv6 local scope flag */
uint8_t site_scope; /* IPv6 site scope flag */
@@ -512,17 +512,17 @@ struct sctp_stream_reset_resp_tsn {
/* Should we make the max be 32? */
#define SCTP_RANDOM_MAX_SIZE 256
struct sctp_auth_random {
- struct sctp_paramhdr ph; /* type = 0x8002 */
+ struct sctp_paramhdr ph;/* type = 0x8002 */
uint8_t random_data[];
} SCTP_PACKED;
struct sctp_auth_chunk_list {
- struct sctp_paramhdr ph; /* type = 0x8003 */
+ struct sctp_paramhdr ph;/* type = 0x8003 */
uint8_t chunk_types[];
} SCTP_PACKED;
struct sctp_auth_hmac_algo {
- struct sctp_paramhdr ph; /* type = 0x8004 */
+ struct sctp_paramhdr ph;/* type = 0x8004 */
uint16_t hmac_ids[];
} SCTP_PACKED;
diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c
index 794dbd33d58c..dbc2aa549015 100644
--- a/sys/netinet/sctp_indata.c
+++ b/sys/netinet/sctp_indata.c
@@ -77,7 +77,8 @@ sctp_set_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc)
/* Calculate what the rwnd would be */
uint32_t
-sctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc){
+sctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc)
+{
uint32_t calc = 0;
/*
@@ -89,7 +90,6 @@ sctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc){
if (stcb->sctp_socket == NULL) {
return (calc);
}
-
KASSERT(asoc->cnt_on_reasm_queue > 0 || asoc->size_on_reasm_queue == 0,
("size_on_reasm_queue is %u", asoc->size_on_reasm_queue));
KASSERT(asoc->cnt_on_all_streams > 0 || asoc->size_on_all_streams == 0,
@@ -102,20 +102,19 @@ sctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc){
return (calc);
}
/* get actual space */
- calc = (uint32_t) sctp_sbspace(&stcb->asoc, &stcb->sctp_socket->so_rcv);
+ calc = (uint32_t)sctp_sbspace(&stcb->asoc, &stcb->sctp_socket->so_rcv);
/*
* take out what has NOT been put on socket queue and we yet hold
* for putting up.
*/
- calc = sctp_sbspace_sub(calc, (uint32_t) (asoc->size_on_reasm_queue +
+ calc = sctp_sbspace_sub(calc, (uint32_t)(asoc->size_on_reasm_queue +
asoc->cnt_on_reasm_queue * MSIZE));
- calc = sctp_sbspace_sub(calc, (uint32_t) (asoc->size_on_all_streams +
+ calc = sctp_sbspace_sub(calc, (uint32_t)(asoc->size_on_all_streams +
asoc->cnt_on_all_streams * MSIZE));
if (calc == 0) {
/* out of space */
return (calc);
}
-
/* what is the overhead of all these rwnd's */
calc = sctp_sbspace_sub(calc, stcb->asoc.my_rwnd_control_len);
/*
@@ -186,7 +185,6 @@ sctp_build_ctl_nchunk(struct sctp_inpcb *inp, struct sctp_sndrcvinfo *sinfo)
/* user does not want any ancillary data */
return (NULL);
}
-
len = 0;
if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_RECVRCVINFO)) {
len += CMSG_SPACE(sizeof(struct sctp_rcvinfo));
@@ -445,7 +443,7 @@ sctp_abort_in_reasm(struct sctp_tcb *stcb,
chk->rec.data.tsn,
chk->rec.data.sid,
chk->rec.data.fsn,
- (uint16_t) chk->rec.data.mid);
+ (uint16_t)chk->rec.data.mid);
}
oper = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg);
sctp_m_freem(chk->data);
@@ -529,10 +527,10 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb,
control->sinfo_stream, control->mid);
} else {
snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x",
- (uint16_t) strm->last_mid_delivered,
+ (uint16_t)strm->last_mid_delivered,
control->sinfo_tsn,
control->sinfo_stream,
- (uint16_t) control->mid);
+ (uint16_t)control->mid);
}
op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg);
stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_2;
@@ -695,7 +693,7 @@ sctp_setup_tail_pointer(struct sctp_queued_to_read *control)
}
static void
-sctp_add_to_tail_pointer(struct sctp_queued_to_read *control, struct mbuf *m, uint32_t * added)
+sctp_add_to_tail_pointer(struct sctp_queued_to_read *control, struct mbuf *m, uint32_t *added)
{
struct mbuf *prev = NULL;
struct sctp_tcb *stcb;
@@ -1046,7 +1044,6 @@ place_chunk:
SCTP_FROM_SCTP_INDATA + SCTP_LOC_5);
return;
}
-
}
if (inserted == 0) {
/* Its at the end */
@@ -1286,7 +1283,8 @@ uint32_t
sctp_add_chk_to_control(struct sctp_queued_to_read *control,
struct sctp_stream_in *strm,
struct sctp_tcb *stcb, struct sctp_association *asoc,
- struct sctp_tmit_chunk *chk, int hold_rlock){
+ struct sctp_tmit_chunk *chk, int hold_rlock)
+{
/*
* Given a control and a chunk, merge the data from the chk onto the
* control and free up the chunk resources.
@@ -1670,7 +1668,7 @@ sctp_find_reasm_entry(struct sctp_stream_in *strm, uint32_t mid, int ordered, in
static int
sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
struct mbuf **m, int offset, int chk_length,
- struct sctp_nets *net, uint32_t * high_tsn, int *abort_flag,
+ struct sctp_nets *net, uint32_t *high_tsn, int *abort_flag,
int *break_flag, int last_chunk, uint8_t chk_type)
{
struct sctp_tmit_chunk *chk = NULL; /* make gcc happy */
@@ -1693,7 +1691,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
struct sctp_idata_chunk *chunk, chunk_buf;
chunk = (struct sctp_idata_chunk *)sctp_m_getptr(*m, offset,
- sizeof(struct sctp_idata_chunk), (uint8_t *) & chunk_buf);
+ sizeof(struct sctp_idata_chunk), (uint8_t *)&chunk_buf);
chk_flags = chunk->ch.chunk_flags;
clen = sizeof(struct sctp_idata_chunk);
tsn = ntohl(chunk->dp.tsn);
@@ -1710,12 +1708,12 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
struct sctp_data_chunk *chunk, chunk_buf;
chunk = (struct sctp_data_chunk *)sctp_m_getptr(*m, offset,
- sizeof(struct sctp_data_chunk), (uint8_t *) & chunk_buf);
+ sizeof(struct sctp_data_chunk), (uint8_t *)&chunk_buf);
chk_flags = chunk->ch.chunk_flags;
clen = sizeof(struct sctp_data_chunk);
tsn = ntohl(chunk->dp.tsn);
sid = ntohs(chunk->dp.sid);
- mid = (uint32_t) (ntohs(chunk->dp.ssn));
+ mid = (uint32_t)(ntohs(chunk->dp.ssn));
fsn = tsn;
ppid = chunk->dp.ppid;
}
@@ -1757,7 +1755,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
/* Can't hold the bit in the mapping at max array, toss it */
return (0);
}
- if (gap >= (uint32_t) (asoc->mapping_array_size << 3)) {
+ if (gap >= (uint32_t)(asoc->mapping_array_size << 3)) {
SCTP_TCB_LOCK_ASSERT(stcb);
if (sctp_expand_mapping_array(asoc, gap)) {
/* Can't expand, drop it */
@@ -2005,10 +2003,10 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
mid);
} else {
snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x",
- (uint16_t) asoc->strmin[sid].last_mid_delivered,
+ (uint16_t)asoc->strmin[sid].last_mid_delivered,
tsn,
sid,
- (uint16_t) mid);
+ (uint16_t)mid);
}
op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg);
stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_16;
@@ -2140,7 +2138,6 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
control = NULL;
goto finish_express_del;
}
-
/* Now will we need a chunk too? */
if ((chk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) {
sctp_alloc_a_chunk(stcb, chk);
@@ -2505,8 +2502,8 @@ sctp_slide_mapping_arrays(struct sctp_tcb *stcb)
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) {
sctp_log_map(old_base, old_cumack, old_highest,
SCTP_MAP_PREPARE_SLIDE);
- sctp_log_map((uint32_t) slide_from, (uint32_t) slide_end,
- (uint32_t) lgap, SCTP_MAP_SLIDE_FROM);
+ sctp_log_map((uint32_t)slide_from, (uint32_t)slide_end,
+ (uint32_t)lgap, SCTP_MAP_SLIDE_FROM);
}
if (distance + slide_from > asoc->mapping_array_size ||
distance < 0) {
@@ -2518,8 +2515,8 @@ sctp_slide_mapping_arrays(struct sctp_tcb *stcb)
*/
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) {
- sctp_log_map((uint32_t) distance, (uint32_t) slide_from,
- (uint32_t) asoc->mapping_array_size,
+ sctp_log_map((uint32_t)distance, (uint32_t)slide_from,
+ (uint32_t)asoc->mapping_array_size,
SCTP_MAP_SLIDE_NONE);
}
} else {
@@ -2645,7 +2642,7 @@ sctp_sack_check(struct sctp_tcb *stcb, int was_a_gap)
int
sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length,
struct sctp_inpcb *inp, struct sctp_tcb *stcb,
- struct sctp_nets *net, uint32_t * high_tsn)
+ struct sctp_nets *net, uint32_t *high_tsn)
{
struct sctp_chunkhdr *ch, chunk_buf;
struct sctp_association *asoc;
@@ -2708,7 +2705,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length,
/* get pointer to the first chunk header */
ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset,
sizeof(struct sctp_chunkhdr),
- (uint8_t *) & chunk_buf);
+ (uint8_t *)&chunk_buf);
if (ch == NULL) {
return (1);
}
@@ -2872,7 +2869,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length,
if (op_err != NULL) {
cause = mtod(op_err, struct sctp_gen_error_cause *);
cause->code = htons(SCTP_CAUSE_UNRECOG_CHUNK);
- cause->length = htons((uint16_t) (chk_length + sizeof(struct sctp_gen_error_cause)));
+ cause->length = htons((uint16_t)(chk_length + sizeof(struct sctp_gen_error_cause)));
SCTP_BUF_LEN(op_err) = sizeof(struct sctp_gen_error_cause);
SCTP_BUF_NEXT(op_err) = SCTP_M_COPYM(m, *offset, chk_length, M_NOWAIT);
if (SCTP_BUF_NEXT(op_err) != NULL) {
@@ -2898,7 +2895,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length,
}
ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset,
sizeof(struct sctp_chunkhdr),
- (uint8_t *) & chunk_buf);
+ (uint8_t *)&chunk_buf);
if (ch == NULL) {
*offset = length;
stop_proc = 1;
@@ -2941,8 +2938,8 @@ static int
sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1, uint32_t last_tsn,
uint16_t frag_strt, uint16_t frag_end, int nr_sacking,
int *num_frs,
- uint32_t * biggest_newly_acked_tsn,
- uint32_t * this_sack_lowest_newack,
+ uint32_t *biggest_newly_acked_tsn,
+ uint32_t *this_sack_lowest_newack,
int *rto_ok)
{
struct sctp_tmit_chunk *tp1;
@@ -3063,7 +3060,7 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1
sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_GAP,
tp1->whoTo->flight_size,
tp1->book_size,
- (uint32_t) (uintptr_t) tp1->whoTo,
+ (uint32_t)(uintptr_t)tp1->whoTo,
tp1->rec.data.tsn);
}
sctp_flight_size_decrease(tp1);
@@ -3099,7 +3096,6 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1
tp1->do_rtt = 0;
}
}
-
}
if (tp1->sent <= SCTP_DATAGRAM_RESEND) {
if (SCTP_TSN_GT(tp1->rec.data.tsn,
@@ -3180,8 +3176,8 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1
static int
sctp_handle_segments(struct mbuf *m, int *offset, struct sctp_tcb *stcb, struct sctp_association *asoc,
- uint32_t last_tsn, uint32_t * biggest_tsn_acked,
- uint32_t * biggest_newly_acked_tsn, uint32_t * this_sack_lowest_newack,
+ uint32_t last_tsn, uint32_t *biggest_tsn_acked,
+ uint32_t *biggest_newly_acked_tsn, uint32_t *this_sack_lowest_newack,
int num_seg, int num_nr_seg, int *rto_ok)
{
struct sctp_gap_ack_block *frag, block;
@@ -3202,7 +3198,7 @@ sctp_handle_segments(struct mbuf *m, int *offset, struct sctp_tcb *stcb, struct
tp1 = TAILQ_FIRST(&asoc->sent_queue);
}
frag = (struct sctp_gap_ack_block *)sctp_m_getptr(m, *offset,
- sizeof(struct sctp_gap_ack_block), (uint8_t *) & block);
+ sizeof(struct sctp_gap_ack_block), (uint8_t *)&block);
*offset += sizeof(block);
if (frag == NULL) {
return (chunk_freed);
@@ -3272,7 +3268,7 @@ sctp_check_for_revoked(struct sctp_tcb *stcb,
sctp_misc_ints(SCTP_FLIGHT_LOG_UP_REVOKE,
tp1->whoTo->flight_size,
tp1->book_size,
- (uint32_t) (uintptr_t) tp1->whoTo,
+ (uint32_t)(uintptr_t)tp1->whoTo,
tp1->rec.data.tsn);
}
sctp_flight_size_increase(tp1);
@@ -3365,7 +3361,6 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
continue;
}
}
-
}
if (SCTP_TSN_GT(tp1->rec.data.tsn, asoc->this_sack_highest_gap) &&
!(accum_moved && asoc->fast_retran_loss_recovery)) {
@@ -3590,7 +3585,7 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_RSND,
(tp1->whoTo ? (tp1->whoTo->flight_size) : 0),
tp1->book_size,
- (uint32_t) (uintptr_t) tp1->whoTo,
+ (uint32_t)(uintptr_t)tp1->whoTo,
tp1->rec.data.tsn);
}
if (tp1->whoTo) {
@@ -3601,7 +3596,6 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
tp1);
}
}
-
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_RWND_ENABLE) {
sctp_log_rwnd(SCTP_INCREASE_PEER_RWND,
asoc->peers_rwnd, tp1->send_size, SCTP_BASE_SYSCTL(sctp_peer_chunk_oh));
@@ -3683,7 +3677,6 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
tp1->whoTo->find_pseudo_cumack = 1;
tp1->whoTo->find_rtx_pseudo_cumack = 1;
}
-
} else { /* CMT is OFF */
#ifdef SCTP_FR_TO_ALTERNATE
@@ -3904,7 +3897,7 @@ sctp_window_probe_recovery(struct sctp_tcb *stcb,
sctp_misc_ints(SCTP_FLIGHT_LOG_DWN_WP_FWD,
tp1->whoTo ? tp1->whoTo->flight_size : 0,
tp1->book_size,
- (uint32_t) (uintptr_t) tp1->whoTo,
+ (uint32_t)(uintptr_t)tp1->whoTo,
tp1->rec.data.tsn);
return;
}
@@ -3923,7 +3916,7 @@ sctp_window_probe_recovery(struct sctp_tcb *stcb,
sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_WP,
tp1->whoTo->flight_size,
tp1->book_size,
- (uint32_t) (uintptr_t) tp1->whoTo,
+ (uint32_t)(uintptr_t)tp1->whoTo,
tp1->rec.data.tsn);
}
}
@@ -3962,7 +3955,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
} else if (asoc->last_acked_seq == cumack) {
/* Window update sack */
asoc->peers_rwnd = sctp_sbspace_sub(rwnd,
- (uint32_t) (asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh))));
+ (uint32_t)(asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh))));
if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
/* SWS sender side engages */
asoc->peers_rwnd = 0;
@@ -3972,7 +3965,6 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
}
return;
}
-
/* First setup for CC stuff */
TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
if (SCTP_TSN_GT(cumack, net->cwr_window_tsn)) {
@@ -4040,7 +4032,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_CA,
tp1->whoTo->flight_size,
tp1->book_size,
- (uint32_t) (uintptr_t) tp1->whoTo,
+ (uint32_t)(uintptr_t)tp1->whoTo,
tp1->rec.data.tsn);
}
sctp_flight_size_decrease(tp1);
@@ -4238,10 +4230,9 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
asoc->total_flight = 0;
asoc->total_flight_count = 0;
}
-
/* RWND update */
asoc->peers_rwnd = sctp_sbspace_sub(rwnd,
- (uint32_t) (asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh))));
+ (uint32_t)(asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh))));
if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
/* SWS sender side engages */
asoc->peers_rwnd = 0;
@@ -4491,7 +4482,6 @@ sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup,
sctp_misc_ints(SCTP_SACK_LOG_NORMAL, cum_ack,
rwnd, stcb->asoc.last_acked_seq, stcb->asoc.peers_rwnd);
}
-
old_rwnd = stcb->asoc.peers_rwnd;
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) {
sctp_misc_ints(SCTP_THRESHOLD_CLEAR,
@@ -4515,8 +4505,8 @@ sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup,
uint32_t *dupdata, dblock;
for (i = 0; i < num_dup; i++) {
- dupdata = (uint32_t *) sctp_m_getptr(m, offset_dup + i * sizeof(uint32_t),
- sizeof(uint32_t), (uint8_t *) & dblock);
+ dupdata = (uint32_t *)sctp_m_getptr(m, offset_dup + i * sizeof(uint32_t),
+ sizeof(uint32_t), (uint8_t *)&dblock);
if (dupdata == NULL) {
break;
}
@@ -4563,7 +4553,6 @@ hopeless_peer:
/* acking something behind */
return;
}
-
/* update the Rwnd of the peer */
if (TAILQ_EMPTY(&asoc->sent_queue) &&
TAILQ_EMPTY(&asoc->send_queue) &&
@@ -4617,7 +4606,6 @@ hopeless_peer:
if (stcb->asoc.cc_functions.sctp_cwnd_prepare_net_for_sack) {
(*stcb->asoc.cc_functions.sctp_cwnd_prepare_net_for_sack) (stcb, net);
}
-
/*
* CMT: SFR algo (and HTNA) - this_sack_highest_newack has
* to be greater than the cumack. Also reset saw_newack to 0
@@ -4656,7 +4644,7 @@ hopeless_peer:
sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_CA,
tp1->whoTo->flight_size,
tp1->book_size,
- (uint32_t) (uintptr_t) tp1->whoTo,
+ (uint32_t)(uintptr_t)tp1->whoTo,
tp1->rec.data.tsn);
}
sctp_flight_size_decrease(tp1);
@@ -4853,7 +4841,6 @@ hopeless_peer:
#endif
asoc->total_flight = 0;
}
-
/* sa_ignore NO_NULL_CHK */
if ((wake_him) && (stcb->sctp_socket)) {
#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
@@ -4917,7 +4904,7 @@ hopeless_peer:
sctp_misc_ints(SCTP_FLIGHT_LOG_UP_REVOKE,
tp1->whoTo->flight_size,
tp1->book_size,
- (uint32_t) (uintptr_t) tp1->whoTo,
+ (uint32_t)(uintptr_t)tp1->whoTo,
tp1->rec.data.tsn);
}
sctp_flight_size_increase(tp1);
@@ -4958,7 +4945,6 @@ hopeless_peer:
sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb,
0, (void *)net, SCTP_SO_NOT_LOCKED);
}
-
if (net == stcb->asoc.primary_destination) {
if (stcb->asoc.alternate) {
/*
@@ -4969,7 +4955,6 @@ hopeless_peer:
stcb->asoc.alternate = NULL;
}
}
-
if (net->dest_state & SCTP_ADDR_PF) {
net->dest_state &= ~SCTP_ADDR_PF;
sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT,
@@ -4992,7 +4977,6 @@ hopeless_peer:
}
asoc->cc_functions.sctp_cwnd_update_after_sack(stcb, asoc, accum_moved, reneged_all, will_exit_fast_recovery);
}
-
if (TAILQ_EMPTY(&asoc->sent_queue)) {
/* nothing left in-flight */
TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
@@ -5006,7 +4990,6 @@ hopeless_peer:
asoc->total_flight = 0;
asoc->total_flight_count = 0;
}
-
/**********************************/
/* Now what about shutdown issues */
/**********************************/
@@ -5133,7 +5116,7 @@ hopeless_peer:
asoc->peers_rwnd, asoc->total_flight, (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)), a_rwnd);
}
asoc->peers_rwnd = sctp_sbspace_sub(a_rwnd,
- (uint32_t) (asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh))));
+ (uint32_t)(asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh))));
if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
/* SWS sender side engages */
asoc->peers_rwnd = 0;
@@ -5141,7 +5124,6 @@ hopeless_peer:
if (asoc->peers_rwnd > old_rwnd) {
win_probe_recovery = 1;
}
-
/*
* Now we must setup so we have a timer up for anyone with
* outstanding data.
@@ -5663,7 +5645,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb,
if (asoc->idata_supported) {
stseq_m = (struct sctp_strseq_mid *)sctp_m_getptr(m, offset,
sizeof(struct sctp_strseq_mid),
- (uint8_t *) & strseqbuf_m);
+ (uint8_t *)&strseqbuf_m);
offset += sizeof(struct sctp_strseq_mid);
if (stseq_m == NULL) {
break;
@@ -5679,13 +5661,13 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb,
} else {
stseq = (struct sctp_strseq *)sctp_m_getptr(m, offset,
sizeof(struct sctp_strseq),
- (uint8_t *) & strseqbuf);
+ (uint8_t *)&strseqbuf);
offset += sizeof(struct sctp_strseq);
if (stseq == NULL) {
break;
}
sid = ntohs(stseq->sid);
- mid = (uint32_t) ntohs(stseq->ssn);
+ mid = (uint32_t)ntohs(stseq->ssn);
ordered = 1;
}
/* Convert */
diff --git a/sys/netinet/sctp_indata.h b/sys/netinet/sctp_indata.h
index d51427699e67..10b18d0bc8ed 100644
--- a/sys/netinet/sctp_indata.h
+++ b/sys/netinet/sctp_indata.h
@@ -81,7 +81,7 @@ sctp_build_ctl_nchunk(struct sctp_inpcb *inp,
void sctp_set_rwnd(struct sctp_tcb *, struct sctp_association *);
uint32_t
-sctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc);
+ sctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc);
void
sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
@@ -99,7 +99,8 @@ void
sctp_handle_forward_tsn(struct sctp_tcb *,
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 *);
+struct sctp_tmit_chunk *
+ sctp_try_advance_peer_ack_point(struct sctp_tcb *, struct sctp_association *);
void sctp_service_queues(struct sctp_tcb *, struct sctp_association *);
diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c
index a4114cf6c859..08d84c904761 100644
--- a/sys/netinet/sctp_input.c
+++ b/sys/netinet/sctp_input.c
@@ -305,7 +305,6 @@ sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb)
if (SCTP_BASE_SYSCTL(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);
@@ -460,7 +459,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset,
return (-1);
}
asoc = &stcb->asoc;
- asoc->peer_supports_nat = (uint8_t) nat_friendly;
+ asoc->peer_supports_nat = (uint8_t)nat_friendly;
/* process the peer's parameters in the INIT-ACK */
retval = sctp_process_init((struct sctp_init_chunk *)cp, stcb);
if (retval < 0) {
@@ -492,7 +491,6 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset,
SCTP_FREE(param, SCTP_M_ASC_ADDR);
}
}
-
stcb->asoc.peer_hmac_id = sctp_negotiate_hmacid(stcb->asoc.peer_hmacs,
stcb->asoc.local_hmacs);
if (op_err) {
@@ -533,7 +531,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset,
if (retval == -3) {
uint16_t len;
- len = (uint16_t) (sizeof(struct sctp_error_missing_param) + sizeof(uint16_t));
+ len = (uint16_t)(sizeof(struct sctp_error_missing_param) + sizeof(uint16_t));
/* We abort with an error of missing mandatory param */
op_err = sctp_get_mbuf_for_msg(len, 0, M_NOWAIT, 1, MT_DATA);
if (op_err != NULL) {
@@ -555,7 +553,6 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset,
}
return (retval);
}
-
return (0);
}
@@ -573,7 +570,6 @@ sctp_handle_heartbeat_ack(struct sctp_heartbeat_chunk *cp,
/* Invalid length */
return;
}
-
memset(&store, 0, sizeof(store));
switch (cp->heartbeat.hb_info.addr_family) {
#ifdef INET
@@ -1558,7 +1554,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
init_cp = (struct sctp_init_chunk *)
sctp_m_getptr(m, init_offset, sizeof(struct sctp_init_chunk),
- (uint8_t *) & init_buf);
+ (uint8_t *)&init_buf);
if (init_cp == NULL) {
/* could not pull a INIT chunk in cookie */
return (NULL);
@@ -1573,7 +1569,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
initack_offset = init_offset + SCTP_SIZE32(ntohs(init_cp->ch.chunk_length));
initack_cp = (struct sctp_init_ack_chunk *)
sctp_m_getptr(m, initack_offset, sizeof(struct sctp_init_ack_chunk),
- (uint8_t *) & initack_buf);
+ (uint8_t *)&initack_buf);
if (initack_cp == NULL) {
/* could not pull INIT-ACK chunk in cookie */
return (NULL);
@@ -1720,7 +1716,6 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
asoc->cookie_how[how_indx] = 5;
return (stcb);
}
-
if (ntohl(initack_cp->init.initiate_tag) != asoc->my_vtag &&
ntohl(init_cp->init.initiate_tag) == asoc->peer_vtag &&
cookie->tie_tag_my_vtag == 0 &&
@@ -2108,7 +2103,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
init_offset = offset + sizeof(struct sctp_cookie_echo_chunk);
init_cp = (struct sctp_init_chunk *)
sctp_m_getptr(m, init_offset, sizeof(struct sctp_init_chunk),
- (uint8_t *) & init_buf);
+ (uint8_t *)&init_buf);
if (init_cp == NULL) {
/* could not pull a INIT chunk in cookie */
SCTPDBG(SCTP_DEBUG_INPUT1,
@@ -2126,7 +2121,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
*/
initack_cp = (struct sctp_init_ack_chunk *)
sctp_m_getptr(m, initack_offset, sizeof(struct sctp_init_ack_chunk),
- (uint8_t *) & initack_buf);
+ (uint8_t *)&initack_buf);
if (initack_cp == NULL) {
/* could not pull INIT-ACK chunk in cookie */
SCTPDBG(SCTP_DEBUG_INPUT1, "process_cookie_new: could not pull INIT-ACK chunk hdr\n");
@@ -2296,7 +2291,6 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
stcb->asoc.authenticated = 1;
}
}
-
/*
* if we're doing ASCONFs, check to see if we have any new local
* addresses that need to get added to the peer (eg. addresses
@@ -2540,17 +2534,17 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
(ep->current_secret_number != ep->last_secret_number)) {
/* it's the old cookie */
(void)sctp_hmac_m(SCTP_HMAC,
- (uint8_t *) ep->secret_key[(int)ep->last_secret_number],
+ (uint8_t *)ep->secret_key[(int)ep->last_secret_number],
SCTP_SECRET_SIZE, m, cookie_offset, calc_sig, 0);
} else {
/* it's the current cookie */
(void)sctp_hmac_m(SCTP_HMAC,
- (uint8_t *) ep->secret_key[(int)ep->current_secret_number],
+ (uint8_t *)ep->secret_key[(int)ep->current_secret_number],
SCTP_SECRET_SIZE, m, cookie_offset, calc_sig, 0);
}
/* get the signature */
SCTP_INP_RUNLOCK(l_inp);
- sig = (uint8_t *) sctp_m_getptr(m_sig, 0, SCTP_SIGNATURE_SIZE, (uint8_t *) & tmp_sig);
+ sig = (uint8_t *)sctp_m_getptr(m_sig, 0, SCTP_SIGNATURE_SIZE, (uint8_t *)&tmp_sig);
if (sig == NULL) {
/* couldn't find signature */
sctp_m_freem(m_sig);
@@ -2563,7 +2557,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
(ep->current_secret_number != ep->last_secret_number)) {
/* compute digest with old */
(void)sctp_hmac_m(SCTP_HMAC,
- (uint8_t *) ep->secret_key[(int)ep->last_secret_number],
+ (uint8_t *)ep->secret_key[(int)ep->last_secret_number],
SCTP_SECRET_SIZE, m, cookie_offset, calc_sig, 0);
/* compare */
if (memcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) == 0)
@@ -2591,10 +2585,9 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
SCTPDBG(SCTP_DEBUG_INPUT2, "handle_cookie_echo: cookie signature validation failed!\n");
SCTPDBG(SCTP_DEBUG_INPUT2,
"offset = %u, cookie_offset = %u, sig_offset = %u\n",
- (uint32_t) offset, cookie_offset, sig_offset);
+ (uint32_t)offset, cookie_offset, sig_offset);
return (NULL);
}
-
/*
* check the cookie timestamps to be sure it's not stale
*/
@@ -2623,12 +2616,12 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
(sizeof(uint32_t))));
diff = now;
timevalsub(&diff, &time_expires);
- if ((uint32_t) diff.tv_sec > UINT32_MAX / 1000000) {
+ if ((uint32_t)diff.tv_sec > UINT32_MAX / 1000000) {
staleness = UINT32_MAX;
} else {
staleness = diff.tv_sec * 1000000;
}
- if (UINT32_MAX - staleness >= (uint32_t) diff.tv_usec) {
+ if (UINT32_MAX - staleness >= (uint32_t)diff.tv_usec) {
staleness += diff.tv_usec;
} else {
staleness = UINT32_MAX;
@@ -2715,7 +2708,6 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
}
}
}
-
cookie_len -= SCTP_SIGNATURE_SIZE;
if (*stcb == NULL) {
/* this is the "normal" case... get a new TCB */
@@ -2918,7 +2910,6 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_CONFIRMED,
(*stcb), 0, (void *)netl, SCTP_SO_NOT_LOCKED);
}
-
/*
* Pull it from the incomplete queue and wake the
* guy
@@ -2959,7 +2950,6 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *cp SCTP_UNUSED,
if ((stcb == NULL) || (net == NULL)) {
return;
}
-
asoc = &stcb->asoc;
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) {
sctp_misc_ints(SCTP_THRESHOLD_CLEAR,
@@ -3026,7 +3016,6 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *cp SCTP_UNUSED,
*/
goto closed_socket;
}
-
sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep,
stcb, net);
@@ -3342,7 +3331,7 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc,
SCTP_STAT_INCR(sctps_pdrpdizrw);
return (0);
}
- ddp = (uint8_t *) (mtod(tp1->data, caddr_t)+
+ ddp = (uint8_t *)(mtod(tp1->data, caddr_t)+
sizeof(struct sctp_data_chunk));
{
unsigned int iii;
@@ -3397,7 +3386,7 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc,
sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_PDRP,
tp1->whoTo->flight_size,
tp1->book_size,
- (uint32_t) (uintptr_t) stcb,
+ (uint32_t)(uintptr_t)stcb,
tp1->rec.data.tsn);
}
if (tp1->sent < SCTP_DATAGRAM_RESEND) {
@@ -3528,7 +3517,7 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc,
}
void
-sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t * list)
+sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t *list)
{
uint32_t i;
uint16_t temp;
@@ -3556,7 +3545,7 @@ sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t *
}
static void
-sctp_reset_out_streams(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t * list)
+sctp_reset_out_streams(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t *list)
{
uint32_t i;
uint16_t temp;
@@ -3581,7 +3570,7 @@ sctp_reset_out_streams(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t
}
static void
-sctp_reset_clear_pending(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t * list)
+sctp_reset_clear_pending(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t *list)
{
uint32_t i;
uint16_t temp;
@@ -3805,7 +3794,6 @@ sctp_handle_stream_reset_response(struct sctp_tcb *stcb,
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) {
sctp_log_map(0, 7, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT);
}
-
stcb->asoc.tsn_last_delivered = stcb->asoc.cumulative_tsn = stcb->asoc.highest_tsn_inside_map;
stcb->asoc.mapping_array_base_tsn = ntohl(resp->senders_next_tsn);
memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size);
@@ -3816,8 +3804,8 @@ sctp_handle_stream_reset_response(struct sctp_tcb *stcb,
stcb->asoc.sending_seq = ntohl(resp->receivers_next_tsn);
stcb->asoc.last_acked_seq = stcb->asoc.cumulative_tsn;
- sctp_reset_out_streams(stcb, 0, (uint16_t *) NULL);
- sctp_reset_in_stream(stcb, 0, (uint16_t *) NULL);
+ sctp_reset_out_streams(stcb, 0, (uint16_t *)NULL);
+ sctp_reset_in_stream(stcb, 0, (uint16_t *)NULL);
sctp_notify_stream_reset_tsn(stcb, stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1), 0);
} else if (action == SCTP_STREAM_RESET_RESULT_DENIED) {
sctp_notify_stream_reset_tsn(stcb, stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1),
@@ -3950,8 +3938,8 @@ sctp_handle_str_reset_request_tsn(struct sctp_tcb *stcb,
asoc->last_sending_seq[0] = asoc->sending_seq;
asoc->last_base_tsnsent[1] = asoc->last_base_tsnsent[0];
asoc->last_base_tsnsent[0] = asoc->mapping_array_base_tsn;
- sctp_reset_out_streams(stcb, 0, (uint16_t *) NULL);
- sctp_reset_in_stream(stcb, 0, (uint16_t *) NULL);
+ sctp_reset_out_streams(stcb, 0, (uint16_t *)NULL);
+ sctp_reset_in_stream(stcb, 0, (uint16_t *)NULL);
asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED;
sctp_notify_stream_reset_tsn(stcb, asoc->sending_seq, (asoc->mapping_array_base_tsn + 1), 0);
}
@@ -4256,7 +4244,7 @@ strres_nochunk:
SCTP_BUF_LEN(chk->data) = SCTP_SIZE32(chk->send_size);
offset += sizeof(struct sctp_chunkhdr);
while (remaining_length >= sizeof(struct sctp_paramhdr)) {
- ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, sizeof(pstore), (uint8_t *) & pstore);
+ ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, sizeof(pstore), (uint8_t *)&pstore);
if (ph == NULL) {
/* TSNH */
break;
@@ -4268,7 +4256,7 @@ strres_nochunk:
break;
}
ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, min(param_len, sizeof(cstore)),
- (uint8_t *) & cstore);
+ (uint8_t *)&cstore);
if (ph == NULL) {
/* TSNH */
break;
@@ -4401,11 +4389,10 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk *cp,
/* XXX possible chlen underflow */
memset(&desc, 0, sizeof(desc));
}
- trunc_len = (uint16_t) ntohs(cp->trunc_len);
+ trunc_len = (uint16_t)ntohs(cp->trunc_len);
if (trunc_len > limit) {
trunc_len = limit;
}
-
/* now the chunks themselves */
while ((ch != NULL) && (chlen >= sizeof(struct sctp_chunkhdr))) {
desc.chunk_type = ch->chunk_type;
@@ -4448,7 +4435,7 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk *cp,
unsigned int iii;
dcp = (struct sctp_data_chunk *)ch;
- ddp = (uint8_t *) (dcp + 1);
+ ddp = (uint8_t *)(dcp + 1);
for (iii = 0; iii < sizeof(desc.data_bytes); iii++) {
desc.data_bytes[iii] = ddp[iii];
}
@@ -4665,7 +4652,6 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length,
*/
SCTP_INP_DECR_REF(inp);
}
-
/* now go back and verify any auth chunk to be sure */
if (auth_skipped && (stcb != NULL)) {
struct sctp_auth_chunk *auth;
@@ -4765,7 +4751,6 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length,
sctp_handle_cookie_ack((struct sctp_cookie_ack_chunk *)ch, stcb,
*netp);
}
-
process_control_chunks:
while (IS_SCTP_CONTROL(ch)) {
/* validate chunk length */
@@ -4805,7 +4790,6 @@ process_control_chunks:
}
return (NULL);
}
-
num_chunks++;
/* Save off the last place we got a control from */
if (stcb != NULL) {
@@ -5172,7 +5156,6 @@ process_control_chunks:
goto abend;
}
}
-
if (netp != NULL) {
struct sctp_tcb *locked_stcb;
@@ -5345,7 +5328,6 @@ process_control_chunks:
*offset = length;
return (stcb);
}
-
if (stcb != NULL) {
int abort_flag = 0;
@@ -5408,7 +5390,6 @@ process_control_chunks:
*offset = length;
return (stcb);
}
-
if ((ch != NULL) && (stcb != NULL) && (netp != NULL) && (*netp != NULL)) {
if (stcb->asoc.pktdrop_supported == 0) {
goto unknown_chunk;
@@ -5466,10 +5447,10 @@ process_control_chunks:
op_err = sctp_get_mbuf_for_msg(sizeof(struct sctp_gen_error_cause),
0, M_NOWAIT, 1, MT_DATA);
if (op_err != NULL) {
- len = min(SCTP_SIZE32(chk_length), (uint32_t) (length - *offset));
+ len = min(SCTP_SIZE32(chk_length), (uint32_t)(length - *offset));
cause = mtod(op_err, struct sctp_gen_error_cause *);
cause->code = htons(SCTP_CAUSE_UNRECOG_CHUNK);
- cause->length = htons((uint16_t) (len + sizeof(struct sctp_gen_error_cause)));
+ cause->length = htons((uint16_t)(len + sizeof(struct sctp_gen_error_cause)));
SCTP_BUF_LEN(op_err) = sizeof(struct sctp_gen_error_cause);
SCTP_BUF_NEXT(op_err) = SCTP_M_COPYM(m, *offset, len, M_NOWAIT);
if (SCTP_BUF_NEXT(op_err) != NULL) {
@@ -5671,7 +5652,6 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
vrf_id, port);
goto out;
}
-
}
if (IS_SCTP_CONTROL(ch)) {
/* process the control portion of the SCTP packet */
@@ -5747,7 +5727,6 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
*/
goto out;
}
-
/*
* DATA chunk processing
*/
@@ -5826,7 +5805,6 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
* process_data
*/
}
-
/* take care of ecn */
if ((data_processed == 1) &&
(stcb->asoc.ecn_supported == 1) &&
@@ -5834,7 +5812,6 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
/* Yep, we need to add a ECNE */
sctp_send_ecn_echo(stcb, net, high_tsn);
}
-
if ((data_processed == 0) && (fwd_tsn_seen)) {
int was_a_gap;
uint32_t highest_tsn;
diff --git a/sys/netinet/sctp_input.h b/sys/netinet/sctp_input.h
index 1a2343b6a907..f393ad8951cd 100644
--- a/sys/netinet/sctp_input.h
+++ b/sys/netinet/sctp_input.h
@@ -52,9 +52,9 @@ struct sctp_stream_reset_request *
sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq,
struct sctp_tmit_chunk **bchk);
-void
+void
sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries,
- uint16_t * list);
+ uint16_t *list);
int sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked);
diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c
index 20cb35e76942..0682514272a6 100644
--- a/sys/netinet/sctp_output.c
+++ b/sys/netinet/sctp_output.c
@@ -1939,7 +1939,7 @@ sctp_is_address_in_scope(struct sctp_ifa *ifa,
}
static struct mbuf *
-sctp_add_addr_to_mbuf(struct mbuf *m, struct sctp_ifa *ifa, uint16_t * len)
+sctp_add_addr_to_mbuf(struct mbuf *m, struct sctp_ifa *ifa, uint16_t *len)
{
#if defined(INET) || defined(INET6)
struct sctp_paramhdr *paramh;
@@ -1950,12 +1950,12 @@ sctp_add_addr_to_mbuf(struct mbuf *m, struct sctp_ifa *ifa, uint16_t * len)
switch (ifa->address.sa.sa_family) {
#ifdef INET
case AF_INET:
- plen = (uint16_t) sizeof(struct sctp_ipv4addr_param);
+ plen = (uint16_t)sizeof(struct sctp_ipv4addr_param);
break;
#endif
#ifdef INET6
case AF_INET6:
- plen = (uint16_t) sizeof(struct sctp_ipv6addr_param);
+ plen = (uint16_t)sizeof(struct sctp_ipv6addr_param);
break;
#endif
default:
@@ -2030,7 +2030,7 @@ struct mbuf *
sctp_add_addresses_to_i_ia(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
struct sctp_scoping *scope,
struct mbuf *m_at, int cnt_inits_to,
- uint16_t * padding_len, uint16_t * chunk_len)
+ uint16_t *padding_len, uint16_t *chunk_len)
{
struct sctp_vrf *vrf = NULL;
int cnt, limit_out = 0, total_count;
@@ -2454,7 +2454,7 @@ sctp_is_addr_in_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa)
static struct sctp_ifa *
sctp_choose_boundspecific_inp(struct sctp_inpcb *inp,
- sctp_route_t * ro,
+ sctp_route_t *ro,
uint32_t vrf_id,
int non_asoc_addr_ok,
uint8_t dest_is_priv,
@@ -2589,7 +2589,7 @@ once_again_too:
static struct sctp_ifa *
sctp_choose_boundspecific_stcb(struct sctp_inpcb *inp,
struct sctp_tcb *stcb,
- sctp_route_t * ro,
+ sctp_route_t *ro,
uint32_t vrf_id,
uint8_t dest_is_priv,
uint8_t dest_is_loop,
@@ -2783,7 +2783,7 @@ sctp_select_nth_preferred_addr_from_ifn_boundall(struct sctp_ifn *ifn,
uint8_t dest_is_priv,
int addr_wanted,
sa_family_t fam,
- sctp_route_t * ro
+ sctp_route_t *ro
)
{
struct sctp_ifa *ifa, *sifa;
@@ -2956,7 +2956,7 @@ static struct sctp_ifa *
sctp_choose_boundall(struct sctp_inpcb *inp,
struct sctp_tcb *stcb,
struct sctp_nets *net,
- sctp_route_t * ro,
+ sctp_route_t *ro,
uint32_t vrf_id,
uint8_t dest_is_priv,
uint8_t dest_is_loop,
@@ -3309,7 +3309,7 @@ out:
struct sctp_ifa *
sctp_source_address_selection(struct sctp_inpcb *inp,
struct sctp_tcb *stcb,
- sctp_route_t * ro,
+ sctp_route_t *ro,
struct sctp_nets *net,
int non_asoc_addr_ok, uint32_t vrf_id)
{
@@ -3822,7 +3822,7 @@ sctp_findassociation_cmsgs(struct sctp_inpcb **inp_p,
static struct mbuf *
sctp_add_cookie(struct mbuf *init, int init_offset,
- struct mbuf *initack, int initack_offset, struct sctp_state_cookie *stc_in, uint8_t * *signature)
+ struct mbuf *initack, int initack_offset, struct sctp_state_cookie *stc_in, uint8_t **signature)
{
struct mbuf *copy_init, *copy_initack, *m_at, *sig, *mret;
struct sctp_state_cookie *stc;
@@ -3901,7 +3901,7 @@ sctp_add_cookie(struct mbuf *init, int init_offset,
SCTP_BUF_LEN(sig) = 0;
SCTP_BUF_NEXT(m_at) = sig;
sig_offset = 0;
- foo = (uint8_t *) (mtod(sig, caddr_t)+sig_offset);
+ foo = (uint8_t *)(mtod(sig, caddr_t)+sig_offset);
memset(foo, 0, SCTP_SIGNATURE_SIZE);
*signature = foo;
SCTP_BUF_LEN(sig) += SCTP_SIGNATURE_SIZE;
@@ -3912,7 +3912,8 @@ sctp_add_cookie(struct mbuf *init, int init_offset,
static uint8_t
-sctp_get_ect(struct sctp_tcb *stcb){
+sctp_get_ect(struct sctp_tcb *stcb)
+{
if ((stcb != NULL) && (stcb->asoc.ecn_supported == 1)) {
return (SCTP_ECT0_BIT);
} else {
@@ -4114,7 +4115,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
memset(&iproute, 0, sizeof(iproute));
memcpy(&ro->ro_dst, to, to->sa_len);
} else {
- ro = (sctp_route_t *) & net->ro;
+ ro = (sctp_route_t *)&net->ro;
}
/* Now the address selection part */
ip->ip_dst.s_addr = ((struct sockaddr_in *)to)->sin_addr.s_addr;
@@ -4177,7 +4178,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
udp = (struct udphdr *)((caddr_t)ip + sizeof(struct ip));
udp->uh_sport = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port));
udp->uh_dport = port;
- udp->uh_ulen = htons((uint16_t) (packet_length - sizeof(struct ip)));
+ udp->uh_ulen = htons((uint16_t)(packet_length - sizeof(struct ip)));
if (V_udp_cksum) {
udp->uh_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP));
} else {
@@ -4215,9 +4216,9 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
memcpy(&iproute, ro, sizeof(*ro));
}
SCTPDBG(SCTP_DEBUG_OUTPUT3, "Calling ipv4 output routine from low level src addr:%x\n",
- (uint32_t) (ntohl(ip->ip_src.s_addr)));
+ (uint32_t)(ntohl(ip->ip_src.s_addr)));
SCTPDBG(SCTP_DEBUG_OUTPUT3, "Destination is %x\n",
- (uint32_t) (ntohl(ip->ip_dst.s_addr)));
+ (uint32_t)(ntohl(ip->ip_dst.s_addr)));
SCTPDBG(SCTP_DEBUG_OUTPUT3, "RTP route is %p through\n",
(void *)ro->ro_rt);
@@ -4363,10 +4364,10 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
}
if (net == NULL) {
memset(&ip6route, 0, sizeof(ip6route));
- ro = (sctp_route_t *) & ip6route;
+ ro = (sctp_route_t *)&ip6route;
memcpy(&ro->ro_dst, sin6, sin6->sin6_len);
} else {
- ro = (sctp_route_t *) & net->ro;
+ ro = (sctp_route_t *)&net->ro;
}
/*
* We assume here that inp_flow is in host byte
@@ -4514,7 +4515,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
udp = (struct udphdr *)((caddr_t)ip6h + sizeof(struct ip6_hdr));
udp->uh_sport = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port));
udp->uh_dport = port;
- udp->uh_ulen = htons((uint16_t) (packet_length - sizeof(struct ip6_hdr)));
+ udp->uh_ulen = htons((uint16_t)(packet_length - sizeof(struct ip6_hdr)));
udp->uh_sum = 0;
sctphdr = (struct sctphdr *)((caddr_t)udp + sizeof(struct udphdr));
} else {
@@ -4715,7 +4716,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked
SCTPDBG(SCTP_DEBUG_OUTPUT4, "Sending INIT - mbuf?\n");
return;
}
- chunk_len = (uint16_t) sizeof(struct sctp_init_chunk);
+ chunk_len = (uint16_t)sizeof(struct sctp_init_chunk);
padding_len = 0;
/* Now lets put the chunk header in place */
init = mtod(m, struct sctp_init_chunk *);
@@ -4735,7 +4736,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked
/* Adaptation layer indication parameter */
if (inp->sctp_ep.adaptation_layer_indicator_provided) {
- parameter_len = (uint16_t) sizeof(struct sctp_adaptation_layer_indication);
+ parameter_len = (uint16_t)sizeof(struct sctp_adaptation_layer_indication);
ali = (struct sctp_adaptation_layer_indication *)(mtod(m, caddr_t)+chunk_len);
ali->ph.param_type = htons(SCTP_ULP_ADAPTATION);
ali->ph.param_length = htons(parameter_len);
@@ -4745,7 +4746,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked
/* ECN parameter */
if (stcb->asoc.ecn_supported == 1) {
- parameter_len = (uint16_t) sizeof(struct sctp_paramhdr);
+ parameter_len = (uint16_t)sizeof(struct sctp_paramhdr);
ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len);
ph->param_type = htons(SCTP_ECN_CAPABLE);
ph->param_length = htons(parameter_len);
@@ -4754,7 +4755,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked
/* PR-SCTP supported parameter */
if (stcb->asoc.prsctp_supported == 1) {
- parameter_len = (uint16_t) sizeof(struct sctp_paramhdr);
+ parameter_len = (uint16_t)sizeof(struct sctp_paramhdr);
ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len);
ph->param_type = htons(SCTP_PRSCTP_SUPPORTED);
ph->param_length = htons(parameter_len);
@@ -4763,7 +4764,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked
/* Add NAT friendly parameter. */
if (SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly)) {
- parameter_len = (uint16_t) sizeof(struct sctp_paramhdr);
+ parameter_len = (uint16_t)sizeof(struct sctp_paramhdr);
ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len);
ph->param_type = htons(SCTP_HAS_NAT_SUPPORT);
ph->param_length = htons(parameter_len);
@@ -4799,7 +4800,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked
pr_supported->chunk_types[num_ext++] = SCTP_PACKET_DROPPED;
}
if (num_ext > 0) {
- parameter_len = (uint16_t) sizeof(struct sctp_supported_chunk_types_param) + num_ext;
+ parameter_len = (uint16_t)sizeof(struct sctp_supported_chunk_types_param) + num_ext;
pr_supported->ph.param_type = htons(SCTP_SUPPORTED_CHUNK_EXT);
pr_supported->ph.param_length = htons(parameter_len);
padding_len = SCTP_SIZE32(parameter_len) - parameter_len;
@@ -4817,7 +4818,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked
padding_len = 0;
}
randp = (struct sctp_auth_random *)(mtod(m, caddr_t)+chunk_len);
- parameter_len = (uint16_t) sizeof(struct sctp_auth_random) + stcb->asoc.authinfo.random_len;
+ parameter_len = (uint16_t)sizeof(struct sctp_auth_random) + stcb->asoc.authinfo.random_len;
/* random key already contains the header */
memcpy(randp, stcb->asoc.authinfo.random->key, parameter_len);
padding_len = SCTP_SIZE32(parameter_len) - parameter_len;
@@ -4833,11 +4834,11 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked
padding_len = 0;
}
hmacs = (struct sctp_auth_hmac_algo *)(mtod(m, caddr_t)+chunk_len);
- parameter_len = (uint16_t) (sizeof(struct sctp_auth_hmac_algo) +
+ parameter_len = (uint16_t)(sizeof(struct sctp_auth_hmac_algo) +
stcb->asoc.local_hmacs->num_algo * sizeof(uint16_t));
hmacs->ph.param_type = htons(SCTP_HMAC_LIST);
hmacs->ph.param_length = htons(parameter_len);
- sctp_serialize_hmaclist(stcb->asoc.local_hmacs, (uint8_t *) hmacs->hmac_ids);
+ sctp_serialize_hmaclist(stcb->asoc.local_hmacs, (uint8_t *)hmacs->hmac_ids);
padding_len = SCTP_SIZE32(parameter_len) - parameter_len;
chunk_len += parameter_len;
}
@@ -4851,7 +4852,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked
padding_len = 0;
}
chunks = (struct sctp_auth_chunk_list *)(mtod(m, caddr_t)+chunk_len);
- parameter_len = (uint16_t) (sizeof(struct sctp_auth_chunk_list) +
+ parameter_len = (uint16_t)(sizeof(struct sctp_auth_chunk_list) +
sctp_auth_get_chklist_size(stcb->asoc.local_auth_chunks));
chunks->ph.param_type = htons(SCTP_CHUNK_LIST);
chunks->ph.param_length = htons(parameter_len);
@@ -4870,7 +4871,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked
chunk_len += padding_len;
padding_len = 0;
}
- parameter_len = (uint16_t) sizeof(struct sctp_cookie_perserve_param);
+ parameter_len = (uint16_t)sizeof(struct sctp_cookie_perserve_param);
cookie_preserve = (struct sctp_cookie_perserve_param *)(mtod(m, caddr_t)+chunk_len);
cookie_preserve->ph.param_type = htons(SCTP_COOKIE_PRESERVE);
cookie_preserve->ph.param_length = htons(parameter_len);
@@ -4887,12 +4888,12 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked
chunk_len += padding_len;
padding_len = 0;
}
- parameter_len = (uint16_t) sizeof(struct sctp_paramhdr);
+ parameter_len = (uint16_t)sizeof(struct sctp_paramhdr);
if (stcb->asoc.scope.ipv4_addr_legal) {
- parameter_len += (uint16_t) sizeof(uint16_t);
+ parameter_len += (uint16_t)sizeof(uint16_t);
}
if (stcb->asoc.scope.ipv6_addr_legal) {
- parameter_len += (uint16_t) sizeof(uint16_t);
+ parameter_len += (uint16_t)sizeof(uint16_t);
}
sup_addr = (struct sctp_supported_addr_param *)(mtod(m, caddr_t)+chunk_len);
sup_addr->ph.param_type = htons(SCTP_SUPPORTED_ADDRTYPE);
@@ -5588,7 +5589,7 @@ do_a_abort:
sctp_m_freem(op_err);
return;
}
- chunk_len = (uint16_t) sizeof(struct sctp_init_ack_chunk);
+ chunk_len = (uint16_t)sizeof(struct sctp_init_ack_chunk);
padding_len = 0;
/*
@@ -5772,7 +5773,7 @@ do_a_abort:
* did the selection.
*/
net->ro._s_addr = sctp_source_address_selection(inp,
- stcb, (sctp_route_t *) & net->ro,
+ stcb, (sctp_route_t *)&net->ro,
net, 0, vrf_id);
if (net->ro._s_addr == NULL)
return;
@@ -5802,7 +5803,7 @@ do_a_abort:
* done the selection.
*/
net->ro._s_addr = sctp_source_address_selection(inp,
- stcb, (sctp_route_t *) & net->ro,
+ stcb, (sctp_route_t *)&net->ro,
net, 0, vrf_id);
if (net->ro._s_addr == NULL)
return;
@@ -5906,7 +5907,7 @@ do_a_abort:
/* adaptation layer indication parameter */
if (inp->sctp_ep.adaptation_layer_indicator_provided) {
- parameter_len = (uint16_t) sizeof(struct sctp_adaptation_layer_indication);
+ parameter_len = (uint16_t)sizeof(struct sctp_adaptation_layer_indication);
ali = (struct sctp_adaptation_layer_indication *)(mtod(m, caddr_t)+chunk_len);
ali->ph.param_type = htons(SCTP_ULP_ADAPTATION);
ali->ph.param_length = htons(parameter_len);
@@ -5917,7 +5918,7 @@ do_a_abort:
/* ECN parameter */
if (((asoc != NULL) && (asoc->ecn_supported == 1)) ||
((asoc == NULL) && (inp->ecn_supported == 1))) {
- parameter_len = (uint16_t) sizeof(struct sctp_paramhdr);
+ parameter_len = (uint16_t)sizeof(struct sctp_paramhdr);
ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len);
ph->param_type = htons(SCTP_ECN_CAPABLE);
ph->param_length = htons(parameter_len);
@@ -5927,7 +5928,7 @@ do_a_abort:
/* PR-SCTP supported parameter */
if (((asoc != NULL) && (asoc->prsctp_supported == 1)) ||
((asoc == NULL) && (inp->prsctp_supported == 1))) {
- parameter_len = (uint16_t) sizeof(struct sctp_paramhdr);
+ parameter_len = (uint16_t)sizeof(struct sctp_paramhdr);
ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len);
ph->param_type = htons(SCTP_PRSCTP_SUPPORTED);
ph->param_length = htons(parameter_len);
@@ -5936,7 +5937,7 @@ do_a_abort:
/* Add NAT friendly parameter */
if (nat_friendly) {
- parameter_len = (uint16_t) sizeof(struct sctp_paramhdr);
+ parameter_len = (uint16_t)sizeof(struct sctp_paramhdr);
ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len);
ph->param_type = htons(SCTP_HAS_NAT_SUPPORT);
ph->param_length = htons(parameter_len);
@@ -5980,7 +5981,7 @@ do_a_abort:
pr_supported->chunk_types[num_ext++] = SCTP_PACKET_DROPPED;
}
if (num_ext > 0) {
- parameter_len = (uint16_t) sizeof(struct sctp_supported_chunk_types_param) + num_ext;
+ parameter_len = (uint16_t)sizeof(struct sctp_supported_chunk_types_param) + num_ext;
pr_supported->ph.param_type = htons(SCTP_SUPPORTED_CHUNK_EXT);
pr_supported->ph.param_length = htons(parameter_len);
padding_len = SCTP_SIZE32(parameter_len) - parameter_len;
@@ -6001,7 +6002,7 @@ do_a_abort:
}
/* generate and add RANDOM parameter */
randp = (struct sctp_auth_random *)(mtod(m, caddr_t)+chunk_len);
- parameter_len = (uint16_t) sizeof(struct sctp_auth_random) +
+ parameter_len = (uint16_t)sizeof(struct sctp_auth_random) +
SCTP_AUTH_RANDOM_SIZE_DEFAULT;
randp->ph.param_type = htons(SCTP_RANDOM);
randp->ph.param_length = htons(parameter_len);
@@ -6016,9 +6017,9 @@ do_a_abort:
}
/* add HMAC_ALGO parameter */
hmacs = (struct sctp_auth_hmac_algo *)(mtod(m, caddr_t)+chunk_len);
- parameter_len = (uint16_t) sizeof(struct sctp_auth_hmac_algo) +
+ parameter_len = (uint16_t)sizeof(struct sctp_auth_hmac_algo) +
sctp_serialize_hmaclist(inp->sctp_ep.local_hmacs,
- (uint8_t *) hmacs->hmac_ids);
+ (uint8_t *)hmacs->hmac_ids);
hmacs->ph.param_type = htons(SCTP_HMAC_LIST);
hmacs->ph.param_length = htons(parameter_len);
padding_len = SCTP_SIZE32(parameter_len) - parameter_len;
@@ -6031,7 +6032,7 @@ do_a_abort:
}
/* add CHUNKS parameter */
chunks = (struct sctp_auth_chunk_list *)(mtod(m, caddr_t)+chunk_len);
- parameter_len = (uint16_t) sizeof(struct sctp_auth_chunk_list) +
+ parameter_len = (uint16_t)sizeof(struct sctp_auth_chunk_list) +
sctp_serialize_auth_chunks(inp->sctp_ep.local_auth_chunks,
chunks->chunk_types);
chunks->ph.param_type = htons(SCTP_CHUNK_LIST);
@@ -6118,9 +6119,9 @@ do_a_abort:
* though thus we set trailer.
*/
(void)sctp_hmac_m(SCTP_HMAC,
- (uint8_t *) inp->sctp_ep.secret_key[(int)(inp->sctp_ep.current_secret_number)],
+ (uint8_t *)inp->sctp_ep.secret_key[(int)(inp->sctp_ep.current_secret_number)],
SCTP_SECRET_SIZE, m_cookie, sizeof(struct sctp_paramhdr),
- (uint8_t *) signature, SCTP_SIGNATURE_SIZE);
+ (uint8_t *)signature, SCTP_SIGNATURE_SIZE);
/*
* We sifa 0 here to NOT set IP_DF if its IPv4, we ignore the return
* here since the timer will drive a retranmission.
@@ -6657,7 +6658,7 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr,
ph = mtod(m, struct sctp_paramhdr *);
ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT);
- ph->param_length = htons((uint16_t) (sizeof(struct sctp_paramhdr) + ca->sndlen));
+ ph->param_length = htons((uint16_t)(sizeof(struct sctp_paramhdr) + ca->sndlen));
}
/*
* We add one here to keep the assoc from dis-appearing on
@@ -7026,7 +7027,7 @@ all_done:
sctp_misc_ints(SCTP_FLIGHT_LOG_UP,
data_list[i]->whoTo->flight_size,
data_list[i]->book_size,
- (uint32_t) (uintptr_t) data_list[i]->whoTo,
+ (uint32_t)(uintptr_t)data_list[i]->whoTo,
data_list[i]->rec.data.tsn);
}
sctp_flight_size_increase(data_list[i]);
@@ -7036,7 +7037,7 @@ all_done:
asoc->peers_rwnd, data_list[i]->send_size, SCTP_BASE_SYSCTL(sctp_peer_chunk_oh));
}
asoc->peers_rwnd = sctp_sbspace_sub(asoc->peers_rwnd,
- (uint32_t) (data_list[i]->send_size + SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)));
+ (uint32_t)(data_list[i]->send_size + SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)));
if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
/* SWS sender side engages */
asoc->peers_rwnd = 0;
@@ -7092,7 +7093,8 @@ sctp_clean_up_ctl(struct sctp_tcb *stcb, struct sctp_association *asoc, int so_l
static uint32_t
sctp_can_we_split_this(struct sctp_tcb *stcb, uint32_t length,
- uint32_t space_left, uint32_t frag_point, int eeor_on){
+ uint32_t space_left, uint32_t frag_point, int eeor_on)
+{
/*
* Make a decision on if I should split a msg into multiple parts.
* This is only asked of incomplete messages.
@@ -7160,7 +7162,8 @@ sctp_move_to_outqueue(struct sctp_tcb *stcb,
#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
SCTP_UNUSED
#endif
-){
+)
+{
/* Move from the stream to the send_queue keeping track of the total */
struct sctp_association *asoc;
struct sctp_stream_queue_pending *sp;
@@ -7517,7 +7520,7 @@ dont_do_it:
goto out_of;
}
sctp_snd_sb_alloc(stcb, SCTP_DATA_CHUNK_OVERHEAD(stcb));
- chk->book_size = chk->send_size = (uint16_t) (to_move + SCTP_DATA_CHUNK_OVERHEAD(stcb));
+ chk->book_size = chk->send_size = (uint16_t)(to_move + SCTP_DATA_CHUNK_OVERHEAD(stcb));
chk->book_size_scale = 0;
chk->sent = SCTP_DATAGRAM_UNSENT;
@@ -7570,8 +7573,8 @@ dont_do_it:
chk->rec.data.tsn = atomic_fetchadd_int(&asoc->sending_seq, 1);
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_AT_SEND_2_OUTQ) {
sctp_misc_ints(SCTP_STRMOUT_LOG_SEND,
- (uint32_t) (uintptr_t) stcb, sp->length,
- (uint32_t) ((chk->rec.data.sid << 16) | (0x0000ffff & chk->rec.data.mid)),
+ (uint32_t)(uintptr_t)stcb, sp->length,
+ (uint32_t)((chk->rec.data.sid << 16) | (0x0000ffff & chk->rec.data.mid)),
chk->rec.data.tsn);
}
if (stcb->asoc.idata_supported == 0) {
@@ -7605,7 +7608,7 @@ dont_do_it:
dchkh->ch.chunk_flags = chk->rec.data.rcv_flags;
dchkh->dp.tsn = htonl(chk->rec.data.tsn);
dchkh->dp.sid = htons(strq->sid);
- dchkh->dp.ssn = htons((uint16_t) chk->rec.data.mid);
+ dchkh->dp.ssn = htons((uint16_t)chk->rec.data.mid);
dchkh->dp.ppid = chk->rec.data.ppid;
dchkh->ch.chunk_length = htons(chk->send_size);
} else {
@@ -8959,7 +8962,7 @@ sctp_queue_op_err(struct sctp_tcb *stcb, struct mbuf *op_err)
return;
}
chk->copy_by_ref = 0;
- chk->send_size = (uint16_t) chunk_length;
+ chk->send_size = (uint16_t)chunk_length;
chk->sent = SCTP_DATAGRAM_UNSENT;
chk->snd_count = 0;
chk->asoc = &stcb->asoc;
@@ -9881,14 +9884,14 @@ one_chunk_around:
asoc->peers_rwnd, data_list[i]->send_size, SCTP_BASE_SYSCTL(sctp_peer_chunk_oh));
}
asoc->peers_rwnd = sctp_sbspace_sub(asoc->peers_rwnd,
- (uint32_t) (data_list[i]->send_size +
+ (uint32_t)(data_list[i]->send_size +
SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)));
}
if (SCTP_BASE_SYSCTL(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,
- (uint32_t) (uintptr_t) data_list[i]->whoTo,
+ (uint32_t)(uintptr_t)data_list[i]->whoTo,
data_list[i]->rec.data.tsn);
}
sctp_flight_size_increase(data_list[i]);
@@ -10482,7 +10485,7 @@ sctp_fill_in_rest:
strseq_m++;
} else {
strseq->sid = htons(at->rec.data.sid);
- strseq->ssn = htons((uint16_t) at->rec.data.mid);
+ strseq->ssn = htons((uint16_t)at->rec.data.mid);
strseq++;
}
i++;
@@ -10837,7 +10840,7 @@ sctp_send_sack(struct sctp_tcb *stcb, int so_locked
}
/* now we must add any dups we are going to report. */
if ((limit_reached == 0) && (asoc->numduptsns)) {
- dup = (uint32_t *) gap_descriptor;
+ dup = (uint32_t *)gap_descriptor;
for (i = 0; i < asoc->numduptsns; i++) {
*dup = htonl(asoc->dup_tsns[i]);
dup++;
@@ -10854,7 +10857,7 @@ sctp_send_sack(struct sctp_tcb *stcb, int so_locked
* queue.
*/
if (type == SCTP_SELECTIVE_ACK) {
- a_chk->send_size = (uint16_t) (sizeof(struct sctp_sack_chunk) +
+ a_chk->send_size = (uint16_t)(sizeof(struct sctp_sack_chunk) +
(num_gap_blocks + num_nr_gap_blocks) * sizeof(struct sctp_gap_ack_block) +
num_dups * sizeof(int32_t));
SCTP_BUF_LEN(a_chk->data) = a_chk->send_size;
@@ -10866,7 +10869,7 @@ sctp_send_sack(struct sctp_tcb *stcb, int so_locked
sack->ch.chunk_flags = flags;
sack->ch.chunk_length = htons(a_chk->send_size);
} else {
- a_chk->send_size = (uint16_t) (sizeof(struct sctp_nr_sack_chunk) +
+ a_chk->send_size = (uint16_t)(sizeof(struct sctp_nr_sack_chunk) +
(num_gap_blocks + num_nr_gap_blocks) * sizeof(struct sctp_gap_ack_block) +
num_dups * sizeof(int32_t));
SCTP_BUF_LEN(a_chk->data) = a_chk->send_size;
@@ -10933,13 +10936,13 @@ sctp_send_abort_tcb(struct sctp_tcb *stcb, struct mbuf *operr, int so_locked
cause_len = 0;
m_last = NULL;
for (m = operr; m; m = SCTP_BUF_NEXT(m)) {
- cause_len += (uint16_t) SCTP_BUF_LEN(m);
+ cause_len += (uint16_t)SCTP_BUF_LEN(m);
if (SCTP_BUF_NEXT(m) == NULL) {
m_last = m;
}
}
SCTP_BUF_LEN(m_abort) = sizeof(struct sctp_abort_chunk);
- chunk_len = (uint16_t) sizeof(struct sctp_abort_chunk) + cause_len;
+ chunk_len = (uint16_t)sizeof(struct sctp_abort_chunk) + cause_len;
padding_len = SCTP_SIZE32(chunk_len) - chunk_len;
if (m_out == NULL) {
/* NO Auth chunk prepended, so reserve space in front */
@@ -11188,7 +11191,7 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst,
udp->uh_sport = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port));
udp->uh_dport = port;
udp->uh_sum = 0;
- udp->uh_ulen = htons((uint16_t) (sizeof(struct udphdr) +
+ udp->uh_ulen = htons((uint16_t)(sizeof(struct udphdr) +
sizeof(struct sctphdr) +
sizeof(struct sctp_chunkhdr) +
cause_len + padding_len));
@@ -11214,7 +11217,7 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst,
} else {
ch->chunk_flags = SCTP_HAD_NO_TCB;
}
- ch->chunk_length = htons((uint16_t) (sizeof(struct sctp_chunkhdr) + cause_len));
+ ch->chunk_length = htons((uint16_t)(sizeof(struct sctp_chunkhdr) + cause_len));
len += sizeof(struct sctp_chunkhdr);
len += cause_len + padding_len;
@@ -11368,7 +11371,7 @@ sctp_send_hb(struct sctp_tcb *stcb, struct sctp_nets *net, int so_locked
hb->heartbeat.hb_info.time_value_1 = 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;
+ hb->heartbeat.hb_info.addr_family = (uint8_t)net->ro._l_addr.sa.sa_family;
hb->heartbeat.hb_info.addr_len = net->ro._l_addr.sa.sa_len;
if (net->dest_state & SCTP_ADDR_UNCONFIRMED) {
/*
@@ -11519,7 +11522,7 @@ sctp_send_packet_dropped(struct sctp_tcb *stcb, struct sctp_nets *net,
/* Validate that we do not have an ABORT in here. */
offset = iphlen + sizeof(struct sctphdr);
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)) {
@@ -11543,7 +11546,7 @@ sctp_send_packet_dropped(struct sctp_tcb *stcb, struct sctp_nets *net,
}
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 ((len + SCTP_MAX_OVERHEAD + sizeof(struct sctp_pktdrop_chunk)) >
@@ -11579,7 +11582,7 @@ jump_out:
* Len is already adjusted to size minus overhead above take
* out the pkt_drop chunk itself from it.
*/
- chk->send_size = (uint16_t) (len - sizeof(struct sctp_pktdrop_chunk));
+ chk->send_size = (uint16_t)(len - sizeof(struct sctp_pktdrop_chunk));
len = chk->send_size;
} else {
/* no truncation needed */
@@ -11719,7 +11722,7 @@ sctp_add_stream_reset_out(struct sctp_tcb *stcb, struct sctp_tmit_chunk *chk,
if (number_entries > SCTP_MAX_STREAMS_AT_ONCE_RESET) {
number_entries = SCTP_MAX_STREAMS_AT_ONCE_RESET;
}
- len = (uint16_t) (sizeof(struct sctp_stream_reset_out_request) + (sizeof(uint16_t) * number_entries));
+ len = (uint16_t)(sizeof(struct sctp_stream_reset_out_request) + (sizeof(uint16_t) * number_entries));
req_out->ph.param_type = htons(SCTP_STR_RESET_OUT_REQUEST);
req_out->ph.param_length = htons(len);
req_out->request_seq = htonl(seq);
@@ -11763,7 +11766,7 @@ sctp_add_stream_reset_out(struct sctp_tcb *stcb, struct sctp_tmit_chunk *chk,
static void
sctp_add_stream_reset_in(struct sctp_tmit_chunk *chk,
- int number_entries, uint16_t * list,
+ int number_entries, uint16_t *list,
uint32_t seq)
{
uint16_t len, old_len, i;
@@ -11776,7 +11779,7 @@ sctp_add_stream_reset_in(struct sctp_tmit_chunk *chk,
/* get to new offset for the param. */
req_in = (struct sctp_stream_reset_in_request *)((caddr_t)ch + len);
/* now how long will this param be? */
- len = (uint16_t) (sizeof(struct sctp_stream_reset_in_request) + (sizeof(uint16_t) * number_entries));
+ len = (uint16_t)(sizeof(struct sctp_stream_reset_in_request) + (sizeof(uint16_t) * number_entries));
req_in->ph.param_type = htons(SCTP_STR_RESET_IN_REQUEST);
req_in->ph.param_length = htons(len);
req_in->request_seq = htonl(seq);
@@ -12092,7 +12095,7 @@ sctp_send_stream_reset_out_if_possible(struct sctp_tcb *stcb, int so_locked)
int
sctp_send_str_reset_req(struct sctp_tcb *stcb,
- uint16_t number_entries, uint16_t * list,
+ uint16_t number_entries, uint16_t *list,
uint8_t send_in_req,
uint8_t send_tsn_req,
uint8_t add_stream,
@@ -12327,7 +12330,7 @@ sctp_copy_resume(struct uio *uio,
int max_send_len,
int user_marks_eor,
int *error,
- uint32_t * sndout,
+ uint32_t *sndout,
struct mbuf **new_tail)
{
struct mbuf *m;
@@ -12410,8 +12413,8 @@ sctp_copy_it_in(struct sctp_tcb *stcb,
(void)SCTP_GETTIME_TIMEVAL(&sp->ts);
sp->sid = srcv->sinfo_stream;
- sp->length = (uint32_t) min(uio->uio_resid, max_send_len);
- if ((sp->length == (uint32_t) uio->uio_resid) &&
+ sp->length = (uint32_t)min(uio->uio_resid, max_send_len);
+ if ((sp->length == (uint32_t)uio->uio_resid) &&
((user_marks_eor == 0) ||
(srcv->sinfo_flags & SCTP_EOF) ||
(user_marks_eor && (srcv->sinfo_flags & SCTP_EOR)))) {
@@ -12975,7 +12978,7 @@ sctp_lower_sosend(struct socket *so,
/* now move forward the data pointer */
ph = mtod(mm, struct sctp_paramhdr *);
ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT);
- ph->param_length = htons((uint16_t) (sizeof(struct sctp_paramhdr) + tot_out));
+ ph->param_length = htons((uint16_t)(sizeof(struct sctp_paramhdr) + tot_out));
ph++;
SCTP_BUF_LEN(mm) = tot_out + sizeof(struct sctp_paramhdr);
if (top == NULL) {
@@ -13709,7 +13712,7 @@ out_unlocked:
*/
struct mbuf *
sctp_add_auth_chunk(struct mbuf *m, struct mbuf **m_end,
- struct sctp_auth_chunk **auth_ret, uint32_t * offset,
+ struct sctp_auth_chunk **auth_ret, uint32_t *offset,
struct sctp_tcb *stcb, uint8_t chunk)
{
struct mbuf *m_auth;
@@ -13764,7 +13767,7 @@ sctp_add_auth_chunk(struct mbuf *m, struct mbuf **m_end,
#ifdef INET6
int
-sctp_v6src_match_nexthop(struct sockaddr_in6 *src6, sctp_route_t * ro)
+sctp_v6src_match_nexthop(struct sockaddr_in6 *src6, sctp_route_t *ro)
{
struct nd_prefix *pfx = NULL;
struct nd_pfxrouter *pfxrtr = NULL;
@@ -13817,7 +13820,7 @@ sctp_v6src_match_nexthop(struct sockaddr_in6 *src6, sctp_route_t * ro)
#endif
int
-sctp_v4src_match_nexthop(struct sctp_ifa *sifa, sctp_route_t * ro)
+sctp_v4src_match_nexthop(struct sctp_ifa *sifa, sctp_route_t *ro)
{
#ifdef INET
struct sockaddr_in *sin, *mask;
diff --git a/sys/netinet/sctp_output.h b/sys/netinet/sctp_output.h
index 4d8930f57417..e6222e3f942c 100644
--- a/sys/netinet/sctp_output.h
+++ b/sys/netinet/sctp_output.h
@@ -49,7 +49,7 @@ sctp_add_addresses_to_i_ia(struct sctp_inpcb *inp,
struct sctp_scoping *scope,
struct mbuf *m_at,
int cnt_inits_to,
- uint16_t * padding_len, uint16_t * chunk_len);
+ uint16_t *padding_len, uint16_t *chunk_len);
int sctp_is_addr_restricted(struct sctp_tcb *, struct sctp_ifa *);
@@ -66,15 +66,15 @@ int
struct sctp_ifa *
sctp_source_address_selection(struct sctp_inpcb *inp,
struct sctp_tcb *stcb,
- sctp_route_t * ro, struct sctp_nets *net,
+ sctp_route_t *ro, struct sctp_nets *net,
int non_asoc_addr_ok, uint32_t vrf_id);
int
- sctp_v6src_match_nexthop(struct sockaddr_in6 *src6, sctp_route_t * ro);
+ sctp_v6src_match_nexthop(struct sockaddr_in6 *src6, sctp_route_t *ro);
int
- sctp_v4src_match_nexthop(struct sctp_ifa *sifa, sctp_route_t * ro);
+ sctp_v4src_match_nexthop(struct sctp_ifa *sifa, sctp_route_t *ro);
-void
+void
sctp_send_initiate(struct sctp_inpcb *, struct sctp_tcb *, int
#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
SCTP_UNUSED
@@ -117,7 +117,7 @@ void sctp_send_shutdown_ack(struct sctp_tcb *, struct sctp_nets *);
void sctp_send_shutdown_complete(struct sctp_tcb *, struct sctp_nets *, int);
-void
+void
sctp_send_shutdown_complete2(struct sockaddr *, struct sockaddr *,
struct sctphdr *,
uint8_t, uint32_t, uint16_t,
@@ -146,13 +146,13 @@ int
sctp_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *,
struct mbuf *, struct thread *, int);
-void
+void
sctp_chunk_output(struct sctp_inpcb *, struct sctp_tcb *, int, int
#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
SCTP_UNUSED
#endif
);
-void
+void
sctp_send_abort_tcb(struct sctp_tcb *, struct mbuf *, int
#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
SCTP_UNUSED
@@ -201,7 +201,7 @@ sctp_send_abort(struct mbuf *, int, struct sockaddr *, struct sockaddr *,
uint8_t, uint32_t, uint16_t,
uint32_t, uint16_t);
-void
+void
sctp_send_operr_to(struct sockaddr *, struct sockaddr *,
struct sctphdr *, uint32_t, struct mbuf *,
uint8_t, uint32_t, uint16_t,
diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c
index 1343327a6e56..efe31a4f53b8 100644
--- a/sys/netinet/sctp_pcb.c
+++ b/sys/netinet/sctp_pcb.c
@@ -185,7 +185,6 @@ sctp_allocate_vrf(int vrf_id)
SCTP_FREE(vrf, SCTP_M_VRF);
return (NULL);
}
-
/* Add it to the hash table */
bucket = &SCTP_BASE_INFO(sctp_vrfhash)[(vrf_id & SCTP_BASE_INFO(hashvrfmark))];
LIST_INSERT_HEAD(bucket, vrf, next_vrf);
@@ -737,7 +736,6 @@ sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockaddr *addr,
SCTPDBG(SCTP_DEBUG_PCB4, "Can't find vrf_id 0x%x\n", vrf_id);
goto out_now;
}
-
#ifdef SCTP_DEBUG
SCTPDBG(SCTP_DEBUG_PCB4, "vrf_id 0x%x: deleting address:", vrf_id);
SCTPDBG_ADDR(SCTP_DEBUG_PCB4, addr);
@@ -866,7 +864,6 @@ sctp_does_stcb_own_this_addr(struct sctp_tcb *stcb, struct sockaddr *to)
SCTP_IPI_ADDR_RUNLOCK();
return (0);
}
-
if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) {
if ((loopback_scope == 0) &&
@@ -1028,7 +1025,6 @@ sctp_tcb_special_locate(struct sctp_inpcb **inp_p, struct sockaddr *from,
if ((to == NULL) || (from == NULL)) {
return (NULL);
}
-
switch (to->sa_family) {
#ifdef INET
case AF_INET:
@@ -1391,7 +1387,6 @@ sctp_findassociation_ep_addr(struct sctp_inpcb **inp_p, struct sockaddr *remote,
if (locked_tcb) {
atomic_subtract_int(&locked_tcb->asoc.refcnt, 1);
}
-
SCTP_INP_WUNLOCK(inp);
SCTP_INP_INFO_RUNLOCK();
return (stcb);
@@ -1572,7 +1567,7 @@ sctp_findasoc_ep_asocid_locked(struct sctp_inpcb *inp, sctp_assoc_t asoc_id, int
SCTP_PRINTF("TSNH ep_associd0\n");
return (NULL);
}
- id = (uint32_t) asoc_id;
+ id = (uint32_t)asoc_id;
head = &inp->sctp_asocidhash[SCTP_PCBHASH_ASOC(id, inp->hashasocidmark)];
if (head == NULL) {
/* invalid id TSNH */
@@ -2257,7 +2252,6 @@ sctp_findassociation_addr(struct mbuf *m, int offset,
return (stcb);
}
}
-
if (inp_p) {
stcb = sctp_findassociation_addr_sa(src, dst, inp_p, netp,
1, vrf_id);
@@ -2325,7 +2319,7 @@ sctp_findassociation_ep_asconf(struct mbuf *m, int offset,
__func__);
return NULL;
}
- ptype = (int)((uint32_t) ntohs(phdr->param_type));
+ ptype = (int)((uint32_t)ntohs(phdr->param_type));
/* get the correlation address */
switch (ptype) {
#ifdef INET6
@@ -2457,13 +2451,13 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id)
inp->sctp_frag_point = SCTP_DEFAULT_MAXSEGMENT;
inp->max_cwnd = 0;
inp->sctp_cmt_on_off = SCTP_BASE_SYSCTL(sctp_cmt_on_off);
- inp->ecn_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_ecn_enable);
- inp->prsctp_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_pr_enable);
- inp->auth_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_auth_enable);
- inp->asconf_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_asconf_enable);
- inp->reconfig_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_reconfig_enable);
- inp->nrsack_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_nrsack_enable);
- inp->pktdrop_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_pktdrop_enable);
+ inp->ecn_supported = (uint8_t)SCTP_BASE_SYSCTL(sctp_ecn_enable);
+ inp->prsctp_supported = (uint8_t)SCTP_BASE_SYSCTL(sctp_pr_enable);
+ inp->auth_supported = (uint8_t)SCTP_BASE_SYSCTL(sctp_auth_enable);
+ inp->asconf_supported = (uint8_t)SCTP_BASE_SYSCTL(sctp_asconf_enable);
+ inp->reconfig_supported = (uint8_t)SCTP_BASE_SYSCTL(sctp_reconfig_enable);
+ inp->nrsack_supported = (uint8_t)SCTP_BASE_SYSCTL(sctp_nrsack_enable);
+ inp->pktdrop_supported = (uint8_t)SCTP_BASE_SYSCTL(sctp_pktdrop_enable);
inp->idata_supported = 0;
inp->fibnum = so->so_fibnum;
@@ -2853,7 +2847,6 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr,
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL);
return (EINVAL);
}
-
sin = (struct sockaddr_in *)addr;
lport = sin->sin_port;
/*
@@ -3508,7 +3501,6 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from)
LIST_REMOVE(inp, sctp_hash);
inp->sctp_flags |= SCTP_PCB_FLAGS_UNBOUND;
}
-
/*
* If there is a timer running to kill us, forget it, since it may
* have a contest on the INP lock.. which would cause us to die ...
@@ -3641,8 +3633,6 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from)
(void)sctp_m_free(ip_pcb->inp_options);
ip_pcb->inp_options = 0;
}
-
-
#ifdef INET6
if (ip_pcb->inp_vflag & INP_IPV6) {
struct in6pcb *in6p;
@@ -3942,7 +3932,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
sin6->sin6_scope_id = 0;
}
#endif
- SCTP_RTALLOC((sctp_route_t *) & net->ro,
+ SCTP_RTALLOC((sctp_route_t *)&net->ro,
stcb->asoc.vrf_id,
stcb->sctp_ep->fibnum);
@@ -3951,7 +3941,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
/* Get source address */
net->ro._s_addr = sctp_source_address_selection(stcb->sctp_ep,
stcb,
- (sctp_route_t *) & net->ro,
+ (sctp_route_t *)&net->ro,
net,
0,
stcb->asoc.vrf_id);
@@ -3973,7 +3963,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
}
#if defined(INET) || defined(INET6)
if (net->port) {
- net->mtu += (uint32_t) sizeof(struct udphdr);
+ net->mtu += (uint32_t)sizeof(struct udphdr);
}
#endif
} else if (net->ro._s_addr != NULL) {
@@ -4018,7 +4008,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
}
#if defined(INET) || defined(INET6)
if (net->port) {
- net->mtu += (uint32_t) sizeof(struct udphdr);
+ net->mtu += (uint32_t)sizeof(struct udphdr);
}
#endif
} else {
@@ -4040,7 +4030,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
}
#if defined(INET) || defined(INET6)
if (net->port) {
- net->mtu -= (uint32_t) sizeof(struct udphdr);
+ net->mtu -= (uint32_t)sizeof(struct udphdr);
}
#endif
if (from == SCTP_ALLOC_ASOC) {
@@ -4152,7 +4142,8 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
static uint32_t
-sctp_aloc_a_assoc_id(struct sctp_inpcb *inp, struct sctp_tcb *stcb){
+sctp_aloc_a_assoc_id(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
+{
uint32_t id;
struct sctpasochead *head;
struct sctp_tcb *lstcb;
@@ -4173,7 +4164,7 @@ try_again:
}
id = inp->sctp_associd_counter;
inp->sctp_associd_counter++;
- lstcb = sctp_findasoc_ep_asocid_locked(inp, (sctp_assoc_t) id, 0);
+ lstcb = sctp_findasoc_ep_asocid_locked(inp, (sctp_assoc_t)id, 0);
if (lstcb) {
goto try_again;
}
@@ -4869,7 +4860,6 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
sctp_sorwakeup(inp, so);
sctp_sowwakeup(inp, so);
}
-
#ifdef SCTP_LOG_CLOSING
sctp_log_closing(inp, stcb, 9);
#endif
@@ -4928,7 +4918,6 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
}
}
}
-
/*
* Make it invalid too, that way if its about to run it will abort
* and return.
@@ -5346,7 +5335,6 @@ sctp_update_ep_vflag(struct sctp_inpcb *inp)
__func__);
continue;
}
-
if (laddr->ifa->localifa_flags & SCTP_BEING_DELETED) {
continue;
}
@@ -5760,7 +5748,6 @@ sctp_startup_mcore_threads(void)
i++;
}
}
-
/* Now start them all */
CPU_FOREACH(cpu) {
(void)kproc_create(sctp_mcore_thread,
@@ -5801,12 +5788,12 @@ sctp_pcb_init()
(void)SCTP_GETTIME_TIMEVAL(&tv);
#if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
memset(SCTP_BASE_STATS, 0, sizeof(struct sctpstat) * (mp_maxid + 1));
- SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_sec = (uint32_t) tv.tv_sec;
- SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_usec = (uint32_t) tv.tv_usec;
+ SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_sec = (uint32_t)tv.tv_sec;
+ SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_usec = (uint32_t)tv.tv_usec;
#else
memset(&SCTP_BASE_STATS, 0, sizeof(struct sctpstat));
- SCTP_BASE_STAT(sctps_discontinuitytime).tv_sec = (uint32_t) tv.tv_sec;
- SCTP_BASE_STAT(sctps_discontinuitytime).tv_usec = (uint32_t) tv.tv_usec;
+ SCTP_BASE_STAT(sctps_discontinuitytime).tv_sec = (uint32_t)tv.tv_sec;
+ SCTP_BASE_STAT(sctps_discontinuitytime).tv_usec = (uint32_t)tv.tv_usec;
#endif
/* init the empty list of (All) Endpoints */
LIST_INIT(&SCTP_BASE_INFO(listhead));
@@ -6295,7 +6282,6 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m,
}
SCTP_TCB_UNLOCK(stcb_tmp);
}
-
if (stcb->asoc.state == 0) {
/* the assoc was freed? */
return (-12);
@@ -7015,7 +7001,6 @@ sctp_drain_mbufs(struct sctp_tcb *stcb)
if (!fnd) {
asoc->highest_tsn_inside_map = asoc->mapping_array_base_tsn - 1;
}
-
/*
* Question, should we go through the delivery queue? The
* only reason things are on here is the app not reading OR
diff --git a/sys/netinet/sctp_pcb.h b/sys/netinet/sctp_pcb.h
index 5b41ae8a6cff..3fc033995be0 100644
--- a/sys/netinet/sctp_pcb.h
+++ b/sys/netinet/sctp_pcb.h
@@ -363,7 +363,7 @@ struct sctp_inpcb {
union {
struct inpcb inp;
char align[(sizeof(struct in6pcb) + SCTP_ALIGNM1) &
- ~SCTP_ALIGNM1];
+ ~SCTP_ALIGNM1];
} ip_inp;
@@ -389,7 +389,7 @@ struct sctp_inpcb {
uint64_t sctp_features; /* Feature flags */
uint32_t sctp_flags; /* INP state flag set */
uint32_t sctp_mobility_features; /* Mobility Feature flags */
- struct sctp_pcb sctp_ep; /* SCTP ep data */
+ struct sctp_pcb sctp_ep;/* SCTP ep data */
/* head of the hash of all associations */
struct sctpasochead *sctp_tcbhash;
u_long sctp_hashmark;
@@ -492,7 +492,8 @@ int SCTP6_ARE_ADDR_EQUAL(struct sockaddr_in6 *a, struct sockaddr_in6 *b);
void sctp_fill_pcbinfo(struct sctp_pcbinfo *);
-struct sctp_ifn *sctp_find_ifn(void *ifn, uint32_t ifn_index);
+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);
@@ -523,7 +524,7 @@ void sctp_free_ifn(struct sctp_ifn *sctp_ifnp);
void sctp_free_ifa(struct sctp_ifa *sctp_ifap);
-void
+void
sctp_del_addr_from_vrf(uint32_t vrfid, struct sockaddr *addr,
uint32_t ifn_index, const char *if_name);
@@ -533,7 +534,7 @@ struct sctp_nets *sctp_findnet(struct sctp_tcb *, struct sockaddr *);
struct sctp_inpcb *sctp_pcb_findep(struct sockaddr *, int, int, uint32_t);
-int
+int
sctp_inpcb_bind(struct socket *, struct sockaddr *,
struct sctp_ifa *, struct thread *);
@@ -562,7 +563,8 @@ sctp_findassociation_ep_addr(struct sctp_inpcb **,
struct sockaddr *, struct sctp_nets **, struct sockaddr *,
struct sctp_tcb *);
-struct sctp_tcb *sctp_findasoc_ep_asocid_locked(struct sctp_inpcb *inp, sctp_assoc_t asoc_id, int want_lock);
+struct sctp_tcb *
+ sctp_findasoc_ep_asocid_locked(struct sctp_inpcb *inp, sctp_assoc_t asoc_id, int want_lock);
struct sctp_tcb *
sctp_findassociation_ep_asocid(struct sctp_inpcb *,
diff --git a/sys/netinet/sctp_peeloff.c b/sys/netinet/sctp_peeloff.c
index a94980c48555..1bcca671d69b 100644
--- a/sys/netinet/sctp_peeloff.c
+++ b/sys/netinet/sctp_peeloff.c
@@ -103,7 +103,6 @@ sctp_do_peeloff(struct socket *head, struct socket *so, sctp_assoc_t assoc_id)
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, ENOTCONN);
return (ENOTCONN);
}
-
state = SCTP_GET_STATE((&stcb->asoc));
if ((state == SCTP_STATE_EMPTY) ||
(state == SCTP_STATE_INUSE)) {
@@ -111,7 +110,6 @@ sctp_do_peeloff(struct socket *head, struct socket *so, sctp_assoc_t assoc_id)
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, ENOTCONN);
return (ENOTCONN);
}
-
n_inp = (struct sctp_inpcb *)so->so_pcb;
n_inp->sctp_flags = (SCTP_PCB_FLAGS_UDPTYPE |
SCTP_PCB_FLAGS_CONNECTED |
diff --git a/sys/netinet/sctp_ss_functions.c b/sys/netinet/sctp_ss_functions.c
index ca694ec1dabc..a7e3133f39fa 100644
--- a/sys/netinet/sctp_ss_functions.c
+++ b/sys/netinet/sctp_ss_functions.c
@@ -255,7 +255,7 @@ sctp_ss_default_packet_done(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets
static int
sctp_ss_default_get_value(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_association *asoc SCTP_UNUSED,
- struct sctp_stream_out *strq SCTP_UNUSED, uint16_t * value SCTP_UNUSED)
+ struct sctp_stream_out *strq SCTP_UNUSED, uint16_t *value SCTP_UNUSED)
{
/* Nothing to be done here */
return (-1);
@@ -551,7 +551,7 @@ prio_again:
static int
sctp_ss_prio_get_value(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_association *asoc SCTP_UNUSED,
- struct sctp_stream_out *strq, uint16_t * value)
+ struct sctp_stream_out *strq, uint16_t *value)
{
if (strq == NULL) {
return (-1);
diff --git a/sys/netinet/sctp_structs.h b/sys/netinet/sctp_structs.h
index 6ca6bd1b810c..d60705b4af5e 100644
--- a/sys/netinet/sctp_structs.h
+++ b/sys/netinet/sctp_structs.h
@@ -105,7 +105,7 @@ TAILQ_HEAD(sctp_resethead, sctp_stream_reset_list);
#define SCTP_ASOC_ANY_STATE 0x00000000
typedef void (*asoc_func) (struct sctp_inpcb *, struct sctp_tcb *, void *ptr,
- uint32_t val);
+ uint32_t val);
typedef int (*inp_func) (struct sctp_inpcb *, void *ptr, uint32_t val);
typedef void (*end_func) (void *ptr, uint32_t val);
@@ -144,7 +144,7 @@ struct sctp_iterator {
asoc_func function_assoc; /* per assoc function */
inp_func function_inp; /* per endpoint function */
inp_func function_inp_end; /* end INP function */
- end_func function_atend; /* iterator completion function */
+ end_func function_atend;/* iterator completion function */
void *pointer; /* pointer for apply func to use */
uint32_t val; /* value for apply func to use */
uint32_t pcb_flags; /* endpoint flags being checked */
@@ -231,7 +231,7 @@ struct rtcc_cc {
uint64_t bw_tot_time; /* The total time since sending began */
uint64_t new_tot_time; /* temp holding the new value */
uint64_t bw_bytes_at_last_rttc; /* What bw_bytes was at last rtt calc */
- uint32_t cwnd_at_bw_set; /* Cwnd at last bw saved - lbw */
+ uint32_t cwnd_at_bw_set;/* Cwnd at last bw saved - lbw */
uint32_t vol_reduce; /* cnt of voluntary reductions */
uint16_t steady_step; /* The number required to be in steady state */
uint16_t step_cnt; /* The current number */
@@ -240,8 +240,7 @@ struct rtcc_cc {
uint8_t use_dccc_ecn; /* Flag to enable DCCC ECN */
uint8_t tls_needs_set; /* Flag to indicate we need to set tls 0 or 1
* means set at send 2 not */
- uint8_t last_step_state; /* Last state if steady state stepdown
- * is on */
+ uint8_t last_step_state;/* Last state if steady state stepdown is on */
uint8_t rtt_set_this_sack; /* Flag saying this sack had RTT calc
* on it */
uint8_t last_inst_ind; /* Last saved inst indication */
@@ -332,8 +331,8 @@ struct sctp_nets {
uint8_t dscp;
struct timeval start_time; /* time when this net was created */
- uint32_t marked_retrans; /* number or DATA chunks marked for
- * timer based retransmissions */
+ uint32_t marked_retrans;/* number or DATA chunks marked for timer
+ * based retransmissions */
uint32_t marked_fastretrans;
uint32_t heart_beat_delay; /* Heart Beat delay in ms */
@@ -707,28 +706,28 @@ struct sctp_nonpad_sndrcvinfo {
struct sctp_cc_functions {
void (*sctp_set_initial_cc_param) (struct sctp_tcb *stcb, struct sctp_nets *net);
void (*sctp_cwnd_update_after_sack) (struct sctp_tcb *stcb,
- struct sctp_association *asoc,
- int accum_moved, int reneged_all, int will_exit);
+ struct sctp_association *asoc,
+ int accum_moved, int reneged_all, int will_exit);
void (*sctp_cwnd_update_exit_pf) (struct sctp_tcb *stcb, struct sctp_nets *net);
void (*sctp_cwnd_update_after_fr) (struct sctp_tcb *stcb,
- struct sctp_association *asoc);
+ struct sctp_association *asoc);
void (*sctp_cwnd_update_after_timeout) (struct sctp_tcb *stcb,
- struct sctp_nets *net);
+ struct sctp_nets *net);
void (*sctp_cwnd_update_after_ecn_echo) (struct sctp_tcb *stcb,
- struct sctp_nets *net, int in_window, int num_pkt_lost);
+ struct sctp_nets *net, int in_window, int num_pkt_lost);
void (*sctp_cwnd_update_after_packet_dropped) (struct sctp_tcb *stcb,
- struct sctp_nets *net, struct sctp_pktdrop_chunk *cp,
- uint32_t * bottle_bw, uint32_t * on_queue);
+ struct sctp_nets *net, struct sctp_pktdrop_chunk *cp,
+ uint32_t *bottle_bw, uint32_t *on_queue);
void (*sctp_cwnd_update_after_output) (struct sctp_tcb *stcb,
- struct sctp_nets *net, int burst_limit);
+ struct sctp_nets *net, int burst_limit);
void (*sctp_cwnd_update_packet_transmitted) (struct sctp_tcb *stcb,
- struct sctp_nets *net);
+ struct sctp_nets *net);
void (*sctp_cwnd_update_tsn_acknowledged) (struct sctp_nets *net,
- struct sctp_tmit_chunk *);
+ struct sctp_tmit_chunk *);
void (*sctp_cwnd_new_transmission_begins) (struct sctp_tcb *stcb,
- struct sctp_nets *net);
+ struct sctp_nets *net);
void (*sctp_cwnd_prepare_net_for_sack) (struct sctp_tcb *stcb,
- struct sctp_nets *net);
+ struct sctp_nets *net);
int (*sctp_cwnd_socket_option) (struct sctp_tcb *stcb, int set, struct sctp_cc_option *);
void (*sctp_rtt_calculated) (struct sctp_tcb *, struct sctp_nets *, struct timeval *);
};
@@ -739,25 +738,25 @@ struct sctp_cc_functions {
*/
struct sctp_ss_functions {
void (*sctp_ss_init) (struct sctp_tcb *stcb, struct sctp_association *asoc,
- int holds_lock);
+ int holds_lock);
void (*sctp_ss_clear) (struct sctp_tcb *stcb, struct sctp_association *asoc,
- int clear_values, int holds_lock);
+ int clear_values, int holds_lock);
void (*sctp_ss_init_stream) (struct sctp_tcb *stcb, struct sctp_stream_out *strq, struct sctp_stream_out *with_strq);
void (*sctp_ss_add_to_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc,
- struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, int holds_lock);
+ struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, int holds_lock);
int (*sctp_ss_is_empty) (struct sctp_tcb *stcb, struct sctp_association *asoc);
void (*sctp_ss_remove_from_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc,
- struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, int holds_lock);
-struct sctp_stream_out *(*sctp_ss_select_stream) (struct sctp_tcb *stcb,
- struct sctp_nets *net, struct sctp_association *asoc);
+ struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, int holds_lock);
+ struct sctp_stream_out *(*sctp_ss_select_stream) (struct sctp_tcb *stcb,
+ struct sctp_nets *net, struct sctp_association *asoc);
void (*sctp_ss_scheduled) (struct sctp_tcb *stcb, struct sctp_nets *net,
- struct sctp_association *asoc, struct sctp_stream_out *strq, int moved_how_much);
+ struct sctp_association *asoc, struct sctp_stream_out *strq, int moved_how_much);
void (*sctp_ss_packet_done) (struct sctp_tcb *stcb, struct sctp_nets *net,
- struct sctp_association *asoc);
+ struct sctp_association *asoc);
int (*sctp_ss_get_value) (struct sctp_tcb *stcb, struct sctp_association *asoc,
- struct sctp_stream_out *strq, uint16_t * value);
+ struct sctp_stream_out *strq, uint16_t *value);
int (*sctp_ss_set_value) (struct sctp_tcb *stcb, struct sctp_association *asoc,
- struct sctp_stream_out *strq, uint16_t value);
+ struct sctp_stream_out *strq, uint16_t value);
int (*sctp_ss_is_user_msgs_incomplete) (struct sctp_tcb *stcb, struct sctp_association *asoc);
};
diff --git a/sys/netinet/sctp_sysctl.c b/sys/netinet/sctp_sysctl.c
index 48028b8ded4c..b5c7fbc82753 100644
--- a/sys/netinet/sctp_sysctl.c
+++ b/sys/netinet/sctp_sysctl.c
@@ -312,8 +312,8 @@ sctp_sysctl_copy_out_local_addresses(struct sctp_inpcb *inp, struct sctp_tcb *st
continue;
memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr));
memcpy((void *)&xladdr.address, (const void *)&laddr->ifa->address, sizeof(union sctp_sockstore));
- xladdr.start_time.tv_sec = (uint32_t) laddr->start_time.tv_sec;
- xladdr.start_time.tv_usec = (uint32_t) laddr->start_time.tv_usec;
+ xladdr.start_time.tv_sec = (uint32_t)laddr->start_time.tv_sec;
+ xladdr.start_time.tv_usec = (uint32_t)laddr->start_time.tv_usec;
SCTP_INP_RUNLOCK(inp);
SCTP_INP_INFO_RUNLOCK();
error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr));
@@ -409,7 +409,7 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS)
xinpcb.total_recvs = inp->total_recvs;
xinpcb.total_nospaces = inp->total_nospaces;
xinpcb.fragmentation_point = inp->sctp_frag_point;
- xinpcb.socket = (uintptr_t) inp->sctp_socket;
+ xinpcb.socket = (uintptr_t)inp->sctp_socket;
so = inp->sctp_socket;
if ((so == NULL) ||
(!SCTP_IS_LISTENING(inp)) ||
@@ -419,10 +419,10 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS)
} else {
xinpcb.qlen = so->sol_qlen;
xinpcb.qlen_old = so->sol_qlen > USHRT_MAX ?
- USHRT_MAX : (uint16_t) so->sol_qlen;
+ USHRT_MAX : (uint16_t)so->sol_qlen;
xinpcb.maxqlen = so->sol_qlimit;
xinpcb.maxqlen_old = so->sol_qlimit > USHRT_MAX ?
- USHRT_MAX : (uint16_t) so->sol_qlimit;
+ USHRT_MAX : (uint16_t)so->sol_qlimit;
}
SCTP_INP_INCR_REF(inp);
SCTP_INP_RUNLOCK(inp);
@@ -449,7 +449,7 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS)
if (stcb->asoc.primary_destination != NULL)
xstcb.primary_addr = stcb->asoc.primary_destination->ro._l_addr;
xstcb.heartbeat_interval = stcb->asoc.heart_beat_delay;
- xstcb.state = (uint32_t) sctp_map_assoc_state(stcb->asoc.state);
+ xstcb.state = (uint32_t)sctp_map_assoc_state(stcb->asoc.state);
/* 7.0 does not support these */
xstcb.assoc_id = sctp_get_associd(stcb);
xstcb.peers_rwnd = stcb->asoc.peers_rwnd;
@@ -461,10 +461,10 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS)
xstcb.T1_expireries = stcb->asoc.timoinit + stcb->asoc.timocookie;
xstcb.T2_expireries = stcb->asoc.timoshutdown + stcb->asoc.timoshutdownack;
xstcb.retransmitted_tsns = stcb->asoc.marked_retrans;
- xstcb.start_time.tv_sec = (uint32_t) stcb->asoc.start_time.tv_sec;
- xstcb.start_time.tv_usec = (uint32_t) stcb->asoc.start_time.tv_usec;
- xstcb.discontinuity_time.tv_sec = (uint32_t) stcb->asoc.discontinuity_time.tv_sec;
- xstcb.discontinuity_time.tv_usec = (uint32_t) stcb->asoc.discontinuity_time.tv_usec;
+ xstcb.start_time.tv_sec = (uint32_t)stcb->asoc.start_time.tv_sec;
+ xstcb.start_time.tv_usec = (uint32_t)stcb->asoc.start_time.tv_usec;
+ xstcb.discontinuity_time.tv_sec = (uint32_t)stcb->asoc.discontinuity_time.tv_sec;
+ xstcb.discontinuity_time.tv_usec = (uint32_t)stcb->asoc.discontinuity_time.tv_usec;
xstcb.total_sends = stcb->total_sends;
xstcb.total_recvs = stcb->total_recvs;
xstcb.local_tag = stcb->asoc.my_vtag;
@@ -516,8 +516,8 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS)
} else {
xraddr.state = SCTP_INACTIVE;
}
- xraddr.start_time.tv_sec = (uint32_t) net->start_time.tv_sec;
- xraddr.start_time.tv_usec = (uint32_t) net->start_time.tv_usec;
+ xraddr.start_time.tv_sec = (uint32_t)net->start_time.tv_sec;
+ xraddr.start_time.tv_usec = (uint32_t)net->start_time.tv_usec;
SCTP_INP_RUNLOCK(inp);
SCTP_INP_INFO_RUNLOCK();
error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr));
diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c
index acbb2920f06b..364caa6f9ee1 100644
--- a/sys/netinet/sctp_timer.c
+++ b/sys/netinet/sctp_timer.c
@@ -145,8 +145,8 @@ sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
}
SCTPDBG(SCTP_DEBUG_TIMER4, "Overall error count for %p now %d thresh:%u state:%x\n",
(void *)&stcb->asoc, stcb->asoc.overall_error_count,
- (uint32_t) threshold,
- ((net == NULL) ? (uint32_t) 0 : (uint32_t) net->dest_state));
+ (uint32_t)threshold,
+ ((net == NULL) ? (uint32_t)0 : (uint32_t)net->dest_state));
/*
* We specifically do not do >= to give the assoc one more change
* before we fail it.
@@ -649,7 +649,6 @@ start_again:
sctp_log_fr(chk->rec.data.tsn, chk->snd_count,
0, SCTP_FR_T3_MARKED);
}
-
if (chk->rec.data.chunk_was_revoked) {
/* deflate the cwnd */
chk->whoTo->cwnd -= chk->book_size;
@@ -661,7 +660,7 @@ start_again:
sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_RSND_TO,
chk->whoTo->flight_size,
chk->book_size,
- (uint32_t) (uintptr_t) chk->whoTo,
+ (uint32_t)(uintptr_t)chk->whoTo,
chk->rec.data.tsn);
}
sctp_flight_size_decrease(chk);
@@ -716,7 +715,6 @@ start_again:
/* we did not subtract the same things? */
audit_tf = 1;
}
-
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) {
sctp_log_fr(tsnfirst, tsnlast, num_mk, SCTP_FR_T3_TIMEOUT);
}
@@ -788,10 +786,9 @@ start_again:
sctp_misc_ints(SCTP_FLIGHT_LOG_UP,
chk->whoTo->flight_size,
chk->book_size,
- (uint32_t) (uintptr_t) chk->whoTo,
+ (uint32_t)(uintptr_t)chk->whoTo,
chk->rec.data.tsn);
}
-
sctp_flight_size_increase(chk);
sctp_total_flight_increase(stcb, chk);
}
@@ -912,7 +909,6 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp,
(net->flight_size == 0)) {
(*stcb->asoc.cc_functions.sctp_cwnd_new_transmission_begins) (stcb, net);
}
-
/*
* setup the sat loss recovery that prevents satellite cwnd advance.
*/
@@ -941,7 +937,6 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp,
RTFREE(net->ro.ro_rt);
net->ro.ro_rt = NULL;
}
-
/* Was it our primary? */
if ((stcb->asoc.primary_destination == net) && (alt != net)) {
/*
@@ -1215,7 +1210,6 @@ sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
asconf->whoTo = alt;
atomic_add_int(&alt->ref_count, 1);
}
-
/* See if an ECN Echo is also stranded */
TAILQ_FOREACH(chk, &stcb->asoc.control_send_queue, sctp_next) {
if ((chk->whoTo == net) &&
@@ -1445,8 +1439,8 @@ sctp_heartbeat_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
SCTP_GETTIME_TIMEVAL(&diff);
timevalsub(&diff, &net->last_sent_time);
- ms_gone_by = (uint32_t) (diff.tv_sec * 1000) +
- (uint32_t) (diff.tv_usec / 1000);
+ ms_gone_by = (uint32_t)(diff.tv_sec * 1000) +
+ (uint32_t)(diff.tv_usec / 1000);
} else {
ms_gone_by = 0xffffffff;
}
@@ -1487,7 +1481,7 @@ sctp_pathmtu_timer(struct sctp_inpcb *inp,
net->ro._s_addr = sctp_source_address_selection(inp,
stcb,
- (sctp_route_t *) & net->ro,
+ (sctp_route_t *)&net->ro,
net, 0, stcb->asoc.vrf_id);
#if defined(INET6) && defined(SCTP_EMBEDDED_V6_SCOPE)
if (net->ro._l_addr.sa.sa_family == AF_INET6) {
diff --git a/sys/netinet/sctp_uio.h b/sys/netinet/sctp_uio.h
index ad4d0a010752..fe8ac2ba8e2e 100644
--- a/sys/netinet/sctp_uio.h
+++ b/sys/netinet/sctp_uio.h
@@ -127,7 +127,7 @@ struct sctp_sndrcvinfo {
sctp_assoc_t sinfo_assoc_id;
uint16_t sinfo_keynumber;
uint16_t sinfo_keynumber_valid;
- uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD];
+ uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD];
};
struct sctp_extrcvinfo {
@@ -147,7 +147,7 @@ struct sctp_extrcvinfo {
uint32_t serinfo_next_ppid;
uint16_t sinfo_keynumber;
uint16_t sinfo_keynumber_valid;
- uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD_SHORT];
+ uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD_SHORT];
};
#define sinfo_pr_value sinfo_timetolive
#define sreinfo_next_flags serinfo_next_flags
@@ -258,14 +258,13 @@ struct sctp_snd_all_completes {
/* for the endpoint */
/* The lower four bits is an enumeration of PR-SCTP policies */
-#define SCTP_PR_SCTP_NONE 0x0000 /* Reliable transfer */
-#define SCTP_PR_SCTP_TTL 0x0001 /* Time based PR-SCTP */
-#define SCTP_PR_SCTP_PRIO 0x0002 /* Buffer based PR-SCTP */
+#define SCTP_PR_SCTP_NONE 0x0000/* Reliable transfer */
+#define SCTP_PR_SCTP_TTL 0x0001/* Time based PR-SCTP */
+#define SCTP_PR_SCTP_PRIO 0x0002/* Buffer based PR-SCTP */
#define SCTP_PR_SCTP_BUF SCTP_PR_SCTP_PRIO /* For backwards compatibility */
-#define SCTP_PR_SCTP_RTX 0x0003 /* Number of retransmissions based
- * PR-SCTP */
+#define SCTP_PR_SCTP_RTX 0x0003/* Number of retransmissions based PR-SCTP */
#define SCTP_PR_SCTP_MAX SCTP_PR_SCTP_RTX
-#define SCTP_PR_SCTP_ALL 0x000f /* Used for aggregated stats */
+#define SCTP_PR_SCTP_ALL 0x000f/* Used for aggregated stats */
#define PR_SCTP_POLICY(x) ((x) & 0x0f)
#define PR_SCTP_ENABLED(x) ((PR_SCTP_POLICY(x) != SCTP_PR_SCTP_NONE) && \
@@ -745,7 +744,7 @@ struct sctp_prstatus {
struct sctp_cwnd_args {
struct sctp_nets *net; /* network to *//* FIXME: LP64 issue */
- uint32_t cwnd_new_value; /* cwnd in k */
+ uint32_t cwnd_new_value;/* cwnd in k */
uint32_t pseudo_cumack;
uint16_t inflight; /* flightsize in k */
uint16_t cwnd_augment; /* increment to it */
@@ -759,9 +758,9 @@ struct sctp_blk_args {
uint32_t onsb; /* in 1k bytes */
uint32_t sndlen; /* len of send being attempted */
uint32_t peer_rwnd; /* rwnd of peer */
- uint16_t send_sent_qcnt; /* chnk cnt */
+ uint16_t send_sent_qcnt;/* chnk cnt */
uint16_t stream_qcnt; /* chnk cnt */
- uint16_t chunks_on_oque; /* chunks out */
+ uint16_t chunks_on_oque;/* chunks out */
uint16_t flight_size; /* flight size in k */
};
@@ -953,7 +952,7 @@ struct sctpstat {
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_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) */
@@ -972,12 +971,12 @@ struct sctpstat {
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_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_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 */
@@ -994,7 +993,7 @@ struct sctpstat {
/* output statistics: */
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_senddata;/* total output DATA chunks */
uint32_t sctps_sendretransdata; /* total output retransmitted DATA
* chunks */
uint32_t sctps_sendfastretrans; /* total output fast retransmitted
@@ -1004,8 +1003,8 @@ struct sctpstat {
* chunk (u-del multi-fr
* algo). */
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_sendecne;/* total output ECNE chunks */
+ uint32_t sctps_sendauth;/* total output AUTH chunks FIXME */
uint32_t sctps_senderrors; /* ip_output error counter */
uint32_t sctps_send_spare; /* formerly sctps_sendnocrc */
uint32_t sctps_sendswcrc;
@@ -1013,8 +1012,8 @@ struct sctpstat {
/* PCKDROPREP statistics: */
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_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 */
@@ -1025,17 +1024,16 @@ struct sctpstat {
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 */
+ uint32_t sctps_pdrpbadd;/* P-drop, data did not match TSN */
+ uint32_t sctps_pdrpmark;/* P-drop, TSN's marked for Fast Retran */
/* timeouts */
uint32_t sctps_timoiterator; /* Number of iterator timers that
* fired */
- uint32_t sctps_timodata; /* Number of T3 data time outs */
+ uint32_t sctps_timodata;/* Number of T3 data time outs */
uint32_t sctps_timowindowprobe; /* Number of window probe (T3) timers
* that fired */
- uint32_t sctps_timoinit; /* Number of INIT timers that fired */
- uint32_t sctps_timosack; /* Number of sack timers that fired */
+ 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 */
uint32_t sctps_timoheartbeat; /* Number of heartbeat timers that
@@ -1177,7 +1175,7 @@ struct xsctp_inpcb {
uint16_t local_port;
uint16_t qlen_old;
uint16_t maxqlen_old;
- uint16_t __spare16;
+ uint16_t __spare16;
kvaddr_t socket;
uint32_t qlen;
uint32_t maxqlen;
@@ -1191,7 +1189,7 @@ struct xsctp_tcb {
uint32_t state; /* sctpAssocEntry 8 */
uint32_t in_streams; /* sctpAssocEntry 9 */
uint32_t out_streams; /* sctpAssocEntry 10 */
- uint32_t max_nr_retrans; /* sctpAssocEntry 11 */
+ uint32_t max_nr_retrans;/* sctpAssocEntry 11 */
uint32_t primary_process; /* sctpAssocEntry 12 */
uint32_t T1_expireries; /* sctpAssocEntry 13 */
uint32_t T2_expireries; /* sctpAssocEntry 14 */
@@ -1304,37 +1302,37 @@ void sctp_freeladdrs(struct sockaddr *);
int sctp_opt_info(int, sctp_assoc_t, int, void *, socklen_t *);
/* deprecated */
-ssize_t
+ssize_t
sctp_sendmsg(int, const void *, size_t, const struct sockaddr *,
socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t);
/* deprecated */
-ssize_t
+ssize_t
sctp_send(int, const void *, size_t,
const struct sctp_sndrcvinfo *, int);
/* deprecated */
-ssize_t
+ssize_t
sctp_sendx(int, const void *, size_t, struct sockaddr *,
int, struct sctp_sndrcvinfo *, int);
/* deprecated */
-ssize_t
+ssize_t
sctp_sendmsgx(int sd, const void *, size_t, struct sockaddr *,
int, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t);
sctp_assoc_t sctp_getassocid(int, struct sockaddr *);
/* deprecated */
-ssize_t
+ssize_t
sctp_recvmsg(int, void *, size_t, struct sockaddr *, socklen_t *,
struct sctp_sndrcvinfo *, int *);
-ssize_t
+ssize_t
sctp_sendv(int, const struct iovec *, int, struct sockaddr *,
int, void *, socklen_t, unsigned int, int);
-ssize_t
+ssize_t
sctp_recvv(int, const struct iovec *, int, struct sockaddr *,
socklen_t *, void *, socklen_t *, unsigned int *, int *);
diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c
index 782dba6ffb67..6b564150b0b0 100644
--- a/sys/netinet/sctp_usrreq.c
+++ b/sys/netinet/sctp_usrreq.c
@@ -72,9 +72,9 @@ sctp_init(void)
* Allow a user to take no more than 1/2 the number of clusters or
* the SB_MAX whichever is smaller for the send window.
*/
- sb_max_adj = (u_long)((u_quad_t) (SB_MAX) * MCLBYTES / (MSIZE + MCLBYTES));
+ sb_max_adj = (u_long)((u_quad_t)(SB_MAX) * MCLBYTES / (MSIZE + MCLBYTES));
SCTP_BASE_SYSCTL(sctp_sendspace) = min(sb_max_adj,
- (((uint32_t) nmbclusters / 2) * SCTP_DEFAULT_MAXSEGMENT));
+ (((uint32_t)nmbclusters / 2) * SCTP_DEFAULT_MAXSEGMENT));
/*
* Now for the recv window, should we take the same amount? or
* should I do 1/2 the SB_MAX instead in the SB_MAX min above. For
@@ -136,7 +136,7 @@ sctp_pathmtu_adjustment(struct sctp_tcb *stcb, uint16_t nxtsz)
sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_PMTU,
chk->whoTo->flight_size,
chk->book_size,
- (uint32_t) (uintptr_t) chk->whoTo,
+ (uint32_t)(uintptr_t)chk->whoTo,
chk->rec.data.tsn);
}
/* Clear any time so NO RTT is being done */
@@ -339,7 +339,7 @@ sctp_ctlinput(int cmd, struct sockaddr *sa, void *vip)
icmp->icmp_type,
icmp->icmp_code,
ntohs(inner_ip->ip_len),
- (uint32_t) ntohs(icmp->icmp_nextmtu));
+ (uint32_t)ntohs(icmp->icmp_nextmtu));
} else {
if ((stcb == NULL) && (inp != NULL)) {
/* reduce ref-count */
@@ -389,7 +389,6 @@ sctp_getcred(SYSCTL_HANDLER_ARGS)
SCTP_INP_DECR_REF(inp);
goto cred_can_cont;
}
-
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT);
error = ENOENT;
goto out;
@@ -430,7 +429,6 @@ sctp_abort(struct socket *so)
if (inp == NULL) {
return;
}
-
sctp_must_try_again:
flags = inp->sctp_flags;
#ifdef SCTP_LOG_CLOSING
@@ -992,7 +990,8 @@ sctp_shutdown(struct socket *so)
* returns 0 on success, 1 on error
*/
static uint32_t
-sctp_fill_user_address(struct sockaddr_storage *ss, struct sockaddr *sa){
+sctp_fill_user_address(struct sockaddr_storage *ss, struct sockaddr *sa)
+{
#ifdef INET6
struct sockaddr_in6 lsa6;
@@ -1368,13 +1367,11 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb *inp, void *optval,
SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EADDRINUSE);
return (EADDRINUSE);
}
-
if ((inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) &&
(sctp_is_feature_off(inp, SCTP_PCB_FLAGS_PORTREUSE))) {
SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
return (EINVAL);
}
-
if (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) {
SCTP_INP_RLOCK(inp);
stcb = LIST_FIRST(&inp->sctp_asoc_list);
@@ -1439,7 +1436,6 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb *inp, void *optval,
goto out_now;
}
}
-
/* FIX ME: do we want to pass in a vrf on the connect call? */
vrf_id = inp->def_vrf_id;
@@ -1484,7 +1480,7 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb *inp, void *optval,
SCTP_FROM_SCTP_USRREQ + SCTP_LOC_7);
goto out_now;
}
- a_id = (sctp_assoc_t *) optval;
+ a_id = (sctp_assoc_t *)optval;
*a_id = sctp_get_associd(stcb);
/* initialize authentication parameters for the assoc */
@@ -1551,7 +1547,6 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
return (EINVAL);
}
-
inp = (struct sctp_inpcb *)so->so_pcb;
if (inp == NULL) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
@@ -2185,7 +2180,7 @@ flags_out:
SCTP_CHECK_AND_CAST(value, optval, uint32_t, *optsize);
/* FIXME MT: change to sctp_assoc_value? */
- SCTP_FIND_STCB(inp, stcb, (sctp_assoc_t) * value);
+ SCTP_FIND_STCB(inp, stcb, (sctp_assoc_t)*value);
if (stcb) {
size = 0;
@@ -2215,7 +2210,7 @@ flags_out:
}
}
SCTP_TCB_UNLOCK(stcb);
- *value = (uint32_t) size;
+ *value = (uint32_t)size;
*optsize = sizeof(uint32_t);
} else {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTCONN);
@@ -2396,7 +2391,6 @@ flags_out:
break;
}
}
-
if (stcb != NULL) {
/* Applies to the specific association */
paddrp->spp_flags = 0;
@@ -2941,7 +2935,7 @@ flags_out:
} else {
/* copy in the chunks */
(void)sctp_serialize_auth_chunks(chklist, sac->gauth_chunks);
- sac->gauth_number_of_chunks = (uint32_t) size;
+ sac->gauth_number_of_chunks = (uint32_t)size;
*optsize = sizeof(struct sctp_authchunks) + size;
}
SCTP_TCB_UNLOCK(stcb);
@@ -2960,7 +2954,7 @@ flags_out:
} else {
/* copy in the chunks */
(void)sctp_serialize_auth_chunks(chklist, sac->gauth_chunks);
- sac->gauth_number_of_chunks = (uint32_t) size;
+ sac->gauth_number_of_chunks = (uint32_t)size;
*optsize = sizeof(struct sctp_authchunks) + size;
}
SCTP_INP_RUNLOCK(inp);
@@ -2991,7 +2985,7 @@ flags_out:
} else {
/* copy in the chunks */
(void)sctp_serialize_auth_chunks(chklist, sac->gauth_chunks);
- sac->gauth_number_of_chunks = (uint32_t) size;
+ sac->gauth_number_of_chunks = (uint32_t)size;
*optsize = sizeof(struct sctp_authchunks) + size;
}
SCTP_TCB_UNLOCK(stcb);
@@ -3266,7 +3260,6 @@ flags_out:
break;
}
}
-
if (stcb != NULL) {
if (net != NULL) {
thlds->spt_pathmaxrxt = net->failure_threshold;
@@ -3379,7 +3372,6 @@ flags_out:
break;
}
}
-
if (stcb != NULL) {
if (net) {
encaps->sue_port = net->port;
@@ -3601,14 +3593,14 @@ flags_out:
SCTP_FIND_STCB(inp, stcb, av->assoc_id);
if (stcb) {
- av->assoc_value = (uint32_t) stcb->asoc.local_strreset_support;
+ av->assoc_value = (uint32_t)stcb->asoc.local_strreset_support;
SCTP_TCB_UNLOCK(stcb);
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
SCTP_INP_RLOCK(inp);
- av->assoc_value = (uint32_t) inp->local_strreset_support;
+ av->assoc_value = (uint32_t)inp->local_strreset_support;
SCTP_INP_RUNLOCK(inp);
} else {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
@@ -4295,7 +4287,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
* insert/replace it
*/
if (size > 0) {
- key = sctp_set_key(sca->sca_key, (uint32_t) size);
+ key = sctp_set_key(sca->sca_key, (uint32_t)size);
if (key == NULL) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOMEM);
error = ENOMEM;
@@ -4332,7 +4324,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
* insert/replace it
*/
if (size > 0) {
- key = sctp_set_key(sca->sca_key, (uint32_t) size);
+ key = sctp_set_key(sca->sca_key, (uint32_t)size);
if (key == NULL) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOMEM);
error = ENOMEM;
@@ -4369,7 +4361,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
* and insert/replace it
*/
if (size > 0) {
- key = sctp_set_key(sca->sca_key, (uint32_t) size);
+ key = sctp_set_key(sca->sca_key, (uint32_t)size);
if (key == NULL) {
SCTP_TCB_UNLOCK(stcb);
continue;
@@ -4405,8 +4397,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
error = EINVAL;
break;
}
-
- hmaclist = sctp_alloc_hmaclist((uint16_t) shmac->shmac_number_of_idents);
+ hmaclist = sctp_alloc_hmaclist((uint16_t)shmac->shmac_number_of_idents);
if (hmaclist == NULL) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOMEM);
error = ENOMEM;
@@ -4577,7 +4568,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
}
SCTP_FIND_STCB(inp, stcb, av->assoc_id);
if (stcb) {
- stcb->asoc.local_strreset_support = (uint8_t) av->assoc_value;
+ stcb->asoc.local_strreset_support = (uint8_t)av->assoc_value;
SCTP_TCB_UNLOCK(stcb);
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
@@ -4585,7 +4576,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
(av->assoc_id == SCTP_FUTURE_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)) {
SCTP_INP_WLOCK(inp);
- inp->local_strreset_support = (uint8_t) av->assoc_value;
+ inp->local_strreset_support = (uint8_t)av->assoc_value;
SCTP_INP_WUNLOCK(inp);
}
if ((av->assoc_id == SCTP_CURRENT_ASSOC) ||
@@ -4593,12 +4584,11 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
- stcb->asoc.local_strreset_support = (uint8_t) av->assoc_value;
+ stcb->asoc.local_strreset_support = (uint8_t)av->assoc_value;
SCTP_TCB_UNLOCK(stcb);
}
SCTP_INP_RUNLOCK(inp);
}
-
}
break;
}
@@ -4793,7 +4783,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
uint32_t *value;
SCTP_CHECK_AND_CAST(value, optval, uint32_t, optsize);
- SCTP_FIND_STCB(inp, stcb, (sctp_assoc_t) * value);
+ SCTP_FIND_STCB(inp, stcb, (sctp_assoc_t)*value);
if (stcb == NULL) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT);
error = ENOENT;
@@ -5282,14 +5272,12 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
return (EINVAL);
}
-
if ((paddrp->spp_flags & SPP_PMTUD_ENABLE) && (paddrp->spp_flags & SPP_PMTUD_DISABLE)) {
if (stcb)
SCTP_TCB_UNLOCK(stcb);
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
return (EINVAL);
}
-
if (stcb != NULL) {
/************************TCB SPECIFIC SET ******************/
if (net != NULL) {
@@ -5425,7 +5413,6 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
net->failure_threshold = paddrp->spp_pathmaxrxt;
}
}
-
if (paddrp->spp_flags & SPP_HB_ENABLE) {
if (paddrp->spp_hbinterval != 0) {
stcb->asoc.heart_beat_delay = paddrp->spp_hbinterval;
@@ -5536,7 +5523,6 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
if (paddrp->spp_pathmaxrxt != 0) {
inp->sctp_ep.def_net_failure = paddrp->spp_pathmaxrxt;
}
-
if (paddrp->spp_flags & SPP_HB_TIME_IS_ZERO)
inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = 0;
else if (paddrp->spp_hbinterval != 0) {
@@ -5544,7 +5530,6 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
paddrp->spp_hbinterval = SCTP_MAX_HB_INTERVAL;
inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = MSEC_TO_TICKS(paddrp->spp_hbinterval);
}
-
if (paddrp->spp_flags & SPP_HB_ENABLE) {
if (paddrp->spp_flags & SPP_HB_TIME_IS_ZERO) {
inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = 0;
@@ -6497,7 +6482,6 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
break;
}
}
-
if (stcb != NULL) {
if (net != NULL) {
net->port = encaps->sue_port;
@@ -6881,7 +6865,6 @@ sctp_connect(struct socket *so, struct sockaddr *addr, struct thread *p)
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
return EINVAL;
}
-
switch (addr->sa_family) {
#ifdef INET6
case AF_INET6:
@@ -6987,7 +6970,6 @@ sctp_connect(struct socket *so, struct sockaddr *addr, struct thread *p)
error = EALREADY;
goto out_now;
}
-
vrf_id = inp->def_vrf_id;
/* We are GOOD to go */
stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id,
@@ -7014,7 +6996,6 @@ out_now:
if (create_lock_on) {
SCTP_ASOC_CREATE_UNLOCK(inp);
}
-
SCTP_INP_DECR_REF(inp);
return (error);
}
@@ -7153,7 +7134,6 @@ sctp_listen(struct socket *so, int backlog, struct thread *p)
return (EADDRINUSE);
}
}
-
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
(inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED)) {
/* We are already connected AND the TCP model */
@@ -7356,11 +7336,10 @@ sctp_ingetaddr(struct socket *so, struct sockaddr **addr)
SCTP_TCB_UNLOCK(stcb);
goto notConn;
}
-
vrf_id = inp->def_vrf_id;
sctp_ifa = sctp_source_address_selection(inp,
stcb,
- (sctp_route_t *) & net->ro,
+ (sctp_route_t *)&net->ro,
net, 0, vrf_id);
if (sctp_ifa) {
sin->sin_addr = sctp_ifa->address.sin.sin_addr;
diff --git a/sys/netinet/sctp_var.h b/sys/netinet/sctp_var.h
index 175888c32a17..84cbfc884306 100644
--- a/sys/netinet/sctp_var.h
+++ b/sys/netinet/sctp_var.h
@@ -341,12 +341,12 @@ int sctp_input(struct mbuf **, int *, int);
void sctp_pathmtu_adjustment(struct sctp_tcb *, uint16_t);
void sctp_drain(void);
void sctp_init(void);
-void
+void
sctp_notify(struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *,
uint8_t, uint8_t, uint16_t, uint32_t);
int sctp_flush(struct socket *, int);
int sctp_shutdown(struct socket *);
-int
+int
sctp_bindx(struct socket *, int, struct sockaddr_storage *,
int, int, struct proc *);
diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c
index a0ca5a5e1235..98b11bf65a88 100644
--- a/sys/netinet/sctputil.c
+++ b/sys/netinet/sctputil.c
@@ -102,7 +102,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;
@@ -249,12 +249,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;
@@ -292,11 +292,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;
@@ -509,12 +509,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;
@@ -530,7 +530,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;
}
@@ -551,12 +551,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,
@@ -599,8 +599,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");
@@ -618,8 +618,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");
@@ -801,23 +801,23 @@ sctp_stop_timers_for_shutdown(struct sctp_tcb *stcb)
*/
static uint32_t sctp_mtu_sizes[] = {
68,
- 296,
- 508,
- 512,
- 544,
- 576,
- 1004,
- 1492,
- 1500,
- 1536,
- 2000,
- 2048,
- 4352,
- 4464,
- 8166,
- 17912,
- 32000,
- 65532
+ 296,
+ 508,
+ 512,
+ 544,
+ 576,
+ 1004,
+ 1492,
+ 1500,
+ 1536,
+ 2000,
+ 2048,
+ 4352,
+ 4464,
+ 8166,
+ 17912,
+ 32000,
+ 65532
};
/*
@@ -827,7 +827,8 @@ static uint32_t sctp_mtu_sizes[] = {
* Ensure that the result is a multiple of 4.
*/
uint32_t
-sctp_get_prev_mtu(uint32_t val) {
+sctp_get_prev_mtu(uint32_t val)
+{
uint32_t i;
val &= 0xfffffffc;
@@ -851,7 +852,8 @@ sctp_get_prev_mtu(uint32_t val) {
* Ensure that the result is a multiple of 4.
*/
uint32_t
-sctp_get_next_mtu(uint32_t val) {
+sctp_get_next_mtu(uint32_t val)
+{
/* select another MTU that is just bigger than this one */
uint32_t i;
@@ -879,14 +881,15 @@ 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++;
}
uint32_t
-sctp_select_initial_TSN(struct sctp_pcb *inp){
+sctp_select_initial_TSN(struct sctp_pcb *inp)
+{
/*
* A true implementation should use random selection process to get
* the initial stream sequence number, using RFC1750 as a good
@@ -917,13 +920,14 @@ retry:
sctp_fill_random_store(inp);
}
p = &inp->random_store[store_at];
- xp = (uint32_t *) p;
+ xp = (uint32_t *)p;
x = *xp;
return (x);
}
uint32_t
-sctp_select_a_tag(struct sctp_inpcb *inp, uint16_t lport, uint16_t rport, int check){
+sctp_select_a_tag(struct sctp_inpcb *inp, uint16_t lport, uint16_t rport, int check)
+{
uint32_t x;
struct timeval now;
@@ -944,7 +948,8 @@ sctp_select_a_tag(struct sctp_inpcb *inp, uint16_t lport, uint16_t rport, int ch
}
int32_t
-sctp_map_assoc_state(int kernel_state){
+sctp_map_assoc_state(int kernel_state)
+{
int32_t user_state;
if (kernel_state & SCTP_STATE_WAS_ABORTED) {
@@ -1024,7 +1029,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;
@@ -1428,7 +1433,6 @@ select_a_new_ep:
atomic_add_int(&it->stcb->asoc.refcnt, -1);
iteration_count = 0;
}
-
/* run function on this one */
(*it->function_assoc) (it->inp, it->stcb, it->pointer, it->val);
@@ -1568,7 +1572,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
@@ -1782,7 +1786,6 @@ sctp_timeout_handler(void *t)
if ((stcb == NULL) || (inp == NULL)) {
break;
}
-
if (sctp_cookie_timer(inp, stcb, net)) {
/* no need to unlock on tcb its gone */
goto out_decr;
@@ -1951,7 +1954,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
@@ -1978,7 +1981,6 @@ out_decr:
if (inp) {
SCTP_INP_DECR_REF(inp);
}
-
out_no_decr:
SCTPDBG(SCTP_DEBUG_TIMER1, "Timer now complete (type = %d)\n", type);
CURVNET_RESTORE();
@@ -2417,7 +2419,8 @@ sctp_timer_stop(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb,
}
uint32_t
-sctp_calculate_len(struct mbuf *m){
+sctp_calculate_len(struct mbuf *m)
+{
uint32_t tlen = 0;
struct mbuf *at;
@@ -2471,7 +2474,8 @@ sctp_calculate_rto(struct sctp_tcb *stcb,
struct sctp_association *asoc,
struct sctp_nets *net,
struct timeval *old,
- int rtt_from_sack){
+ int rtt_from_sack)
+{
/*-
* given an association and the starting time of the current RTT
* period (in value1/value2) return RTO in number of msecs.
@@ -2492,10 +2496,11 @@ 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
@@ -2515,7 +2520,6 @@ sctp_calculate_rto(struct sctp_tcb *stcb,
net->lan_type = SCTP_LAN_LOCAL;
}
}
-
/***************************/
/* 2. update RTTVAR & SRTT */
/***************************/
@@ -2577,7 +2581,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;
@@ -2626,7 +2630,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));
}
@@ -2954,7 +2958,6 @@ sctp_notify_send_failed(struct sctp_tcb *stcb, uint8_t sent, uint32_t error,
/* event not enabled */
return;
}
-
if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) {
notifhdr_len = sizeof(struct sctp_send_failed_event);
} else {
@@ -2998,7 +3001,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;
@@ -3016,11 +3019,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;
@@ -3105,7 +3108,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;
@@ -3123,7 +3126,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;
@@ -3183,7 +3186,6 @@ sctp_notify_adaptation_layer(struct sctp_tcb *stcb)
/* event not enabled */
return;
}
-
m_notify = sctp_get_mbuf_for_msg(sizeof(struct sctp_adaption_event), 0, M_NOWAIT, 1, MT_DATA);
if (m_notify == NULL)
/* no space left */
@@ -3240,7 +3242,6 @@ sctp_notify_partial_delivery_indication(struct sctp_tcb *stcb, uint32_t error,
if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_CANT_READ) {
return;
}
-
m_notify = sctp_get_mbuf_for_msg(sizeof(struct sctp_pdapi_event), 0, M_NOWAIT, 1, MT_DATA);
if (m_notify == NULL)
/* no space left */
@@ -3349,7 +3350,6 @@ sctp_notify_shutdown_event(struct sctp_tcb *stcb)
/* event not enabled */
return;
}
-
m_notify = sctp_get_mbuf_for_msg(sizeof(struct sctp_shutdown_event), 0, M_NOWAIT, 1, MT_DATA);
if (m_notify == NULL)
/* no space left */
@@ -3399,7 +3399,6 @@ sctp_notify_sender_dry_event(struct sctp_tcb *stcb,
/* event not enabled */
return;
}
-
m_notify = sctp_get_mbuf_for_msg(sizeof(struct sctp_sender_dry_event), 0, M_NOWAIT, 1, MT_DATA);
if (m_notify == NULL) {
/* no space left */
@@ -3544,7 +3543,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;
@@ -3556,7 +3555,6 @@ sctp_notify_stream_reset(struct sctp_tcb *stcb,
/* event not enabled */
return;
}
-
m_notify = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_NOWAIT, 1, MT_DATA);
if (m_notify == NULL)
/* no space left */
@@ -3760,7 +3758,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;
@@ -3789,25 +3787,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:
@@ -3827,17 +3825,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:
@@ -4187,7 +4185,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)) {
@@ -4220,7 +4218,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) &&
@@ -4236,7 +4234,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;
@@ -4245,7 +4243,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)) {
@@ -4260,7 +4258,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);
}
@@ -4268,7 +4266,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);
}
@@ -4279,7 +4277,8 @@ sctp_is_there_an_abort_here(struct mbuf *m, int iphlen, uint32_t * vtagfill)
*/
#ifdef INET6
uint32_t
-sctp_is_same_scope(struct sockaddr_in6 *addr1, struct sockaddr_in6 *addr2){
+sctp_is_same_scope(struct sockaddr_in6 *addr1, struct sockaddr_in6 *addr2)
+{
struct sockaddr_in6 a, b;
/* save copies */
@@ -4649,7 +4648,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;
@@ -4668,7 +4667,7 @@ 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;
@@ -4970,7 +4969,6 @@ sctp_find_ifa_in_ep(struct sctp_inpcb *inp, struct sockaddr *addr,
if (holds_lock == 0) {
SCTP_INP_RLOCK(inp);
}
-
LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
if (laddr->ifa == NULL)
continue;
@@ -5010,7 +5008,8 @@ sctp_find_ifa_in_ep(struct sctp_inpcb *inp, struct sockaddr *addr,
}
uint32_t
-sctp_get_ifa_hash_val(struct sockaddr *addr){
+sctp_get_ifa_hash_val(struct sockaddr *addr)
+{
switch (addr->sa_family) {
#ifdef INET
case AF_INET:
@@ -5059,14 +5058,13 @@ sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock)
SCTP_IPI_ADDR_RUNLOCK();
return (NULL);
}
-
hash_of_addr = sctp_get_ifa_hash_val(addr);
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)
@@ -5108,7 +5106,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? */
@@ -5184,7 +5182,6 @@ out:
if (so && r_unlocked && hold_rlock) {
SCTP_INP_READ_LOCK(stcb->sctp_ep);
}
-
SCTP_INP_DECR_REF(stcb->sctp_ep);
no_lock:
atomic_add_int(&stcb->asoc.refcnt, -1);
@@ -5234,7 +5231,6 @@ sctp_sorecvmsg(struct socket *so,
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL);
return (EINVAL);
}
-
if (msg_flags) {
in_flags = *msg_flags;
if (in_flags & MSG_PEEK)
@@ -5272,14 +5268,12 @@ 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) {
goto release_unlocked;
@@ -5389,7 +5383,6 @@ restart_nosblocks:
hold_rlock = 0;
goto restart;
}
-
if ((control->length == 0) &&
(control->do_not_ref_stcb)) {
/*
@@ -5573,11 +5566,10 @@ found_one:
control->do_not_ref_stcb == 0) {
stcb->asoc.strmin[control->sinfo_stream].delivery_started = 1;
}
-
/* 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;
@@ -5653,7 +5645,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;
}
@@ -5735,7 +5727,6 @@ get_more_data:
if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) {
goto release;
}
-
if ((control->do_not_ref_stcb == 0) && stcb &&
stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
no_rcv_needed = 1;
@@ -5916,7 +5907,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;
}
/*
@@ -5948,7 +5939,6 @@ wait_some_more:
if (so->so_rcv.sb_state & SBS_CANTRCVMORE) {
goto release;
}
-
if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)
goto release;
@@ -6077,7 +6067,6 @@ release:
SOCKBUF_UNLOCK(&so->so_rcv);
hold_sblock = 0;
}
-
sbunlock(&so->so_rcv);
sockbuf_lock = 0;
@@ -6115,7 +6104,6 @@ out:
if (sockbuf_lock) {
sbunlock(&so->so_rcv);
}
-
if (freecnt_applied) {
/*
* The lock on the socket buffer protects us so the free
@@ -6139,13 +6127,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);
}
@@ -6713,7 +6701,6 @@ sctp_local_addr_count(struct sctp_tcb *stcb)
SCTP_IPI_ADDR_RUNLOCK();
return (0);
}
-
if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
/*
* bound all case: go through all ifns on the vrf
@@ -7025,7 +7012,7 @@ sctp_recv_icmp_tunneled_packet(int cmd, struct sockaddr *sa, void *vip, void *ct
}
sctp_notify(inp, stcb, net, type, code,
ntohs(inner_ip->ip_len),
- (uint32_t) ntohs(icmp->icmp_nextmtu));
+ (uint32_t)ntohs(icmp->icmp_nextmtu));
} else {
if ((stcb == NULL) && (inp != NULL)) {
/* reduce ref-count */
@@ -7295,7 +7282,8 @@ sctp_over_udp_start(void)
* If all arguments are zero, zero is returned.
*/
uint32_t
-sctp_min_mtu(uint32_t mtu1, uint32_t mtu2, uint32_t mtu3) {
+sctp_min_mtu(uint32_t mtu1, uint32_t mtu2, uint32_t mtu3)
+{
if (mtu1 > 0) {
if (mtu2 > 0) {
if (mtu3 > 0) {
@@ -7349,7 +7337,8 @@ sctp_hc_set_mtu(union sctp_sockstore *addr, uint16_t fibnum, uint32_t mtu)
}
uint32_t
-sctp_hc_get_mtu(union sctp_sockstore *addr, uint16_t fibnum){
+sctp_hc_get_mtu(union sctp_sockstore *addr, uint16_t fibnum)
+{
struct in_conninfo inc;
memset(&inc, 0, sizeof(struct in_conninfo));
@@ -7369,5 +7358,5 @@ sctp_hc_get_mtu(union sctp_sockstore *addr, uint16_t fibnum){
default:
return (0);
}
- return ((uint32_t) tcp_hc_getmtu(&inc));
+ return ((uint32_t)tcp_hc_getmtu(&inc));
}
diff --git a/sys/netinet/sctputil.h b/sys/netinet/sctputil.h
index cf5929e5bf2e..61d345919d59 100644
--- a/sys/netinet/sctputil.h
+++ b/sys/netinet/sctputil.h
@@ -67,14 +67,16 @@ void
* Function prototypes
*/
int32_t
-sctp_map_assoc_state(int);
+ sctp_map_assoc_state(int);
uint32_t
-sctp_get_ifa_hash_val(struct sockaddr *addr);
+ sctp_get_ifa_hash_val(struct sockaddr *addr);
-struct sctp_ifa *sctp_find_ifa_in_ep(struct sctp_inpcb *inp, struct sockaddr *addr, int hold_lock);
+struct sctp_ifa *
+ sctp_find_ifa_in_ep(struct sctp_inpcb *inp, struct sockaddr *addr, int hold_lock);
-struct sctp_ifa *sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock);
+struct sctp_ifa *
+ sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock);
uint32_t sctp_select_initial_TSN(struct sctp_pcb *);
@@ -145,11 +147,13 @@ struct sctp_paramhdr *
sctp_get_next_param(struct mbuf *, int,
struct sctp_paramhdr *, int);
-struct mbuf *sctp_add_pad_tombuf(struct mbuf *, int);
+struct mbuf *
+ sctp_add_pad_tombuf(struct mbuf *, int);
-struct mbuf *sctp_pad_lastmbuf(struct mbuf *, int, struct mbuf *);
+struct mbuf *
+ sctp_pad_lastmbuf(struct mbuf *, int, struct mbuf *);
-void
+void
sctp_ulp_notify(uint32_t, struct sctp_tcb *, uint32_t, void *, int
#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
SCTP_UNUSED
@@ -164,7 +168,7 @@ sctp_pull_off_control_to_new_inp(struct sctp_inpcb *old_inp,
void sctp_stop_timers_for_shutdown(struct sctp_tcb *);
-void
+void
sctp_report_all_outbound(struct sctp_tcb *, uint16_t, int, int
#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
SCTP_UNUSED
@@ -173,7 +177,7 @@ sctp_report_all_outbound(struct sctp_tcb *, uint16_t, int, int
int sctp_expand_mapping_array(struct sctp_association *, uint32_t);
-void
+void
sctp_abort_notification(struct sctp_tcb *, uint8_t, uint16_t,
struct sctp_abort_chunk *, int
#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
@@ -199,7 +203,7 @@ sctp_abort_an_association(struct sctp_inpcb *, struct sctp_tcb *,
#endif
);
-void
+void
sctp_handle_ootb(struct mbuf *, int, int,
struct sockaddr *, struct sockaddr *,
struct sctphdr *, struct sctp_inpcb *,
@@ -207,7 +211,7 @@ sctp_handle_ootb(struct mbuf *, int, int,
uint8_t, uint32_t, uint16_t,
uint32_t, uint16_t);
-int
+int
sctp_connectx_helper_add(struct sctp_tcb *stcb, struct sockaddr *addr,
int totaddr, int *error);
@@ -220,7 +224,8 @@ int sctp_is_there_an_abort_here(struct mbuf *, int, uint32_t *);
#ifdef INET6
uint32_t sctp_is_same_scope(struct sockaddr_in6 *, struct sockaddr_in6 *);
-struct sockaddr_in6 *sctp_recover_scope(struct sockaddr_in6 *, struct sockaddr_in6 *);
+struct sockaddr_in6 *
+ sctp_recover_scope(struct sockaddr_in6 *, struct sockaddr_in6 *);
#define sctp_recover_scope_mac(addr, store) do { \
if ((addr->sin6_family == AF_INET6) && \
@@ -253,11 +258,11 @@ sctp_release_pr_sctp_chunk(struct sctp_tcb *, struct sctp_tmit_chunk *,
struct mbuf *sctp_generate_cause(uint16_t, char *);
struct mbuf *sctp_generate_no_user_data_cause(uint32_t);
-void
+void
sctp_bindx_add_address(struct socket *so, struct sctp_inpcb *inp,
struct sockaddr *sa, sctp_assoc_t assoc_id,
uint32_t vrf_id, int *error, void *p);
-void
+void
sctp_bindx_delete_address(struct sctp_inpcb *inp,
struct sockaddr *sa, sctp_assoc_t assoc_id,
uint32_t vrf_id, int *error);
diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c
index 6468f1b53269..61ba99c137a6 100644
--- a/sys/netinet6/sctp6_usrreq.c
+++ b/sys/netinet6/sctp6_usrreq.c
@@ -271,7 +271,6 @@ sctp6_ctlinput(int cmd, struct sockaddr *pktdst, void *d)
pktdst->sa_len != sizeof(struct sockaddr_in6)) {
return;
}
-
if ((unsigned)cmd >= PRC_NCMDS) {
return;
}
@@ -295,16 +294,14 @@ sctp6_ctlinput(int cmd, struct sockaddr *pktdst, void *d)
if (ip6cp->ip6c_m == NULL) {
return;
}
-
/*
* Check if we can safely examine the ports and the
* verification tag of the SCTP common header.
*/
if (ip6cp->ip6c_m->m_pkthdr.len <
- (int32_t) (ip6cp->ip6c_off + offsetof(struct sctphdr, checksum))) {
+ (int32_t)(ip6cp->ip6c_off + offsetof(struct sctphdr, checksum))) {
return;
}
-
/* Copy out the port numbers and the verification tag. */
memset(&sh, 0, sizeof(sh));
m_copydata(ip6cp->ip6c_m,
@@ -528,7 +525,6 @@ sctp6_attach(struct socket *so, int proto SCTP_UNUSED, struct thread *p SCTP_UNU
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL);
return (EINVAL);
}
-
if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) {
error = SCTP_SORESERVE(so, SCTP_BASE_SYSCTL(sctp_sendspace), SCTP_BASE_SYSCTL(sctp_recvspace));
if (error)
@@ -569,7 +565,6 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, struct thread *p)
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL);
return (EINVAL);
}
-
if (addr) {
switch (addr->sa_family) {
#ifdef INET
@@ -993,7 +988,7 @@ sctp6_getaddr(struct socket *so, struct sockaddr **addr)
return (ENOENT);
}
vrf_id = inp->def_vrf_id;
- sctp_ifa = sctp_source_address_selection(inp, stcb, (sctp_route_t *) & net->ro, net, 0, vrf_id);
+ sctp_ifa = sctp_source_address_selection(inp, stcb, (sctp_route_t *)&net->ro, net, 0, vrf_id);
if (sctp_ifa) {
sin6->sin6_addr = sctp_ifa->address.sin6.sin6_addr;
}
@@ -1106,7 +1101,6 @@ sctp6_in6getaddr(struct socket *so, struct sockaddr **nam)
SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL);
return (EINVAL);
}
-
/* allow v6 addresses precedence */
error = sctp6_getaddr(so, nam);
#ifdef INET
@@ -1142,7 +1136,6 @@ sctp6_getpeeraddr(struct socket *so, struct sockaddr **nam)
SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL);
return (EINVAL);
}
-
/* allow v6 addresses precedence */
error = sctp6_peeraddr(so, nam);
#ifdef INET
diff --git a/sys/netinet6/sctp6_var.h b/sys/netinet6/sctp6_var.h
index 4ad0ca2811c1..e3c4359a1480 100644
--- a/sys/netinet6/sctp6_var.h
+++ b/sys/netinet6/sctp6_var.h
@@ -45,11 +45,11 @@ extern struct pr_usrreqs sctp6_usrreqs;
int sctp6_input(struct mbuf **, int *, int);
int sctp6_input_with_port(struct mbuf **, int *, uint16_t);
-int
+int
sctp6_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *,
struct mbuf *, struct proc *);
void sctp6_ctlinput(int, struct sockaddr *, void *);
-void
+void
sctp6_notify(struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *,
uint8_t, uint8_t, uint32_t);
#endif