From b7b84c0e02d4be385b744b6061c63e7c0cccc4be Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Mon, 26 Dec 2016 11:06:41 +0000 Subject: [PATCH] Whitespace changes. The toolchain for processing the sources has been updated. No functional change. MFC after: 3 days --- sys/netinet/sctp_asconf.c | 74 ++++--- sys/netinet/sctp_auth.c | 102 +++++----- sys/netinet/sctp_auth.h | 90 ++++----- sys/netinet/sctp_bsd_addr.c | 4 +- sys/netinet/sctp_bsd_addr.h | 2 +- sys/netinet/sctp_cc_functions.c | 188 +++++++++-------- sys/netinet/sctp_crc32.c | 10 +- sys/netinet/sctp_indata.c | 243 +++++++++++++--------- sys/netinet/sctp_indata.h | 2 +- sys/netinet/sctp_input.c | 137 +++++++------ sys/netinet/sctp_input.h | 2 +- sys/netinet/sctp_output.c | 343 ++++++++++++++++++-------------- sys/netinet/sctp_output.h | 8 +- sys/netinet/sctp_pcb.c | 118 ++++++----- sys/netinet/sctp_pcb.h | 6 +- sys/netinet/sctp_ss_functions.c | 22 +- sys/netinet/sctp_structs.h | 10 +- sys/netinet/sctp_sysctl.c | 22 +- sys/netinet/sctp_timer.c | 22 +- sys/netinet/sctp_usrreq.c | 124 +++++++----- sys/netinet/sctputil.c | 178 +++++++++-------- sys/netinet/sctputil.h | 4 +- sys/netinet6/sctp6_usrreq.c | 6 +- 23 files changed, 978 insertions(+), 739 deletions(-) diff --git a/sys/netinet/sctp_asconf.c b/sys/netinet/sctp_asconf.c index 19a28eeeda3f..32efe29edef4 100644 --- a/sys/netinet/sctp_asconf.c +++ b/sys/netinet/sctp_asconf.c @@ -97,7 +97,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; @@ -132,7 +132,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; @@ -222,7 +222,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 */ @@ -237,7 +237,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, @@ -245,7 +245,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 */ @@ -367,7 +367,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); } @@ -377,7 +377,7 @@ 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); } @@ -391,7 +391,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 = @@ -410,7 +410,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) { @@ -492,7 +492,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); } @@ -563,7 +563,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); } @@ -658,7 +658,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"); @@ -668,7 +668,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; @@ -765,7 +765,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"); @@ -1094,7 +1094,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) @@ -1104,7 +1104,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; @@ -1112,7 +1112,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; @@ -2419,8 +2419,10 @@ sctp_is_addr_pending(struct sctp_tcb *stcb, struct sctp_ifa *sctp_ifa) } } - /* we want to find the sequences which consist of ADD -> DEL -> ADD - * or DEL -> ADD */ + /* + * we want to find the sequences which consist of ADD -> DEL -> ADD + * or DEL -> ADD + */ if (add_cnt > del_cnt || (add_cnt == del_cnt && last_param_type == SCTP_ADD_IP_ADDRESS)) { return (1); @@ -2472,8 +2474,10 @@ sctp_find_valid_localaddr(struct sctp_tcb *stcb, int addr_locked) if (sctp_is_addr_restricted(stcb, sctp_ifa) && (!sctp_is_addr_pending(stcb, sctp_ifa))) continue; - /* found a valid local v4 address to - * use */ + /* + * found a valid local v4 address to + * use + */ if (addr_locked == SCTP_ADDR_NOT_LOCKED) SCTP_IPI_ADDR_RUNLOCK(); return (&sctp_ifa->address.sa); @@ -2490,8 +2494,10 @@ sctp_find_valid_localaddr(struct sctp_tcb *stcb, int addr_locked) } sin6 = &sctp_ifa->address.sin6; if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { - /* we skip unspecifed - * addresses */ + /* + * we skip unspecifed + * addresses + */ continue; } if (prison_check_ip6(stcb->sctp_ep->ip_inp.inp.inp_cred, @@ -2508,8 +2514,10 @@ sctp_find_valid_localaddr(struct sctp_tcb *stcb, int addr_locked) if (sctp_is_addr_restricted(stcb, sctp_ifa) && (!sctp_is_addr_pending(stcb, sctp_ifa))) continue; - /* found a valid local v6 address to - * use */ + /* + * found a valid local v6 address to + * use + */ if (addr_locked == SCTP_ADDR_NOT_LOCKED) SCTP_IPI_ADDR_RUNLOCK(); return (&sctp_ifa->address.sa); @@ -2777,7 +2785,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); @@ -2791,7 +2799,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; @@ -2812,7 +2820,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; @@ -2874,7 +2882,7 @@ sctp_process_initack_addresses(struct sctp_tcb *stcb, struct mbuf *m, 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 */ } @@ -2925,7 +2933,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); @@ -2941,7 +2949,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); } @@ -2971,7 +2979,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); } @@ -2993,7 +3001,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); diff --git a/sys/netinet/sctp_auth.c b/sys/netinet/sctp_auth.c index 1c9d5282bcb4..e4abc973be50 100644 --- a/sys/netinet/sctp_auth.c +++ b/sys/netinet/sctp_auth.c @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); void -sctp_clear_chunklist(sctp_auth_chklist_t * chklist) +sctp_clear_chunklist(sctp_auth_chklist_t *chklist) { bzero(chklist, sizeof(*chklist)); /* chklist->num_chunks = 0; */ @@ -73,14 +73,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; @@ -102,7 +102,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); @@ -128,7 +128,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); @@ -144,7 +144,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); @@ -157,7 +157,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; @@ -174,7 +174,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; @@ -206,8 +206,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; @@ -257,14 +257,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; @@ -283,7 +283,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; @@ -302,7 +302,7 @@ 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); @@ -329,7 +329,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; @@ -349,7 +349,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; @@ -400,7 +400,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; @@ -474,7 +474,7 @@ sctp_alloc_sharedkey(void) } void -sctp_free_sharedkey(sctp_sharedkey_t * skey) +sctp_free_sharedkey(sctp_sharedkey_t *skey) { if (skey == NULL) return; @@ -500,7 +500,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; @@ -594,7 +594,7 @@ 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; @@ -652,7 +652,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 +661,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 +689,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 +727,7 @@ 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; @@ -754,7 +754,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; @@ -800,7 +800,7 @@ sctp_alloc_authinfo(void) } void -sctp_free_authinfo(sctp_authinfo_t * authinfo) +sctp_free_authinfo(sctp_authinfo_t *authinfo) { if (authinfo == NULL) return; @@ -858,7 +858,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: @@ -875,8 +875,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: @@ -893,8 +893,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: @@ -921,8 +921,8 @@ 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; @@ -981,8 +981,8 @@ 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; @@ -1029,17 +1029,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); } @@ -1064,9 +1064,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]; @@ -1097,8 +1097,8 @@ 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; @@ -1132,8 +1132,8 @@ 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; @@ -1164,7 +1164,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; @@ -1422,7 +1422,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); @@ -1489,7 +1489,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; @@ -1599,14 +1599,14 @@ sctp_bzero_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)) { + data = mtod(m_tmp, uint8_t *)+m_offset; + if (size > (uint32_t)SCTP_BUF_LEN(m_tmp)) { bzero(data, SCTP_BUF_LEN(m_tmp)); size -= SCTP_BUF_LEN(m_tmp); } else { diff --git a/sys/netinet/sctp_auth.h b/sys/netinet/sctp_auth.h index b98764e255cd..04fd6464dc49 100644 --- a/sys/netinet/sctp_auth.h +++ b/sys/netinet/sctp_auth.h @@ -51,12 +51,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; @@ -64,7 +64,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); @@ -72,14 +72,14 @@ 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 { @@ -91,7 +91,7 @@ typedef struct sctp_authinformation { 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; @@ -106,42 +106,42 @@ 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 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); +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); +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); +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 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_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); +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 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 sctp_insert_sharedkey(struct sctp_keyhead *shared_keys, - sctp_sharedkey_t * new_skey); + sctp_sharedkey_t *new_skey); extern int sctp_copy_skeylist(const struct sctp_keyhead *src, struct sctp_keyhead *dest); @@ -155,42 +155,42 @@ sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t keyid, /* 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 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); +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 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); +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); +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); +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); +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); +sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t *key, + struct mbuf *m, uint32_t m_offset, uint8_t *digest); /* * authentication routines @@ -212,7 +212,7 @@ 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 sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_auth_chunk *ch, diff --git a/sys/netinet/sctp_bsd_addr.c b/sys/netinet/sctp_bsd_addr.c index 6c0f6e171508..e16bc0dacea0 100644 --- a/sys/netinet/sctp_bsd_addr.c +++ b/sys/netinet/sctp_bsd_addr.c @@ -477,7 +477,7 @@ sctp_packet_log(struct mbuf *m) 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 +498,7 @@ sctp_packet_log(struct mbuf *m) 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 5fb1efb433e9..8c0383a5d8a1 100644 --- a/sys/netinet/sctp_bsd_addr.h +++ b/sys/netinet/sctp_bsd_addr.h @@ -53,7 +53,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 f73570c1be72..954a79977f35 100644 --- a/sys/netinet/sctp_cc_functions.c +++ b/sys/netinet/sctp_cc_functions.c @@ -122,7 +122,7 @@ 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) { @@ -150,27 +150,31 @@ 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) { uint32_t srtt; srtt = net->lastsa; - /* lastsa>>3; we don't need - * to devide ... */ + /* + * lastsa>>3; we don't need + * to devide ... + */ if (srtt == 0) { srtt = 1; } - /* 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 * + /* + * 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 * t_ucwnd_sbw)); /* INCREASE FACTOR */ ; } @@ -249,7 +253,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 @@ -385,7 +389,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 */ @@ -401,8 +405,10 @@ cc_bw_decrease(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, uint6 net->flight_size, probepoint); if (net->cc_mod.rtcc.ret_from_eq) { - /* Switch over to CA if we are less - * aggressive */ + /* + * Switch over to CA if we are less + * aggressive + */ net->ssthresh = net->cwnd - 1; net->partial_bytes_acked = 0; } @@ -528,7 +534,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), @@ -610,8 +616,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; @@ -631,7 +637,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); } @@ -703,11 +709,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; } @@ -795,10 +801,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, @@ -830,13 +836,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; } @@ -845,20 +851,22 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb, } break; case SCTP_CMT_RPV2: - /* lastsa>>3; we don't need - * to divide ... */ + /* + * lastsa>>3; we don't need + * to divide ... + */ srtt = net->lastsa; 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; @@ -868,11 +876,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) { @@ -922,23 +930,25 @@ 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; } break; case SCTP_CMT_RPV2: - /* lastsa>>3; we don't need - * to divide ... */ + /* + * lastsa>>3; we don't need + * to divide ... + */ srtt = net->lastsa; 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) { @@ -946,8 +956,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; @@ -1021,7 +1031,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) { @@ -1031,10 +1041,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; @@ -1043,9 +1053,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; } @@ -1098,8 +1108,10 @@ sctp_cwnd_update_after_ecn_echo_common(struct sctp_tcb *stcb, struct sctp_nets * sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); } } else { - /* Further tuning down required over the drastic - * original cut */ + /* + * Further tuning down required over the drastic + * original cut + */ net->ssthresh -= (net->mtu * num_pkt_lost); net->cwnd -= (net->mtu * num_pkt_lost); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) { @@ -1113,8 +1125,10 @@ sctp_cwnd_update_after_ecn_echo_common(struct sctp_tcb *stcb, struct sctp_nets * net->ssthresh = net->cwnd / 2; if (net->ssthresh < net->mtu) { net->ssthresh = net->mtu; - /* here back off the timer as well, to slow - * us down */ + /* + * here back off the timer as well, to slow + * us down + */ net->RTO <<= 1; } net->cwnd = net->ssthresh; @@ -1134,7 +1148,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; @@ -1152,7 +1166,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 @@ -1331,9 +1345,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, @@ -1361,8 +1375,10 @@ sctp_cwnd_new_rtcc_transmission_begins(struct sctp_tcb *stcb, cwnd_in_mtu = SCTP_BASE_SYSCTL(sctp_initial_cwnd); if (cwnd_in_mtu == 0) { - /* Using 0 means that the value of RFC 4960 - * is used. */ + /* + * Using 0 means that the value of RFC 4960 + * is used. + */ cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); } else { /* @@ -1374,8 +1390,10 @@ sctp_cwnd_new_rtcc_transmission_begins(struct sctp_tcb *stcb, cwnd = (net->mtu - sizeof(struct sctphdr)) * cwnd_in_mtu; } if (net->cwnd > cwnd) { - /* Only set if we are not a timeout (i.e. - * down to 1 mtu) */ + /* + * Only set if we are not a timeout (i.e. + * down to 1 mtu) + */ net->cwnd = cwnd; } } @@ -1390,10 +1408,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, @@ -1614,7 +1632,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); @@ -1640,7 +1658,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; @@ -1951,7 +1969,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; @@ -1970,7 +1988,7 @@ 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; } @@ -2005,8 +2023,10 @@ htcp_param_update(struct sctp_nets *net) htcp_beta_update(&net->cc_mod.htcp_ca, minRTT, maxRTT); htcp_alpha_update(&net->cc_mod.htcp_ca); - /* add slowly fading memory for maxRTT to accommodate routing - * changes etc */ + /* + * add slowly fading memory for maxRTT to accommodate routing + * changes etc + */ if (minRTT > 0 && maxRTT > minRTT) net->cc_mod.htcp_ca.maxRTT = minRTT + ((maxRTT - minRTT) * 95) / 100; } diff --git a/sys/netinet/sctp_crc32.c b/sys/netinet/sctp_crc32.c index 58abce23c7f4..93d26ea3585d 100644 --- a/sys/netinet/sctp_crc32.c +++ b/sys/netinet/sctp_crc32.c @@ -90,7 +90,7 @@ sctp_calculate_cksum(struct mbuf *m, uint32_t offset) at = m; /* find the correct mbuf and offset into mbuf */ - while ((at != NULL) && (offset > (uint32_t) SCTP_BUF_LEN(at))) { + while ((at != NULL) && (offset > (uint32_t)SCTP_BUF_LEN(at))) { offset -= SCTP_BUF_LEN(at); /* update remaining offset * left */ at = SCTP_BUF_NEXT(at); @@ -103,7 +103,7 @@ sctp_calculate_cksum(struct mbuf *m, uint32_t offset) } if (offset) { /* we only offset once into the first mbuf */ - if (offset < (uint32_t) SCTP_BUF_LEN(at)) + if (offset < (uint32_t)SCTP_BUF_LEN(at)) offset = 0; else offset -= SCTP_BUF_LEN(at); @@ -131,9 +131,9 @@ 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)) { SCTP_PRINTF("sctp_delayed_cksum(): m->len: %d, off: %d.\n", - (uint32_t) m->m_len, offset); + (uint32_t)m->m_len, offset); /* * XXX this shouldn't happen, but if it does, the correct * behavior may be to insert the checksum in the appropriate @@ -141,6 +141,6 @@ sctp_delayed_cksum(struct mbuf *m, uint32_t offset) */ return; } - *(uint32_t *) (m->m_data + offset) = checksum; + *(uint32_t *)(m->m_data + offset) = checksum; #endif } diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c index e8d79de0c96a..1e6ebd934828 100644 --- a/sys/netinet/sctp_indata.c +++ b/sys/netinet/sctp_indata.c @@ -96,14 +96,14 @@ 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 */ @@ -341,8 +341,10 @@ sctp_place_control_in_stream(struct sctp_stream_in *strm, q = &strm->uno_inqueue; if (asoc->idata_supported == 0) { if (!TAILQ_EMPTY(q)) { - /* Only one stream can be here in old style - * -- abort */ + /* + * Only one stream can be here in old style + * -- abort + */ return (-1); } TAILQ_INSERT_TAIL(q, control, next_instrm); @@ -435,7 +437,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); @@ -519,10 +521,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; @@ -832,8 +834,10 @@ sctp_handle_old_unordered_data(struct sctp_tcb *stcb, TAILQ_INSERT_TAIL(&nc->reasm, tchk, sctp_next); tchk = TAILQ_FIRST(&control->reasm); } - /* Now lets add it to the queue - * after removing control */ + /* + * Now lets add it to the queue + * after removing control + */ TAILQ_INSERT_TAIL(&strm->uno_inqueue, nc, next_instrm); nc->on_strm_q = SCTP_ON_UNORDERED; if (control->on_strm_q) { @@ -857,8 +861,10 @@ sctp_handle_old_unordered_data(struct sctp_tcb *stcb, } sctp_wakeup_the_read_socket(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); if ((nc->first_frag_seen) && !TAILQ_EMPTY(&nc->reasm)) { - /* Switch to the new guy and - * continue */ + /* + * Switch to the new guy and + * continue + */ control = nc; goto restart; } else { @@ -918,8 +924,10 @@ sctp_inject_old_unordered_data(struct sctp_tcb *stcb, uint32_t tmp; if (SCTP_TSN_GT(chk->rec.data.fsn, control->fsn_included)) { - /* Easy way the start of a new guy beyond - * the lowest */ + /* + * Easy way the start of a new guy beyond + * the lowest + */ goto place_chunk; } if ((chk->rec.data.fsn == control->fsn_included) || @@ -1135,8 +1143,10 @@ sctp_deliver_reasm_check(struct sctp_tcb *stcb, struct sctp_association *asoc, } } if (strm->pd_api_started) { - /* Can't add more must have gotten an un-ordered above being - * partially delivered. */ + /* + * Can't add more must have gotten an un-ordered above being + * partially delivered. + */ return (0); } deliver_more: @@ -1168,15 +1178,21 @@ sctp_deliver_reasm_check(struct sctp_tcb *stcb, struct sctp_association *asoc, ret++; } if (((control->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { - /* A singleton now slipping through - mark - * it non-revokable too */ + /* + * A singleton now slipping through - mark + * it non-revokable too + */ sctp_mark_non_revokable(asoc, control->sinfo_tsn); } else if (control->end_added == 0) { - /* Check if we can defer adding until its - * all there */ + /* + * Check if we can defer adding until its + * all there + */ if ((control->length < pd_point) || (strm->pd_api_started)) { - /* Don't need it or cannot add more - * (one being delivered that way) */ + /* + * Don't need it or cannot add more + * (one being delivered that way) + */ goto out; } } @@ -1383,8 +1399,10 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc, * we know the first FSN (which is the TSN). */ if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn)) { - /* We have already delivered up to - * this so its a dup */ + /* + * We have already delivered up to + * this so its a dup + */ sctp_abort_in_reasm(stcb, control, chk, abort_flag, SCTP_FROM_SCTP_INDATA + SCTP_LOC_9); @@ -1411,8 +1429,10 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc, */ if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn)) { - /* We have already delivered up to - * this so its a dup */ + /* + * We have already delivered up to + * this so its a dup + */ SCTPDBG(SCTP_DEBUG_XXX, "New fsn: %u is already seen in included_fsn: %u -- abort\n", chk->rec.data.fsn, control->fsn_included); @@ -1422,8 +1442,10 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc, return; } } - /* validate not beyond top FSN if we have seen last - * one */ + /* + * validate not beyond top FSN if we have seen last + * one + */ if (SCTP_TSN_GT(chk->rec.data.fsn, control->top_fsn)) { SCTPDBG(SCTP_DEBUG_XXX, "New fsn: %u is beyond or at top_fsn: %u -- abort\n", @@ -1457,8 +1479,10 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc, inserted = 1; break; } else if (at->rec.data.fsn == chk->rec.data.fsn) { - /* Gak, He sent me a duplicate str seq - * number */ + /* + * Gak, He sent me a duplicate str seq + * number + */ /* * foo bar, I guess I will just free this * new guy, should we abort too? FIX ME @@ -1563,7 +1587,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) { /* Process a data chunk */ @@ -1588,7 +1612,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); @@ -1605,12 +1629,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; } @@ -1652,7 +1676,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 */ @@ -1763,15 +1787,19 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, return (0); } if (ordered && ((control->sinfo_flags >> 8) & SCTP_DATA_UNORDERED)) { - /* We can't have a switched order with an - * unordered chunk */ + /* + * We can't have a switched order with an + * unordered chunk + */ snprintf(msg, sizeof(msg), "All fragments of a user message must be ordered or unordered (TSN=%8.8x)", tsn); goto err_out; } if (!ordered && (((control->sinfo_flags >> 8) & SCTP_DATA_UNORDERED) == 0)) { - /* We can't have a switched unordered with a - * ordered chunk */ + /* + * We can't have a switched unordered with a + * ordered chunk + */ snprintf(msg, sizeof(msg), "All fragments of a user message must be ordered or unordered (TSN=%8.8x)", tsn); goto err_out; @@ -1896,10 +1924,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; @@ -2392,8 +2420,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) { @@ -2405,8 +2433,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 { @@ -2488,7 +2516,8 @@ sctp_sack_check(struct sctp_tcb *stcb, int was_a_gap) (stcb->asoc.numduptsns) || /* we have dup's */ (is_a_gap) || /* is still a gap */ (stcb->asoc.delayed_ack == 0) || /* Delayed sack disabled */ - (stcb->asoc.data_pkts_seen >= stcb->asoc.sack_freq) /* hit limit of pkts */ ) { + (stcb->asoc.data_pkts_seen >= stcb->asoc.sack_freq) /* hit limit of pkts */ + ) { if ((stcb->asoc.sctp_cmt_on_off > 0) && (SCTP_BASE_SYSCTL(sctp_cmt_use_dac)) && @@ -2531,7 +2560,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; @@ -2592,7 +2621,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); + sizeof(struct sctp_chunkhdr), (uint8_t *)&chunk_buf); if (ch == NULL) { return (1); } @@ -2737,7 +2766,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) { @@ -2751,7 +2780,8 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, /* discard the rest of this packet */ stop_proc = 1; } /* else skip this bad chunk and - * continue... */ break; + * continue... */ + break; } /* switch of chunk type */ } *offset += SCTP_SIZE32(chk_length); @@ -2761,7 +2791,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, continue; } ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, - sizeof(struct sctp_chunkhdr), (uint8_t *) & chunk_buf); + sizeof(struct sctp_chunkhdr), (uint8_t *)&chunk_buf); if (ch == NULL) { *offset = length; stop_proc = 1; @@ -2804,8 +2834,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; @@ -2926,7 +2956,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); @@ -3008,8 +3038,10 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1 } tp1->sent = SCTP_DATAGRAM_NR_ACKED; if (tp1->data) { - /* sa_ignore - * NO_NULL_CHK */ + /* + * sa_ignore + * NO_NULL_CHK + */ sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1); sctp_m_freem(tp1->data); tp1->data = NULL; @@ -3018,7 +3050,8 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1 } } break; - } /* if (tp1->tsn == theTSN) */ if (SCTP_TSN_GT(tp1->rec.data.tsn, theTSN)) { + } /* if (tp1->tsn == theTSN) */ + if (SCTP_TSN_GT(tp1->rec.data.tsn, theTSN)) { break; } tp1 = TAILQ_NEXT(tp1, sctp_next); @@ -3040,8 +3073,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; @@ -3062,7 +3095,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); @@ -3132,7 +3165,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); @@ -3446,7 +3479,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) { @@ -3469,8 +3502,10 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc, if ((stcb->asoc.prsctp_supported) && (PR_SCTP_RTX_ENABLED(tp1->flags))) { - /* Has it been retransmitted tv_sec times? - - * we store the retran count there. */ + /* + * Has it been retransmitted tv_sec times? - + * we store the retran count there. + */ if (tp1->snd_count > tp1->rec.data.timetodrop.tv_sec) { /* Yes, so drop it */ if (tp1->data != NULL) { @@ -3482,8 +3517,10 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc, continue; } } - /* SCTP_PRINTF("OK, we are now ready to FR this - * guy\n"); */ + /* + * SCTP_PRINTF("OK, we are now ready to FR this + * guy\n"); + */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { sctp_log_fr(tp1->rec.data.tsn, tp1->snd_count, 0, SCTP_FR_MARKED); @@ -3503,14 +3540,18 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc, alt = tp1->whoTo; /* sa_ignore NO_NULL_CHK */ if (asoc->sctp_cmt_pf > 0) { - /* JRS 5/18/07 - If CMT PF is on, + /* + * JRS 5/18/07 - If CMT PF is on, * use the PF version of - * find_alt_net() */ + * find_alt_net() + */ alt = sctp_find_alternate_net(stcb, alt, 2); } else { - /* JRS 5/18/07 - If only CMT is on, + /* + * JRS 5/18/07 - If only CMT is on, * use the CMT version of - * find_alt_net() */ + * find_alt_net() + */ /* sa_ignore NO_NULL_CHK */ alt = sctp_find_alternate_net(stcb, alt, 1); } @@ -3748,7 +3789,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; } @@ -3767,7 +3808,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); } } @@ -3806,7 +3847,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; @@ -3883,7 +3924,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); @@ -4041,8 +4082,10 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack, } if (net == stcb->asoc.primary_destination) { if (stcb->asoc.alternate) { - /* release the alternate, - * primary is good */ + /* + * release the alternate, + * primary is good + */ sctp_free_remote_addr(stcb->asoc.alternate); stcb->asoc.alternate = NULL; } @@ -4082,7 +4125,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack, } /* 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; @@ -4125,8 +4168,10 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack, } } else { if (net->window_probe) { - /* In window probes we must assure a timer - * is still running there */ + /* + * In window probes we must assure a timer + * is still running there + */ net->window_probe = 0; if (!SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { SCTP_OS_TIMER_START(&net->rxt_timer.timer, to_ticks, @@ -4365,8 +4410,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; } @@ -4497,7 +4542,7 @@ sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup, 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); @@ -4768,7 +4813,7 @@ sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup, 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); @@ -4811,8 +4856,10 @@ sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup, } if (net == stcb->asoc.primary_destination) { if (stcb->asoc.alternate) { - /* release the alternate, - * primary is good */ + /* + * release the alternate, + * primary is good + */ sctp_free_remote_addr(stcb->asoc.alternate); stcb->asoc.alternate = NULL; } @@ -4981,7 +5028,7 @@ sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup, 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; @@ -5023,8 +5070,10 @@ sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup, } } else { if (net->window_probe) { - /* In window probes we must assure a timer - * is still running there */ + /* + * In window probes we must assure a timer + * is still running there + */ if (!SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net); @@ -5175,8 +5224,10 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb, } else { /* Its a fragmented message */ if (ctl->first_frag_seen) { - /* Make it so this is next to - * deliver, we restore later */ + /* + * Make it so this is next to + * deliver, we restore later + */ strmin->last_mid_delivered = ctl->mid - 1; need_reasm_check = 1; break; @@ -5240,8 +5291,10 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb, } else { /* Its a fragmented message */ if (ctl->first_frag_seen) { - /* Make it so this is next to - * deliver */ + /* + * Make it so this is next to + * deliver + */ strmin->last_mid_delivered = ctl->mid - 1; need_reasm_check = 1; break; @@ -5470,7 +5523,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; @@ -5486,13 +5539,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 e277ae8869df..badd269d6ebe 100644 --- a/sys/netinet/sctp_indata.h +++ b/sys/netinet/sctp_indata.h @@ -79,7 +79,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, diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 9032f6c7b830..5aa56ba809cc 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -460,7 +460,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) { @@ -532,7 +532,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) { @@ -707,8 +707,10 @@ sctp_handle_nat_colliding_state(struct sctp_tcb *stcb) LIST_REMOVE(stcb, sctp_asocs); stcb->asoc.my_vtag = sctp_select_a_tag(stcb->sctp_ep, stcb->sctp_ep->sctp_lport, stcb->rport, 1); head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, SCTP_BASE_INFO(hashasocmark))]; - /* put it in the bucket in the vtag hash of assoc's for the - * system */ + /* + * put it in the bucket in the vtag hash of assoc's for the + * system + */ LIST_INSERT_HEAD(head, stcb, sctp_asocs); sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); return (1); @@ -726,8 +728,10 @@ sctp_handle_nat_colliding_state(struct sctp_tcb *stcb) sctp_toss_old_cookies(stcb, &stcb->asoc); stcb->asoc.my_vtag = sctp_select_a_tag(stcb->sctp_ep, stcb->sctp_ep->sctp_lport, stcb->rport, 1); head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, SCTP_BASE_INFO(hashasocmark))]; - /* put it in the bucket in the vtag hash of assoc's for the - * system */ + /* + * put it in the bucket in the vtag hash of assoc's for the + * system + */ LIST_INSERT_HEAD(head, stcb, sctp_asocs); sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); return (1); @@ -937,8 +941,10 @@ sctp_handle_shutdown(struct sctp_shutdown_chunk *cp, (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT)) { SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_RECEIVED); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); - /* notify upper layer that peer has initiated a - * shutdown */ + /* + * notify upper layer that peer has initiated a + * shutdown + */ sctp_ulp_notify(SCTP_NOTIFY_PEER_SHUTDOWN, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); /* reset time */ @@ -1099,7 +1105,7 @@ sctp_process_unrecog_chunk(struct sctp_tcb *stcb, struct sctp_paramhdr *phdr, default: SCTPDBG(SCTP_DEBUG_INPUT2, "Peer does not support chunk type %d(%x)??\n", - chk->chunk_type, (uint32_t) chk->chunk_type); + chk->chunk_type, (uint32_t)chk->chunk_type); break; } } @@ -1142,7 +1148,7 @@ sctp_process_unrecog_param(struct sctp_tcb *stcb, struct sctp_paramhdr *phdr) default: SCTPDBG(SCTP_DEBUG_INPUT2, "Peer does not support param type %d(%x)??\n", - pbad->param_type, (uint32_t) pbad->param_type); + pbad->param_type, (uint32_t)pbad->param_type); break; } } @@ -1512,7 +1518,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); @@ -1527,7 +1533,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); @@ -2061,7 +2067,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, @@ -2079,7 +2085,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"); @@ -2489,17 +2495,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); @@ -2512,7 +2518,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) @@ -2540,7 +2546,7 @@ 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); } /* @@ -2861,8 +2867,10 @@ 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 */ + /* + * Pull it from the incomplete queue and wake the + * guy + */ #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) atomic_add_int(&(*stcb)->asoc.refcnt, 1); SCTP_TCB_UNLOCK((*stcb)); @@ -3074,8 +3082,10 @@ sctp_handle_ecn_echo(struct sctp_ecne_chunk *cp, } if (SCTP_TSN_GT(tsn, net->cwr_window_tsn) && ((override_bit & SCTP_CWR_REDUCE_OVERRIDE) == 0)) { - /* JRS - Use the congestion control given in the pluggable - * CC module */ + /* + * JRS - Use the congestion control given in the pluggable + * CC module + */ stcb->asoc.cc_functions.sctp_cwnd_update_after_ecn_echo(stcb, net, 0, pkt_cnt); /* * We reduce once every RTT. So we will only lower cwnd at @@ -3271,7 +3281,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; @@ -3326,7 +3336,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) { @@ -3398,8 +3408,10 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc, case SCTP_HEARTBEAT_REQUEST: /* resend a demand HB */ if ((stcb->asoc.overall_error_count + 3) < stcb->asoc.max_send_times) { - /* Only retransmit if we KNOW we wont destroy the - * tcb */ + /* + * Only retransmit if we KNOW we wont destroy the + * tcb + */ sctp_send_hb(stcb, net, SCTP_SO_NOT_LOCKED); } break; @@ -3455,7 +3467,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; @@ -3483,7 +3495,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; @@ -3508,7 +3520,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; @@ -3640,8 +3652,10 @@ sctp_handle_stream_reset_response(struct sctp_tcb *stcb, } else if (action == SCTP_STREAM_RESET_RESULT_DENIED) { sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_OUT, stcb, number_entries, req_out_param->list_of_streams, SCTP_SO_NOT_LOCKED); } else if (action == SCTP_STREAM_RESET_RESULT_IN_PROGRESS) { - /* Set it up so we don't stop - * retransmitting */ + /* + * Set it up so we don't stop + * retransmitting + */ asoc->stream_reset_outstanding++; stcb->asoc.str_reset_seq_out--; asoc->stream_reset_out_is_outstanding = 1; @@ -3743,8 +3757,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), @@ -3877,8 +3891,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); } @@ -4127,9 +4141,9 @@ sctp_handle_str_reset_add_out_strm(struct sctp_tcb *stcb, struct sctp_tmit_chunk #ifdef __GNUC__ __attribute__((noinline)) #endif - static int - sctp_handle_stream_reset(struct sctp_tcb *stcb, struct mbuf *m, int offset, - struct sctp_chunkhdr *ch_req) +static int +sctp_handle_stream_reset(struct sctp_tcb *stcb, struct mbuf *m, int offset, + struct sctp_chunkhdr *ch_req) { uint16_t remaining_length, param_len, ptype; struct sctp_paramhdr pstore; @@ -4183,7 +4197,7 @@ __attribute__((noinline)) 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; @@ -4195,7 +4209,7 @@ __attribute__((noinline)) 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; @@ -4328,7 +4342,7 @@ 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; } @@ -4374,7 +4388,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]; } @@ -4465,13 +4479,13 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk *cp, #ifdef __GNUC__ __attribute__((noinline)) #endif - static struct sctp_tcb * - sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, - struct sockaddr *src, struct sockaddr *dst, - struct sctphdr *sh, struct sctp_chunkhdr *ch, struct sctp_inpcb *inp, - struct sctp_tcb *stcb, struct sctp_nets **netp, int *fwd_tsn_seen, - uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, - uint32_t vrf_id, uint16_t port) +static struct sctp_tcb * +sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, + struct sockaddr *src, struct sockaddr *dst, + struct sctphdr *sh, struct sctp_chunkhdr *ch, struct sctp_inpcb *inp, + struct sctp_tcb *stcb, struct sctp_nets **netp, int *fwd_tsn_seen, + uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, + uint32_t vrf_id, uint16_t port) { struct sctp_association *asoc; struct mbuf *op_err; @@ -4695,8 +4709,10 @@ __attribute__((noinline)) return (NULL); } } - } /* end if !SCTP_COOKIE_ECHO *//* process all - * control chunks... */ + } /* end if !SCTP_COOKIE_ECHO */ + /* + * process all control chunks... + */ if (((ch->chunk_type == SCTP_SELECTIVE_ACK) || (ch->chunk_type == SCTP_NR_SELECTIVE_ACK) || (ch->chunk_type == SCTP_HEARTBEAT_REQUEST)) && @@ -4943,7 +4959,7 @@ __attribute__((noinline)) cum_ack = ntohl(sack->sack.cum_tsn_ack); num_seg = ntohs(sack->sack.num_gap_ack_blks); num_dup = ntohs(sack->sack.num_dup_tsns); - a_rwnd = (uint32_t) ntohl(sack->sack.a_rwnd); + a_rwnd = (uint32_t)ntohl(sack->sack.a_rwnd); if (sizeof(struct sctp_sack_chunk) + num_seg * sizeof(struct sctp_gap_ack_block) + num_dup * sizeof(uint32_t) != chk_length) { @@ -4990,8 +5006,10 @@ __attribute__((noinline)) } } break; - /* EY - nr_sack: If the received chunk is an - * nr_sack chunk */ + /* + * EY - nr_sack: If the received chunk is an + * nr_sack chunk + */ case SCTP_NR_SELECTIVE_ACK: { struct sctp_nr_sack_chunk *nr_sack; @@ -5028,7 +5046,7 @@ __attribute__((noinline)) num_seg = ntohs(nr_sack->nr_sack.num_gap_ack_blks); num_nr_seg = ntohs(nr_sack->nr_sack.num_nr_gap_ack_blks); num_dup = ntohs(nr_sack->nr_sack.num_dup_tsns); - a_rwnd = (uint32_t) ntohl(nr_sack->nr_sack.a_rwnd); + a_rwnd = (uint32_t)ntohl(nr_sack->nr_sack.a_rwnd); if (sizeof(struct sctp_nr_sack_chunk) + (num_seg + num_nr_seg) * sizeof(struct sctp_gap_ack_block) + num_dup * sizeof(uint32_t) != chk_length) { @@ -5587,10 +5605,10 @@ __attribute__((noinline)) 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) { @@ -5609,7 +5627,8 @@ __attribute__((noinline)) /* discard this packet */ *offset = length; return (stcb); - } /* else skip this bad chunk and continue... */ break; + } /* else skip this bad chunk and continue... */ + break; } /* switch (ch->chunk_type) */ diff --git a/sys/netinet/sctp_input.h b/sys/netinet/sctp_input.h index 148864b64caf..25df0f3ba13e 100644 --- a/sys/netinet/sctp_input.h +++ b/sys/netinet/sctp_input.h @@ -54,7 +54,7 @@ sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, 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 3f86e0145d99..0983c0932a21 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -1937,7 +1937,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 *parmh; @@ -1948,12 +1948,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: @@ -2028,7 +2028,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; @@ -2138,8 +2138,10 @@ sctp_add_addresses_to_i_ia(struct sctp_inpcb *inp, struct sctp_tcb *stcb, cnt++; total_count++; if (cnt >= 2) { - /* two from each - * address */ + /* + * two from each + * address + */ break; } if (total_count > SCTP_ADDRESS_LIMIT) { @@ -2450,7 +2452,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, @@ -2582,7 +2584,7 @@ sctp_choose_boundspecific_inp(struct sctp_inpcb *inp, 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, @@ -2776,7 +2778,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; @@ -2825,8 +2827,10 @@ sctp_select_nth_preferred_addr_from_ifn_boundall(struct sctp_ifn *ifn, if (fam == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&sifa->address.sin6.sin6_addr) && IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr)) { - /* link-local <-> link-local must belong to the same - * scope. */ + /* + * link-local <-> link-local must belong to the same + * scope. + */ memcpy(&lsa6, &sifa->address.sin6, sizeof(struct sockaddr_in6)); (void)sa6_recoverscope(&lsa6); if (sin6.sin6_scope_id != lsa6.sin6_scope_id) { @@ -2947,7 +2951,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, @@ -3300,7 +3304,7 @@ sctp_choose_boundall(struct sctp_inpcb *inp, 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) { @@ -3808,7 +3812,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; @@ -3887,7 +3891,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; @@ -4100,7 +4104,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; @@ -4163,7 +4167,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 { @@ -4201,9 +4205,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); @@ -4264,8 +4268,10 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, /* free tempy routes */ RO_RTFREE(ro); } else { - /* PMTU check versus smallest asoc MTU goes - * here */ + /* + * PMTU check versus smallest asoc MTU goes + * here + */ if ((ro->ro_rt != NULL) && (net->ro._s_addr)) { uint32_t mtu; @@ -4357,10 +4363,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 @@ -4389,7 +4395,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, } else { ip6h->ip6_nxt = IPPROTO_SCTP; } - ip6h->ip6_plen = (uint16_t) (packet_length - sizeof(struct ip6_hdr)); + ip6h->ip6_plen = (uint16_t)(packet_length - sizeof(struct ip6_hdr)); ip6h->ip6_dst = sin6->sin6_addr; /* @@ -4508,7 +4514,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 { @@ -4540,8 +4546,10 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT3, (struct sockaddr *)sin6); if (net) { sin6 = (struct sockaddr_in6 *)&net->ro._l_addr; - /* preserve the port and scope for link - * local send */ + /* + * preserve the port and scope for link + * local send + */ prev_scope = sin6->sin6_scope_id; prev_port = sin6->sin6_port; } @@ -4607,8 +4615,10 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, /* Now if we had a temp route free it */ RO_RTFREE(ro); } else { - /* PMTU check versus smallest asoc MTU goes - * here */ + /* + * PMTU check versus smallest asoc MTU goes + * here + */ if (ro->ro_rt == NULL) { /* Route was freed */ if (net->ro._s_addr && @@ -4711,7 +4721,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 *); @@ -4731,7 +4741,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); @@ -4740,7 +4750,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); @@ -4748,7 +4758,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); @@ -4756,7 +4766,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); @@ -4791,7 +4801,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; @@ -4809,7 +4819,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; @@ -4825,11 +4835,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; } @@ -4843,7 +4853,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); @@ -4861,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); @@ -4877,12 +4887,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); @@ -5561,7 +5571,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, 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; /* @@ -5678,8 +5688,10 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, * show up in our scoped count. */ cnt_inits_to = 1; - /* pull out the scope_id from - * incoming pkt */ + /* + * pull out the scope_id from + * incoming pkt + */ } else if (IN6_IS_ADDR_SITELOCAL(&src6->sin6_addr) || IN6_IS_ADDR_SITELOCAL(&dst6->sin6_addr)) { /* @@ -5741,7 +5753,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, * 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; @@ -5771,7 +5783,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, * 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; @@ -5879,7 +5891,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, /* 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); @@ -5889,7 +5901,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, /* 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); @@ -5898,7 +5910,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, /* 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); @@ -5906,7 +5918,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } /* 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); @@ -5949,7 +5961,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, 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; @@ -5969,7 +5981,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } /* 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); @@ -5984,9 +5996,9 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } /* 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; @@ -5999,7 +6011,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } /* 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); @@ -6085,9 +6097,9 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, * 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. @@ -6165,9 +6177,9 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, if (freed_spc >= dataout) { return; } - } /* if chunk was present */ - } /* if of sufficient priority */ - } /* if chunk has enabled */ + } /* if chunk was present */ + } /* if of sufficient priority */ + } /* if chunk has enabled */ } /* tailqforeach */ TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) { @@ -6188,11 +6200,11 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, if (freed_spc >= dataout) { return; } - } /* end if chk->data */ - } /* end if right class */ - } /* end if chk pr-sctp */ + } /* end if chk->data */ + } /* end if right class */ + } /* end if chk pr-sctp */ } /* tailqforeachsafe (chk) */ - } /* if enabled in asoc */ + } /* if enabled in asoc */ } int @@ -6435,8 +6447,10 @@ sctp_copy_mbufchain(struct mbuf *clonechain, /* get the prepend space */ SCTP_BUF_RESV_UF(outchain, (SCTP_FIRST_MBUF_RESV + 4)); } else { - /* We really should not get a NULL - * in endofchain */ + /* + * We really should not get a NULL + * in endofchain + */ /* find end */ m = outchain; while (m) { @@ -6448,8 +6462,10 @@ sctp_copy_mbufchain(struct mbuf *clonechain, } /* sanity */ if (*endofchain == NULL) { - /* huh, TSNH XXX maybe we - * should panic */ + /* + * huh, TSNH XXX maybe we + * should panic + */ sctp_m_freem(outchain); goto new_mbuf; } @@ -6612,7 +6628,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 @@ -6648,13 +6664,17 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr, if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { goto abort_anyway; } - /* there is nothing queued to send, so I'm - * done... */ + /* + * there is nothing queued to send, so I'm + * done... + */ if ((SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT) && (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_RECEIVED) && (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) { - /* only send SHUTDOWN the first time - * through */ + /* + * only send SHUTDOWN the first time + * through + */ if (SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); } @@ -6977,7 +6997,7 @@ sctp_clean_up_datalist(struct sctp_tcb *stcb, 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]); @@ -6987,7 +7007,7 @@ sctp_clean_up_datalist(struct sctp_tcb *stcb, 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; @@ -7285,8 +7305,10 @@ sctp_move_to_outqueue(struct sctp_tcb *stcb, SCTP_TCB_SEND_LOCK(stcb); send_lock_up = 1; if (sp->msg_is_complete) { - /* the sender finished the - * msg */ + /* + * the sender finished the + * msg + */ goto re_look; } } @@ -7478,10 +7500,10 @@ sctp_move_to_outqueue(struct sctp_tcb *stcb, } if (stcb->asoc.idata_supported == 0) { sctp_snd_sb_alloc(stcb, sizeof(struct sctp_data_chunk)); - chk->book_size = chk->send_size = (uint16_t) (to_move + sizeof(struct sctp_data_chunk)); + chk->book_size = chk->send_size = (uint16_t)(to_move + sizeof(struct sctp_data_chunk)); } else { sctp_snd_sb_alloc(stcb, sizeof(struct sctp_idata_chunk)); - chk->book_size = chk->send_size = (uint16_t) (to_move + sizeof(struct sctp_idata_chunk)); + chk->book_size = chk->send_size = (uint16_t)(to_move + sizeof(struct sctp_idata_chunk)); } chk->book_size_scale = 0; chk->sent = SCTP_DATAGRAM_UNSENT; @@ -7535,8 +7557,8 @@ sctp_move_to_outqueue(struct sctp_tcb *stcb, 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) { @@ -7570,7 +7592,7 @@ sctp_move_to_outqueue(struct sctp_tcb *stcb, 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 { @@ -8175,8 +8197,10 @@ sctp_med_chunk_output(struct sctp_inpcb *inp, net->port, NULL, 0, 0, so_locked))) { - /* error, we could not - * output */ + /* + * error, we could not + * output + */ SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); if (from_where == 0) { SCTP_STAT_INCR(sctps_lowlevelerrusr); @@ -8249,12 +8273,16 @@ sctp_med_chunk_output(struct sctp_inpcb *inp, * to where the sack is going.. */ if (chk->whoTo == net) { - /* Don't transmit it to where its - * going (current net) */ + /* + * Don't transmit it to where its + * going (current net) + */ continue; } else if (sack_goes_to == net) { - /* But do transmit it to this - * address */ + /* + * But do transmit it to this + * address + */ goto skip_net_check; } } @@ -8447,8 +8475,10 @@ sctp_med_chunk_output(struct sctp_inpcb *inp, net->port, NULL, 0, 0, so_locked))) { - /* error, we could not - * output */ + /* + * error, we could not + * output + */ SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); if (from_where == 0) { SCTP_STAT_INCR(sctps_lowlevelerrusr); @@ -8645,13 +8675,17 @@ sctp_med_chunk_output(struct sctp_inpcb *inp, override_ok = 0; SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); } else if (override_ok) { - /* use this data's - * keyid */ + /* + * use this data's + * keyid + */ auth_keyid = chk->auth_keyid; override_ok = 0; } else if (auth_keyid != chk->auth_keyid) { - /* different keyid, - * so done bundling */ + /* + * different keyid, + * so done bundling + */ break; } } @@ -8730,7 +8764,8 @@ sctp_med_chunk_output(struct sctp_inpcb *inp, break; } } /* for (chunk gather loop for this net) */ -} /* if asoc.state OPEN */ no_data_fill: + } /* if asoc.state OPEN */ +no_data_fill: /* Is there something to send for this destination? */ if (outchain) { /* We may need to start a control timer or two */ @@ -8910,7 +8945,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; @@ -9691,8 +9726,10 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp, auth_keyid = fwd->auth_keyid; override_ok = 0; } else if (fwd->auth_keyid != auth_keyid) { - /* different keyid, - * so done bundling */ + /* + * different keyid, + * so done bundling + */ break; } } @@ -9814,14 +9851,14 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp, 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]); @@ -10068,9 +10105,11 @@ sctp_chunk_output(struct sctp_inpcb *inp, if (asoc->max_burst > 0) { if (SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst)) { if ((net->flight_size + (asoc->max_burst * net->mtu)) < net->cwnd) { - /* JRS - Use the congestion + /* + * JRS - Use the congestion * control given in the - * congestion control module */ + * congestion control module + */ asoc->cc_functions.sctp_cwnd_update_after_output(stcb, net, asoc->max_burst); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_MAXBURST_ENABLE) { sctp_log_maxburst(stcb, net, 0, asoc->max_burst, SCTP_MAX_BURST_APPLIED); @@ -10080,8 +10119,10 @@ sctp_chunk_output(struct sctp_inpcb *inp, net->fast_retran_ip = 0; } else { if (net->flight_size == 0) { - /* Should be decaying the - * cwnd here */ + /* + * Should be decaying the + * cwnd here + */ ; } } @@ -10411,7 +10452,7 @@ send_forward_tsn(struct sctp_tcb *stcb, 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++; @@ -10766,7 +10807,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++; @@ -10783,7 +10824,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; @@ -10795,7 +10836,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; @@ -10861,13 +10902,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 */ @@ -11100,7 +11141,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)); @@ -11126,7 +11167,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; @@ -11175,7 +11216,7 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst, #endif #ifdef INET6 case AF_INET6: - ip6->ip6_plen = (uint16_t) (len - sizeof(struct ip6_hdr)); + ip6->ip6_plen = (uint16_t)(len - sizeof(struct ip6_hdr)); if (port) { #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); @@ -11291,7 +11332,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) { /* @@ -11442,7 +11483,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)) { @@ -11466,7 +11507,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)) > @@ -11502,7 +11543,7 @@ sctp_send_packet_dropped(struct sctp_tcb *stcb, struct sctp_nets *net, * 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 */ @@ -11563,8 +11604,10 @@ sctp_send_cwr(struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t high_tsn, u asoc = &stcb->asoc; TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { if ((chk->rec.chunk_id.id == SCTP_ECN_CWR) && (net == chk->whoTo)) { - /* found a previous CWR queued to same destination - * update it if needed */ + /* + * found a previous CWR queued to same destination + * update it if needed + */ uint32_t ctsn; cwr = mtod(chk->data, struct sctp_cwr_chunk *); @@ -11640,7 +11683,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); @@ -11684,7 +11727,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; @@ -11697,7 +11740,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); @@ -12013,7 +12056,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, @@ -12141,8 +12184,10 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb, stcb->asoc.strmout[i].sid = i; stcb->asoc.strmout[i].state = oldstream[i].state; /* FIX ME FIX ME */ - /* This should be a SS_COPY operation FIX ME STREAM - * SCHEDULER EXPERT */ + /* + * This should be a SS_COPY operation FIX ME STREAM + * SCHEDULER EXPERT + */ stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], &oldstream[i]); /* now anything on those queues? */ TAILQ_FOREACH_SAFE(sp, &oldstream[i].outqueue, next, nsp) { @@ -12246,7 +12291,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; @@ -12327,8 +12372,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)))) { @@ -12672,8 +12717,10 @@ sctp_lower_sosend(struct socket *so, } if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) { stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; - /* Set the connected flag so we can queue - * data */ + /* + * Set the connected flag so we can queue + * data + */ soisconnecting(so); } hold_tcblock = 1; @@ -12683,8 +12730,10 @@ sctp_lower_sosend(struct socket *so, } else { SCTP_PRINTF("Huh-3? create lock should have been on??\n"); } - /* Turn on queue only flag to prevent data from - * being sent */ + /* + * Turn on queue only flag to prevent data from + * being sent + */ queue_only = 1; asoc = &stcb->asoc; SCTP_SET_STATE(asoc, SCTP_STATE_COOKIE_WAIT); @@ -12882,7 +12931,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) { @@ -13177,8 +13226,10 @@ sctp_lower_sosend(struct socket *so, } /* PR-SCTP? */ if ((asoc->prsctp_supported) && (asoc->sent_queue_cnt_removeable > 0)) { - /* This is ugly but we must assure locking - * order */ + /* + * This is ugly but we must assure locking + * order + */ if (hold_tcblock == 0) { SCTP_TCB_LOCK(stcb); hold_tcblock = 1; @@ -13455,8 +13506,10 @@ sctp_lower_sosend(struct socket *so, msg); sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_LOCKED); - /* now relock the stcb so everything - * is sane */ + /* + * now relock the stcb so everything + * is sane + */ hold_tcblock = 0; stcb = NULL; goto out; @@ -13530,8 +13583,10 @@ sctp_lower_sosend(struct socket *so, if ((queue_only == 0) && (nagle_applies == 0) && (stcb->asoc.peers_rwnd && un_sent)) { /* we can attempt to send too. */ if (hold_tcblock == 0) { - /* If there is activity recv'ing sacks no need to - * send */ + /* + * If there is activity recv'ing sacks no need to + * send + */ if (SCTP_TCB_TRYLOCK(stcb)) { sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_USR_SEND, SCTP_SO_LOCKED); hold_tcblock = 1; @@ -13605,7 +13660,7 @@ sctp_lower_sosend(struct socket *so, */ 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; @@ -13660,7 +13715,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; @@ -13712,7 +13767,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 b2441a6fe0b6..cd90b7d7e074 100644 --- a/sys/netinet/sctp_output.h +++ b/sys/netinet/sctp_output.h @@ -47,7 +47,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 *); @@ -64,13 +64,13 @@ 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 sctp_send_initiate(struct sctp_inpcb *, struct sctp_tcb *, int diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 413a75367637..ffc3a7e2def1 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -1212,8 +1212,10 @@ sctp_tcb_special_locate(struct sctp_inpcb **inp_p, struct sockaddr *from, if (netp != NULL) { *netp = net; } - /* Update the endpoint - * pointer */ + /* + * Update the endpoint + * pointer + */ *inp_p = inp; SCTP_INP_RUNLOCK(inp); return (stcb); @@ -1234,8 +1236,10 @@ sctp_tcb_special_locate(struct sctp_inpcb **inp_p, struct sockaddr *from, if (netp != NULL) { *netp = net; } - /* Update the endpoint - * pointer */ + /* + * Update the endpoint + * pointer + */ *inp_p = inp; SCTP_INP_RUNLOCK(inp); return (stcb); @@ -1563,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 */ @@ -1662,8 +1666,10 @@ sctp_endpoint_probe(struct sockaddr *nam, struct sctppcbhead *head, case AF_INET: if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) && SCTP_IPV6_V6ONLY(inp)) { - /* IPv4 on a IPv6 socket with ONLY - * IPv6 set */ + /* + * IPv4 on a IPv6 socket with ONLY + * IPv6 set + */ SCTP_INP_RUNLOCK(inp); continue; } @@ -1676,8 +1682,10 @@ sctp_endpoint_probe(struct sockaddr *nam, struct sctppcbhead *head, #endif #ifdef INET6 case AF_INET6: - /* A V6 address and the endpoint is NOT - * bound V6 */ + /* + * A V6 address and the endpoint is NOT + * bound V6 + */ if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) { SCTP_INP_RUNLOCK(inp); continue; @@ -2175,8 +2183,10 @@ sctp_findassoc_by_vtag(struct sockaddr *from, struct sockaddr *to, uint32_t vtag continue; } if (remote_tag) { - /* If we have both vtags that's all we match - * on */ + /* + * If we have both vtags that's all we match + * on + */ if (stcb->asoc.peer_vtag == remote_tag) { /* * If both tags match we consider it @@ -2309,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 @@ -2441,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; @@ -2869,8 +2879,10 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, #ifdef INET6 case AF_INET6: { - /* Only for pure IPv6 Address. (No IPv4 - * Mapped!) */ + /* + * Only for pure IPv6 Address. (No IPv4 + * Mapped!) + */ struct sockaddr_in6 *sin6; sin6 = (struct sockaddr_in6 *)addr; @@ -2947,8 +2959,10 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, /* unlock info */ if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE)) && (sctp_is_feature_on(inp_tmp, SCTP_PCB_FLAGS_PORTREUSE))) { - /* Ok, must be one-2-one and - * allowing port re-use */ + /* + * Ok, must be one-2-one and + * allowing port re-use + */ port_reuse_active = 1; goto continue_anyway; } @@ -2971,8 +2985,10 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, /* unlock info */ if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE)) && (sctp_is_feature_on(inp_tmp, SCTP_PCB_FLAGS_PORTREUSE))) { - /* Ok, must be one-2-one and - * allowing port re-use */ + /* + * Ok, must be one-2-one and + * allowing port re-use + */ port_reuse_active = 1; goto continue_anyway; } @@ -3271,8 +3287,10 @@ sctp_iterator_inp_being_freed(struct sctp_inpcb *inp) SCTP_INP_INCR_REF(it->inp); } } - /* When its put in the refcnt is incremented so decr - * it */ + /* + * When its put in the refcnt is incremented so decr + * it + */ SCTP_INP_DECR_REF(inp); } } @@ -3929,7 +3947,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); @@ -3937,7 +3955,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); @@ -3955,8 +3973,10 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, rmtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, &net->ro._l_addr.sa, net->ro.ro_rt); if (rmtu == 0) { - /* Start things off to match mtu of - * interface please. */ + /* + * Start things off to match mtu of + * interface please. + */ SCTP_SET_MTU_OF_ROUTE(&net->ro._l_addr.sa, net->ro.ro_rt, net->mtu); } else { @@ -3989,7 +4009,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) { @@ -4123,7 +4143,7 @@ sctp_aloc_a_assoc_id(struct sctp_inpcb *inp, struct sctp_tcb *stcb) } 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; } @@ -5447,8 +5467,10 @@ sctp_del_local_addr_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa) if (stcb->asoc.last_used_address == laddr) /* delete this address */ stcb->asoc.last_used_address = NULL; - /* Now spin through all the nets and purge any ref - * to laddr */ + /* + * Now spin through all the nets and purge any ref + * to laddr + */ TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { if (net->ro._s_addr == laddr->ifa) { /* Yep, purge src address selected */ @@ -5745,12 +5767,12 @@ sctp_pcb_init() (void)SCTP_GETTIME_TIMEVAL(&tv); #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) bzero(SCTP_BASE_STATS, (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 bzero(&SCTP_BASE_STATS, 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)); @@ -6224,8 +6246,10 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - /* in setup state we - * abort this guy */ + /* + * in setup state we + * abort this guy + */ snprintf(msg, sizeof(msg), "%s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), @@ -6267,8 +6291,10 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, goto next_param; } if (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr)) { - /* Link local make no sense without - * scope */ + /* + * Link local make no sense without + * scope + */ goto next_param; } sa = (struct sockaddr *)&sin6; @@ -6319,8 +6345,10 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - /* in setup state we - * abort this guy */ + /* + * in setup state we + * abort this guy + */ snprintf(msg, sizeof(msg), "%s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), diff --git a/sys/netinet/sctp_pcb.h b/sys/netinet/sctp_pcb.h index a2a1e7d79282..86fae1f4adac 100644 --- a/sys/netinet/sctp_pcb.h +++ b/sys/netinet/sctp_pcb.h @@ -379,8 +379,10 @@ struct sctp_inpcb { /* list of addrs in use by the EP, NULL if bound-all */ struct sctpladdr sctp_addr_list; - /* used for source address selection rotation when we are subset - * bound */ + /* + * used for source address selection rotation when we are subset + * bound + */ struct sctp_laddr *next_addr_touse; /* back pointer to our socket */ diff --git a/sys/netinet/sctp_ss_functions.c b/sys/netinet/sctp_ss_functions.c index 36f1b535a3b0..a5488b827516 100644 --- a/sys/netinet/sctp_ss_functions.c +++ b/sys/netinet/sctp_ss_functions.c @@ -144,8 +144,10 @@ sctp_ss_default_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, if (holds_lock == 0) { SCTP_TCB_SEND_LOCK(stcb); } - /* Remove from wheel if stream queue is empty and actually is on the - * wheel */ + /* + * Remove from wheel if stream queue is empty and actually is on the + * wheel + */ if (TAILQ_EMPTY(&strq->outqueue) && (strq->ss_params.rr.next_spoke.tqe_next != NULL || strq->ss_params.rr.next_spoke.tqe_prev != NULL)) { @@ -251,7 +253,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); @@ -457,8 +459,10 @@ sctp_ss_prio_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, if (holds_lock == 0) { SCTP_TCB_SEND_LOCK(stcb); } - /* Remove from wheel if stream queue is empty and actually is on the - * wheel */ + /* + * Remove from wheel if stream queue is empty and actually is on the + * wheel + */ if (TAILQ_EMPTY(&strq->outqueue) && (strq->ss_params.prio.next_spoke.tqe_next != NULL || strq->ss_params.prio.next_spoke.tqe_prev != NULL)) { @@ -531,7 +535,7 @@ sctp_ss_prio_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net, 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); @@ -631,8 +635,10 @@ sctp_ss_fb_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, if (holds_lock == 0) { SCTP_TCB_SEND_LOCK(stcb); } - /* Remove from wheel if stream queue is empty and actually is on the - * wheel */ + /* + * Remove from wheel if stream queue is empty and actually is on the + * wheel + */ if (TAILQ_EMPTY(&strq->outqueue) && (strq->ss_params.fb.next_spoke.tqe_next != NULL || strq->ss_params.fb.next_spoke.tqe_prev != NULL)) { diff --git a/sys/netinet/sctp_structs.h b/sys/netinet/sctp_structs.h index 22a3c73655c5..f7371748f554 100644 --- a/sys/netinet/sctp_structs.h +++ b/sys/netinet/sctp_structs.h @@ -715,7 +715,7 @@ struct sctp_cc_functions { 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); + 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); void (*sctp_cwnd_update_packet_transmitted) (struct sctp_tcb *stcb, @@ -752,7 +752,7 @@ struct sctp_ss_functions { void (*sctp_ss_packet_done) (struct sctp_tcb *stcb, struct sctp_nets *net, 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); int (*sctp_ss_is_user_msgs_incomplete) (struct sctp_tcb *stcb, struct sctp_association *asoc); @@ -881,8 +881,10 @@ struct sctp_association { /* JRS - the congestion control functions are in this struct */ struct sctp_cc_functions cc_functions; - /* JRS - value to store the currently loaded congestion control - * module */ + /* + * JRS - value to store the currently loaded congestion control + * module + */ uint32_t congestion_control_module; /* RS - the stream scheduling functions are in this struct */ struct sctp_ss_functions ss_functions; diff --git a/sys/netinet/sctp_sysctl.c b/sys/netinet/sctp_sysctl.c index e46a8c7be736..149419971b8e 100644 --- a/sys/netinet/sctp_sysctl.c +++ b/sys/netinet/sctp_sysctl.c @@ -310,8 +310,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)); @@ -416,10 +416,10 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS) } else { xinpcb.qlen = so->so_qlen; xinpcb.qlen_old = so->so_qlen > USHRT_MAX ? - USHRT_MAX : (uint16_t) so->so_qlen; + USHRT_MAX : (uint16_t)so->so_qlen; xinpcb.maxqlen = so->so_qlimit; xinpcb.maxqlen_old = so->so_qlimit > USHRT_MAX ? - USHRT_MAX : (uint16_t) so->so_qlimit; + USHRT_MAX : (uint16_t)so->so_qlimit; } SCTP_INP_INCR_REF(inp); SCTP_INP_RUNLOCK(inp); @@ -446,7 +446,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; @@ -458,10 +458,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; @@ -505,8 +505,8 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS) xraddr.rtt = net->rtt / 1000; xraddr.heartbeat_interval = net->heart_beat_delay; xraddr.ssthresh = net->ssthresh; - 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 de1862e04e31..78fe1c2700e3 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -143,8 +143,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. @@ -193,8 +193,10 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, */ if (mode == 2) { TAILQ_FOREACH(mnet, &stcb->asoc.nets, sctp_next) { - /* JRS 5/14/07 - If the destination is unreachable - * or unconfirmed, skip it. */ + /* + * JRS 5/14/07 - If the destination is unreachable + * or unconfirmed, skip it. + */ if (((mnet->dest_state & SCTP_ADDR_REACHABLE) != SCTP_ADDR_REACHABLE) || (mnet->dest_state & SCTP_ADDR_UNCONFIRMED)) { continue; @@ -285,7 +287,7 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, return (max_cwnd_net); } } /* JRS 5/14/07 - If mode is set to 1, use the - * CMT policy for choosing an alternate net. */ + * CMT policy for choosing an alternate net. */ else if (mode == 1) { TAILQ_FOREACH(mnet, &stcb->asoc.nets, sctp_next) { if (((mnet->dest_state & SCTP_ADDR_REACHABLE) != SCTP_ADDR_REACHABLE) || @@ -656,7 +658,7 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb, 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); @@ -784,7 +786,7 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb, 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); @@ -1431,8 +1433,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; } @@ -1473,7 +1475,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_usrreq.c b/sys/netinet/sctp_usrreq.c index 174fb477ece2..3982156f0d0c 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -70,9 +70,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 @@ -134,7 +134,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 */ @@ -975,8 +975,10 @@ sctp_shutdown(struct socket *so) } } sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, netp); - /* XXX: Why do this in the case where we have still data - * queued? */ + /* + * XXX: Why do this in the case where we have still data + * queued? + */ sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CLOSING, SCTP_SO_LOCKED); SCTP_TCB_UNLOCK(stcb); SCTP_INP_RUNLOCK(inp); @@ -1479,7 +1481,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 */ @@ -1811,8 +1813,10 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize, } SCTP_TCB_UNLOCK(stcb); } else { - /* Can't get stream value without - * association */ + /* + * Can't get stream value without + * association + */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; } @@ -2176,7 +2180,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize, 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; @@ -2206,7 +2210,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize, } } 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); @@ -2932,7 +2936,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize, } 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); @@ -2951,7 +2955,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize, } 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); @@ -2982,7 +2986,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize, } 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); @@ -3588,14 +3592,14 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize, 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); @@ -3887,10 +3891,12 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_INTERLEAVE_STRMS))) { inp->idata_supported = 1; } else { - /* Must have Frag + /* + * Must have Frag * interleave and * stream interleave - * on */ + * on + */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; } @@ -4101,8 +4107,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, } SCTP_INP_RUNLOCK(inp); } else { - /* Can't set stream value without - * association */ + /* + * Can't set stream value without + * association + */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; } @@ -4268,7 +4276,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; @@ -4305,7 +4313,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,15 +4340,17 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { SCTP_TCB_LOCK(stcb); shared_keys = &stcb->asoc.shared_keys; - /* clear the cached keys for - * this key id */ + /* + * clear the cached keys for + * this key id + */ sctp_clear_cachedkeys(stcb, sca->sca_keynumber); /* * create the new shared key * 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; @@ -4376,7 +4386,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; @@ -4547,7 +4557,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) || @@ -4555,7 +4565,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) || @@ -4563,7 +4573,7 @@ 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); @@ -4732,8 +4742,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, int cnt; addstream |= 2; - /* We allocate inside - * sctp_send_str_reset_req() */ + /* + * We allocate inside + * sctp_send_str_reset_req() + */ add_i_strmcnt = stradd->sas_instrms; cnt = add_i_strmcnt; cnt += stcb->asoc.streamincnt; @@ -4760,7 +4772,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; @@ -4781,8 +4793,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, SCTP_TCB_UNLOCK(stcb); break; } - /* Is there any data pending in the send or sent - * queues? */ + /* + * Is there any data pending in the send or sent + * queues? + */ if (!TAILQ_EMPTY(&stcb->asoc.send_queue) || !TAILQ_EMPTY(&stcb->asoc.sent_queue)) { busy_out: @@ -4928,8 +4942,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || (av->assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_WLOCK(inp); - /* FIXME MT: I think this is not in - * tune with the API ID */ + /* + * FIXME MT: I think this is not in + * tune with the API ID + */ if (av->assoc_value) { inp->sctp_frag_point = (av->assoc_value + ovh); } else { @@ -5072,8 +5088,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, } SCTP_TCB_UNLOCK(stcb); } - /* Send up the sender dry event only for 1-to-1 - * style sockets. */ + /* + * Send up the sender dry event only for 1-to-1 + * style sockets. + */ if (events->sctp_sender_dry_event) { if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { @@ -5784,8 +5802,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, goto out_of_it; } if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) == 0) { - /* Must validate the ifa found is in - * our ep */ + /* + * Must validate the ifa found is in + * our ep + */ struct sctp_laddr *laddr; int found = 0; @@ -6541,8 +6561,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, (av->assoc_id == SCTP_FUTURE_ASSOC)) { if ((av->assoc_value == 0) && (inp->asconf_supported == 1)) { - /* AUTH is required for - * ASCONF */ + /* + * AUTH is required for + * ASCONF + */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; } else { @@ -6578,8 +6600,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, (av->assoc_id == SCTP_FUTURE_ASSOC)) { if ((av->assoc_value != 0) && (inp->auth_supported == 0)) { - /* AUTH is required for - * ASCONF */ + /* + * AUTH is required for + * ASCONF + */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; } else { @@ -7011,8 +7035,10 @@ sctp_listen(struct socket *so, int backlog, struct thread *p) ((tinp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) == 0) && ((tinp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) && (tinp->sctp_socket->so_qlimit)) { - /* we have a listener already and - * its not this inp. */ + /* + * we have a listener already and + * its not this inp. + */ SCTP_INP_DECR_REF(tinp); return (EADDRINUSE); } else if (tinp) { @@ -7053,8 +7079,10 @@ sctp_listen(struct socket *so, int backlog, struct thread *p) ((tinp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) == 0) && ((tinp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) && (tinp->sctp_socket->so_qlimit)) { - /* we have a listener already and its not - * this inp. */ + /* + * we have a listener already and its not + * this inp. + */ SCTP_INP_DECR_REF(tinp); return (EADDRINUSE); } else if (tinp) { @@ -7294,7 +7322,7 @@ sctp_ingetaddr(struct socket *so, struct sockaddr **addr) 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/sctputil.c b/sys/netinet/sctputil.c index b4f6c1fb2c60..1b5173167eed 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -94,7 +94,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; @@ -227,12 +227,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; @@ -268,11 +268,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; @@ -469,12 +469,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; @@ -490,7 +490,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; } @@ -509,12 +509,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, @@ -556,8 +556,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"); @@ -575,8 +575,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"); @@ -828,9 +828,9 @@ sctp_fill_random_store(struct sctp_pcb *m) * numbers, but thats ok too since that is random as well :-> */ m->store_at = 0; - (void)sctp_hmac(SCTP_HMAC, (uint8_t *) m->random_numbers, - sizeof(m->random_numbers), (uint8_t *) & m->random_counter, - sizeof(m->random_counter), (uint8_t *) m->random_store); + (void)sctp_hmac(SCTP_HMAC, (uint8_t *)m->random_numbers, + sizeof(m->random_numbers), (uint8_t *)&m->random_counter, + sizeof(m->random_counter), (uint8_t *)m->random_store); m->random_counter++; } @@ -867,7 +867,7 @@ sctp_select_initial_TSN(struct sctp_pcb *inp) sctp_fill_random_store(inp); } p = &inp->random_store[store_at]; - xp = (uint32_t *) p; + xp = (uint32_t *)p; x = *xp; return (x); } @@ -976,7 +976,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; @@ -1482,8 +1482,10 @@ sctp_handle_addr_wq(void) sctp_asconf_iterator_end, NULL, 0); if (ret) { SCTP_PRINTF("Failed to initiate iterator for handle_addr_wq\n"); - /* Freeing if we are stopping or put back on the - * addr_wq. */ + /* + * Freeing if we are stopping or put back on the + * addr_wq. + */ if (SCTP_BASE_VAR(sctp_pcb_initialized) == 0) { sctp_asconf_iterator_end(asc, 0); } else { @@ -1520,7 +1522,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 @@ -1915,7 +1917,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 @@ -2477,14 +2479,16 @@ sctp_calculate_rto(struct sctp_tcb *stcb, } timevalsub(&now, old); /* store the current RTT in us */ - net->rtt = (uint64_t) 1000000 *(uint64_t) now.tv_sec + - (uint64_t) now.tv_usec; + net->rtt = (uint64_t)1000000 *(uint64_t)now.tv_sec + + (uint64_t)now.tv_usec; /* compute rtt in ms */ - rtt = (int32_t) (net->rtt / 1000); + rtt = (int32_t)(net->rtt / 1000); if ((asoc->cc_functions.sctp_rtt_calculated) && (rtt_from_sack == SCTP_RTT_FROM_DATA)) { - /* Tell the CC module that a new update has just occurred - * from a sack */ + /* + * Tell the CC module that a new update has just occurred + * from a sack + */ (*asoc->cc_functions.sctp_rtt_calculated) (stcb, net, &now); } /* @@ -2560,7 +2564,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; @@ -2609,7 +2613,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)); } @@ -2972,7 +2976,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; @@ -2990,11 +2994,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; @@ -3076,7 +3080,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; @@ -3094,7 +3098,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; @@ -3511,7 +3515,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; @@ -3719,7 +3723,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; @@ -3748,25 +3752,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: @@ -3786,17 +3790,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: @@ -4146,7 +4150,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)) { @@ -4179,7 +4183,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) && @@ -4195,7 +4199,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; @@ -4204,7 +4208,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)) { @@ -4219,7 +4223,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); } @@ -4227,7 +4231,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); } @@ -4613,7 +4617,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; @@ -4632,7 +4636,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; @@ -4792,8 +4796,10 @@ sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1, do_wakeup_routine = 1; tp1->sent = SCTP_FORWARD_TSN_SKIP; TAILQ_REMOVE(&stcb->asoc.send_queue, tp1, sctp_next); - /* on to the sent queue so we can wait for it to be - * passed by. */ + /* + * on to the sent queue so we can wait for it to be + * passed by. + */ TAILQ_INSERT_TAIL(&stcb->asoc.sent_queue, tp1, sctp_next); stcb->asoc.send_queue_cnt--; @@ -5026,8 +5032,8 @@ sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock) hash_head = &vrf->vrf_addr_hash[(hash_of_addr & vrf->vrf_addr_hashmark)]; if (hash_head == NULL) { SCTP_PRINTF("hash_of_addr:%x mask:%x table:%x - ", - hash_of_addr, (uint32_t) vrf->vrf_addr_hashmark, - (uint32_t) (hash_of_addr & vrf->vrf_addr_hashmark)); + hash_of_addr, (uint32_t)vrf->vrf_addr_hashmark, + (uint32_t)(hash_of_addr & vrf->vrf_addr_hashmark)); sctp_print_address(addr); SCTP_PRINTF("No such bucket for address\n"); if (holds_lock == 0) @@ -5069,7 +5075,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? */ @@ -5231,11 +5237,11 @@ sctp_sorecvmsg(struct socket *so, in_eeor_mode = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXPLICIT_EOR); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_RECV_RWND_LOGGING_ENABLE) { sctp_misc_ints(SCTP_SORECV_ENTER, - rwnd_req, in_eeor_mode, so->so_rcv.sb_cc, (uint32_t) uio->uio_resid); + rwnd_req, in_eeor_mode, so->so_rcv.sb_cc, (uint32_t)uio->uio_resid); } if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_RECV_RWND_LOGGING_ENABLE) { sctp_misc_ints(SCTP_SORECV_ENTERPL, - rwnd_req, block_allowed, so->so_rcv.sb_cc, (uint32_t) uio->uio_resid); + rwnd_req, block_allowed, so->so_rcv.sb_cc, (uint32_t)uio->uio_resid); } error = sblock(&so->so_rcv, (block_allowed ? SBL_WAIT : 0)); if (error) { @@ -5286,8 +5292,10 @@ sctp_sorecvmsg(struct socket *so, * connect. */ if (inp->sctp_flags & SCTP_PCB_FLAGS_WAS_ABORTED) { - /* You were aborted, passive side - * always hits here */ + /* + * You were aborted, passive side + * always hits here + */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, ECONNRESET); error = ECONNRESET; } @@ -5386,8 +5394,10 @@ sctp_sorecvmsg(struct socket *so, } if ((control->length == 0) && (control->end_added == 1)) { - /* Do we also need to check for (control->pdapi_aborted == - * 1)? */ + /* + * Do we also need to check for (control->pdapi_aborted == + * 1)? + */ if (hold_rlock == 0) { hold_rlock = 1; SCTP_INP_READ_LOCK(inp); @@ -5528,7 +5538,7 @@ sctp_sorecvmsg(struct socket *so, /* 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; @@ -5604,7 +5614,7 @@ sctp_sorecvmsg(struct socket *so, 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; } @@ -5730,8 +5740,10 @@ sctp_sorecvmsg(struct socket *so, atomic_subtract_int(&control->length, cp_len); control->data = sctp_m_free(m); m = control->data; - /* been through it all, must hold sb - * lock ok to null tail */ + /* + * been through it all, must hold sb + * lock ok to null tail + */ if (control->data == NULL) { #ifdef INVARIANTS if ((control->end_added == 0) || @@ -5864,7 +5876,7 @@ sctp_sorecvmsg(struct socket *so, } 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; } /* @@ -5950,8 +5962,10 @@ sctp_sorecvmsg(struct socket *so, */ SCTP_INP_READ_LOCK(inp); if ((control->length > 0) && (control->data == NULL)) { - /* big trouble.. we have the lock and its - * corrupt? */ + /* + * big trouble.. we have the lock and its + * corrupt? + */ #ifdef INVARIANTS panic("Impossible data==NULL length !=0"); #endif @@ -6082,13 +6096,13 @@ sctp_sorecvmsg(struct socket *so, 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); } @@ -6666,8 +6680,10 @@ sctp_local_addr_count(struct sctp_tcb *stcb) sin = &sctp_ifa->address.sin; if (sin->sin_addr.s_addr == 0) { - /* skip unspecified - * addrs */ + /* + * skip unspecified + * addrs + */ continue; } if (prison_check_ip4(stcb->sctp_ep->ip_inp.inp.inp_cred, @@ -7097,7 +7113,7 @@ sctp_recv_icmp6_tunneled_packet(int cmd, struct sockaddr *sa, void *d, void *ctx code = ICMP6_PARAMPROB_NEXTHEADER; } sctp6_notify(inp, stcb, net, type, code, - (uint16_t) ntohl(ip6cp->ip6c_icmp6->icmp6_mtu)); + (uint16_t)ntohl(ip6cp->ip6c_icmp6->icmp6_mtu)); } else { if ((stcb == NULL) && (inp != NULL)) { /* reduce inp's ref-count */ diff --git a/sys/netinet/sctputil.h b/sys/netinet/sctputil.h index a3a4f3c60915..dd45e49a9963 100644 --- a/sys/netinet/sctputil.h +++ b/sys/netinet/sctputil.h @@ -65,10 +65,10 @@ 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); diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c index 7d5654172b9f..35ec1f392bf8 100644 --- a/sys/netinet6/sctp6_usrreq.c +++ b/sys/netinet6/sctp6_usrreq.c @@ -306,7 +306,7 @@ sctp6_ctlinput(int cmd, struct sockaddr *pktdst, void *d) * 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. */ @@ -388,7 +388,7 @@ sctp6_ctlinput(int cmd, struct sockaddr *pktdst, void *d) sctp6_notify(inp, stcb, net, ip6cp->ip6c_icmp6->icmp6_type, ip6cp->ip6c_icmp6->icmp6_code, - (uint16_t) ntohl(ip6cp->ip6c_icmp6->icmp6_mtu)); + (uint16_t)ntohl(ip6cp->ip6c_icmp6->icmp6_mtu)); } else { if ((stcb == NULL) && (inp != NULL)) { /* reduce inp's ref-count */ @@ -999,7 +999,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; }