svn commit: r336503 - in head/sys: netinet netinet6
Michael Tuexen
tuexen at FreeBSD.org
Thu Jul 19 19:33:45 UTC 2018
Author: tuexen
Date: Thu Jul 19 19:33:42 2018
New Revision: 336503
URL: https://svnweb.freebsd.org/changeset/base/336503
Log:
Whitespace changes due to change if ident.
Modified:
head/sys/netinet/sctp.h
head/sys/netinet/sctp_asconf.c
head/sys/netinet/sctp_asconf.h
head/sys/netinet/sctp_auth.c
head/sys/netinet/sctp_auth.h
head/sys/netinet/sctp_bsd_addr.c
head/sys/netinet/sctp_bsd_addr.h
head/sys/netinet/sctp_cc_functions.c
head/sys/netinet/sctp_crc32.c
head/sys/netinet/sctp_header.h
head/sys/netinet/sctp_indata.c
head/sys/netinet/sctp_indata.h
head/sys/netinet/sctp_input.c
head/sys/netinet/sctp_input.h
head/sys/netinet/sctp_output.c
head/sys/netinet/sctp_output.h
head/sys/netinet/sctp_pcb.c
head/sys/netinet/sctp_pcb.h
head/sys/netinet/sctp_peeloff.c
head/sys/netinet/sctp_ss_functions.c
head/sys/netinet/sctp_structs.h
head/sys/netinet/sctp_sysctl.c
head/sys/netinet/sctp_timer.c
head/sys/netinet/sctp_uio.h
head/sys/netinet/sctp_usrreq.c
head/sys/netinet/sctp_var.h
head/sys/netinet/sctputil.c
head/sys/netinet/sctputil.h
head/sys/netinet6/sctp6_usrreq.c
head/sys/netinet6/sctp6_var.h
Modified: head/sys/netinet/sctp.h
==============================================================================
--- head/sys/netinet/sctp.h Thu Jul 19 19:32:08 2018 (r336502)
+++ head/sys/netinet/sctp.h Thu Jul 19 19:33:42 2018 (r336503)
@@ -419,7 +419,7 @@ struct sctp_error_unresolv_addr {
struct sctp_error_unrecognized_chunk {
struct sctp_error_cause cause; /* code=SCTP_CAUSE_UNRECOG_CHUNK */
- struct sctp_chunkhdr ch;/* header from chunk in error */
+ struct sctp_chunkhdr ch; /* header from chunk in error */
} SCTP_PACKED;
struct sctp_error_no_user_data {
Modified: head/sys/netinet/sctp_asconf.c
==============================================================================
--- head/sys/netinet/sctp_asconf.c Thu Jul 19 19:32:08 2018 (r336502)
+++ head/sys/netinet/sctp_asconf.c Thu Jul 19 19:33:42 2018 (r336503)
@@ -99,7 +99,7 @@ sctp_asconf_success_response(uint32_t id)
}
static struct mbuf *
-sctp_asconf_error_response(uint32_t id, uint16_t cause, uint8_t *error_tlv,
+sctp_asconf_error_response(uint32_t id, uint16_t cause, uint8_t * error_tlv,
uint16_t tlv_length)
{
struct mbuf *m_reply = NULL;
@@ -134,7 +134,7 @@ sctp_asconf_error_response(uint32_t id, uint16_t cause
return (NULL);
}
if (error_tlv != NULL) {
- tlv = (uint8_t *)(error + 1);
+ tlv = (uint8_t *) (error + 1);
memcpy(tlv, error_tlv, tlv_length);
}
SCTP_BUF_LEN(m_reply) = aph->ph.param_length;
@@ -224,7 +224,7 @@ sctp_process_asconf_add_ip(struct sockaddr *src, struc
#endif
default:
m_reply = sctp_asconf_error_response(aph->correlation_id,
- SCTP_CAUSE_INVALID_PARAM, (uint8_t *)aph,
+ SCTP_CAUSE_INVALID_PARAM, (uint8_t *) aph,
aparam_length);
return (m_reply);
} /* end switch */
@@ -239,7 +239,7 @@ sctp_process_asconf_add_ip(struct sockaddr *src, struc
/* add the address */
if (bad_address) {
m_reply = sctp_asconf_error_response(aph->correlation_id,
- SCTP_CAUSE_INVALID_PARAM, (uint8_t *)aph,
+ SCTP_CAUSE_INVALID_PARAM, (uint8_t *) aph,
aparam_length);
} else if (sctp_add_remote_addr(stcb, sa, &net, stcb->asoc.port,
SCTP_DONOT_SETSCOPE,
@@ -247,7 +247,7 @@ sctp_process_asconf_add_ip(struct sockaddr *src, struc
SCTPDBG(SCTP_DEBUG_ASCONF1,
"process_asconf_add_ip: error adding address\n");
m_reply = sctp_asconf_error_response(aph->correlation_id,
- SCTP_CAUSE_RESOURCE_SHORTAGE, (uint8_t *)aph,
+ SCTP_CAUSE_RESOURCE_SHORTAGE, (uint8_t *) aph,
aparam_length);
} else {
/* notify upper layer */
@@ -277,6 +277,7 @@ sctp_asconf_del_remote_addrs_except(struct sctp_tcb *s
/* not found */
return (-1);
}
+
/* delete all destination addresses except the source */
TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
if (net != src_net) {
@@ -369,7 +370,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);
}
@@ -379,10 +380,11 @@ sctp_process_asconf_delete_ip(struct sockaddr *src,
/* trying to delete the source address! */
SCTPDBG(SCTP_DEBUG_ASCONF1, "process_asconf_delete_ip: tried to delete source addr\n");
m_reply = sctp_asconf_error_response(aph->correlation_id,
- SCTP_CAUSE_DELETING_SRC_ADDR, (uint8_t *)aph,
+ SCTP_CAUSE_DELETING_SRC_ADDR, (uint8_t *) aph,
aparam_length);
return (m_reply);
}
+
/* if deleting 0.0.0.0/::0, delete all addresses except src addr */
if (zero_address && SCTP_BASE_SYSCTL(sctp_nat_friendly)) {
result = sctp_asconf_del_remote_addrs_except(stcb, src);
@@ -393,7 +395,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 =
@@ -401,6 +403,7 @@ sctp_process_asconf_delete_ip(struct sockaddr *src,
}
return (m_reply);
}
+
/* delete the address */
result = sctp_del_remote_addr(stcb, sa);
/*
@@ -412,7 +415,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) {
@@ -494,7 +497,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);
}
@@ -565,7 +568,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);
}
@@ -616,6 +619,7 @@ sctp_handle_asconf(struct mbuf *m, unsigned int offset
serial_num, asoc->asconf_seq_in + 1);
return;
}
+
/* it's the expected "next" sequence number, so process it */
asoc->asconf_seq_in = serial_num; /* update sequence */
/* get length of all the param's in the ASCONF */
@@ -640,6 +644,7 @@ sctp_handle_asconf(struct mbuf *m, unsigned int offset
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_asconf_ack), ack);
}
}
+
m_ack = sctp_get_mbuf_for_msg(sizeof(struct sctp_asconf_ack_chunk), 0,
M_NOWAIT, 1, MT_DATA);
if (m_ack == NULL) {
@@ -660,7 +665,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");
@@ -670,7 +675,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;
@@ -767,7 +772,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");
@@ -816,8 +821,7 @@ send_reply:
* does the address match? returns 0 if not, 1 if so
*/
static uint32_t
-sctp_asconf_addr_match(struct sctp_asconf_addr *aa, struct sockaddr *sa)
-{
+sctp_asconf_addr_match(struct sctp_asconf_addr *aa, struct sockaddr *sa){
switch (sa->sa_family) {
#ifdef INET6
case AF_INET6:
@@ -856,8 +860,7 @@ sctp_asconf_addr_match(struct sctp_asconf_addr *aa, st
* does the address match? returns 0 if not, 1 if so
*/
static uint32_t
-sctp_addr_match(struct sctp_paramhdr *ph, struct sockaddr *sa)
-{
+sctp_addr_match(struct sctp_paramhdr *ph, struct sockaddr *sa){
#if defined(INET) || defined(INET6)
uint16_t param_type, param_length;
@@ -974,6 +977,7 @@ sctp_assoc_immediate_retrans(struct sctp_tcb *stcb, st
if (stcb->asoc.deleted_primary == NULL) {
return;
}
+
if (!TAILQ_EMPTY(&stcb->asoc.sent_queue)) {
SCTPDBG(SCTP_DEBUG_ASCONF1, "assoc_immediate_retrans: Deleted primary is ");
SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, &stcb->asoc.deleted_primary->ro._l_addr.sa);
@@ -1077,6 +1081,7 @@ sctp_path_check_and_react(struct sctp_tcb *stcb, struc
}
return;
}
+
/* Multiple local addresses exsist in the association. */
TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
/* clear any cached route and source address */
@@ -1096,7 +1101,7 @@ sctp_path_check_and_react(struct sctp_tcb *stcb, struc
* 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)
@@ -1106,7 +1111,7 @@ sctp_path_check_and_react(struct sctp_tcb *stcb, struc
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;
@@ -1114,7 +1119,7 @@ sctp_path_check_and_react(struct sctp_tcb *stcb, struc
#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;
@@ -1323,6 +1328,7 @@ sctp_asconf_queue_add(struct sctp_tcb *stcb, struct sc
if (stcb->asoc.asconf_supported == 0) {
return (-1);
}
+
/*
* if this is deleting the last address from the assoc, mark it as
* pending.
@@ -1343,6 +1349,7 @@ sctp_asconf_queue_add(struct sctp_tcb *stcb, struct sc
return (-1);
}
}
+
/* queue an asconf parameter */
status = sctp_asconf_queue_mgmt(stcb, ifa, type);
@@ -1364,6 +1371,7 @@ sctp_asconf_queue_add(struct sctp_tcb *stcb, struct sc
stcb->asoc.asconf_addr_del_pending = NULL;
}
}
+
if (pending_delete_queued) {
struct sctp_nets *net;
@@ -1388,6 +1396,7 @@ sctp_asconf_queue_add(struct sctp_tcb *stcb, struct sc
SCTP_FROM_SCTP_ASCONF,
__LINE__);
}
+
/* queue in an advisory set primary too */
(void)sctp_asconf_queue_mgmt(stcb, ifa, SCTP_SET_PRIM_ADDR);
/* let caller know we should send this out immediately */
@@ -1685,11 +1694,13 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset,
serial_num, asoc->asconf_seq_out_acked + 1);
return;
}
+
if (serial_num == asoc->asconf_seq_out - 1) {
/* stop our timer */
sctp_timer_stop(SCTP_TIMER_TYPE_ASCONF, stcb->sctp_ep, stcb, net,
SCTP_FROM_SCTP_ASCONF + SCTP_LOC_5);
}
+
/* process the ASCONF-ACK contents */
ack_length = ntohs(cp->ch.chunk_length) -
sizeof(struct sctp_asconf_ack_chunk);
@@ -1778,7 +1789,7 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset,
* at any given time
*/
if (last_error_id == 0)
- last_error_id--;/* set to "max" value */
+ last_error_id--; /* set to "max" value */
TAILQ_FOREACH_SAFE(aa, &stcb->asoc.asconf_queue, next, aa_next) {
if (aa->sent == 1) {
/*
@@ -1818,8 +1829,7 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset,
#ifdef INET6
static uint32_t
-sctp_is_scopeid_in_nets(struct sctp_tcb *stcb, struct sockaddr *sa)
-{
+sctp_is_scopeid_in_nets(struct sctp_tcb *stcb, struct sockaddr *sa){
struct sockaddr_in6 *sin6, *net6;
struct sctp_nets *net;
@@ -2058,6 +2068,7 @@ sctp_asconf_iterator_ep_end(struct sctp_inpcb *inp, vo
laddr->action = 0;
break;
}
+
}
} else if (l->action == SCTP_DEL_IP_ADDRESS) {
LIST_FOREACH_SAFE(laddr, &inp->sctp_addr_list, sctp_nxt_addr, nladdr) {
@@ -2091,6 +2102,7 @@ sctp_asconf_iterator_stcb(struct sctp_inpcb *inp, stru
if (ifa->vrf_id != stcb->asoc.vrf_id) {
continue;
}
+
/* Same checks again for assoc */
switch (ifa->address.sa.sa_family) {
#ifdef INET6
@@ -2269,8 +2281,7 @@ sctp_asconf_iterator_end(void *ptr, uint32_t val SCTP_
* returns: 0 = completed, -1 = error
*/
int32_t
-sctp_set_primary_ip_address_sa(struct sctp_tcb *stcb, struct sockaddr *sa)
-{
+sctp_set_primary_ip_address_sa(struct sctp_tcb *stcb, struct sockaddr *sa){
uint32_t vrf_id;
struct sctp_ifa *ifa;
@@ -2281,6 +2292,7 @@ sctp_set_primary_ip_address_sa(struct sctp_tcb *stcb,
/* Invalid address */
return (-1);
}
+
/* queue an ASCONF:SET_PRIM_ADDR to be sent */
if (!sctp_asconf_queue_add(stcb, ifa, SCTP_SET_PRIM_ADDR)) {
/* set primary queuing succeeded */
@@ -2359,11 +2371,13 @@ sctp_is_addr_pending(struct sctp_tcb *stcb, struct sct
SCTPDBG(SCTP_DEBUG_ASCONF1, "is_addr_pending: param length(%u) too short\n", param_length);
break;
}
+
aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(chk->data, offset, param_length, aparam_buf);
if (aph == NULL) {
SCTPDBG(SCTP_DEBUG_ASCONF1, "is_addr_pending: couldn't get entire param\n");
break;
}
+
ph = (struct sctp_paramhdr *)(aph + 1);
if (sctp_addr_match(ph, &sctp_ifa->address.sa) != 0) {
switch (param_type) {
@@ -2378,6 +2392,7 @@ sctp_is_addr_pending(struct sctp_tcb *stcb, struct sct
}
last_param_type = param_type;
}
+
offset += SCTP_SIZE32(param_length);
if (offset >= asconf_limit) {
/* no more data in the mbuf chain */
@@ -2461,6 +2476,7 @@ sctp_find_valid_localaddr(struct sctp_tcb *stcb, int a
if (sctp_ifa->localifa_flags & SCTP_ADDR_IFA_UNUSEABLE) {
continue;
}
+
sin6 = &sctp_ifa->address.sin6;
if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
/*
@@ -2754,7 +2770,7 @@ sctp_process_initack_addresses(struct sctp_tcb *stcb,
/* 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);
@@ -2768,7 +2784,7 @@ sctp_process_initack_addresses(struct sctp_tcb *stcb,
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;
@@ -2789,7 +2805,7 @@ sctp_process_initack_addresses(struct sctp_tcb *stcb,
/* 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;
@@ -2836,6 +2852,7 @@ sctp_process_initack_addresses(struct sctp_tcb *stcb,
}
}
}
+
next_addr:
/*
* Sanity check: Make sure the length isn't 0, otherwise
@@ -2851,7 +2868,7 @@ next_addr:
if ((offset + sizeof(struct sctp_paramhdr)) > length)
return;
ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset,
- sizeof(struct sctp_paramhdr), (uint8_t *)&tmp_param);
+ sizeof(struct sctp_paramhdr), (uint8_t *) & tmp_param);
} /* while */
}
@@ -2861,8 +2878,7 @@ next_addr:
* 1 if found, 0 if not
*/
static uint32_t
-sctp_addr_in_initack(struct mbuf *m, uint32_t offset, uint32_t length, struct sockaddr *sa)
-{
+sctp_addr_in_initack(struct mbuf *m, uint32_t offset, uint32_t length, struct sockaddr *sa){
struct sctp_paramhdr tmp_param, *ph;
uint16_t plen, ptype;
#ifdef INET
@@ -2902,7 +2918,7 @@ sctp_addr_in_initack(struct mbuf *m, uint32_t offset,
}
/* 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);
@@ -2918,7 +2934,7 @@ sctp_addr_in_initack(struct mbuf *m, uint32_t offset,
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);
}
@@ -2948,7 +2964,7 @@ sctp_addr_in_initack(struct mbuf *m, uint32_t offset,
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);
}
@@ -2970,7 +2986,7 @@ sctp_addr_in_initack(struct mbuf *m, uint32_t offset,
}
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);
@@ -3141,8 +3157,7 @@ sctp_check_address_list(struct sctp_tcb *stcb, struct
*/
uint32_t
sctp_addr_mgmt_ep_sa(struct sctp_inpcb *inp, struct sockaddr *sa,
- uint32_t type, uint32_t vrf_id, struct sctp_ifa *sctp_ifap)
-{
+ uint32_t type, uint32_t vrf_id, struct sctp_ifa *sctp_ifap){
struct sctp_ifa *ifa;
struct sctp_laddr *laddr, *nladdr;
@@ -3370,6 +3385,7 @@ sctp_asconf_send_nat_state_update(struct sctp_tcb *stc
if (vrf == NULL) {
goto skip_rest;
}
+
SCTP_IPI_ADDR_RLOCK();
LIST_FOREACH(sctp_ifnp, &vrf->ifnlist, next_ifn) {
LIST_FOREACH(sctp_ifap, &sctp_ifnp->ifalist, next_ifa) {
Modified: head/sys/netinet/sctp_asconf.h
==============================================================================
--- head/sys/netinet/sctp_asconf.h Thu Jul 19 19:32:08 2018 (r336502)
+++ head/sys/netinet/sctp_asconf.h Thu Jul 19 19:33:42 2018 (r336503)
@@ -60,10 +60,10 @@ sctp_addr_mgmt_ep_sa(struct sctp_inpcb *, struct socka
uint32_t, uint32_t, struct sctp_ifa *);
-extern int
+extern int
sctp_asconf_iterator_ep(struct sctp_inpcb *inp, void *ptr,
uint32_t val);
-extern void
+extern void
sctp_asconf_iterator_stcb(struct sctp_inpcb *inp,
struct sctp_tcb *stcb,
void *ptr, uint32_t type);
Modified: head/sys/netinet/sctp_auth.c
==============================================================================
--- head/sys/netinet/sctp_auth.c Thu Jul 19 19:32:08 2018 (r336502)
+++ head/sys/netinet/sctp_auth.c Thu Jul 19 19:33:42 2018 (r336503)
@@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
void
-sctp_clear_chunklist(sctp_auth_chklist_t *chklist)
+sctp_clear_chunklist(sctp_auth_chklist_t * chklist)
{
memset(chklist, 0, sizeof(*chklist));
/* chklist->num_chunks = 0; */
@@ -75,14 +75,14 @@ sctp_alloc_chunklist(void)
}
void
-sctp_free_chunklist(sctp_auth_chklist_t *list)
+sctp_free_chunklist(sctp_auth_chklist_t * list)
{
if (list != NULL)
SCTP_FREE(list, SCTP_M_AUTH_CL);
}
sctp_auth_chklist_t *
-sctp_copy_chunklist(sctp_auth_chklist_t *list)
+sctp_copy_chunklist(sctp_auth_chklist_t * list)
{
sctp_auth_chklist_t *new_list;
@@ -104,7 +104,7 @@ sctp_copy_chunklist(sctp_auth_chklist_t *list)
* add a chunk to the required chunks list
*/
int
-sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t *list)
+sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t * list)
{
if (list == NULL)
return (-1);
@@ -130,7 +130,7 @@ sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t
* delete a chunk from the required chunks list
*/
int
-sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklist_t *list)
+sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklist_t * list)
{
if (list == NULL)
return (-1);
@@ -146,7 +146,7 @@ sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklis
}
size_t
-sctp_auth_get_chklist_size(const sctp_auth_chklist_t *list)
+sctp_auth_get_chklist_size(const sctp_auth_chklist_t * list)
{
if (list == NULL)
return (0);
@@ -159,7 +159,7 @@ sctp_auth_get_chklist_size(const sctp_auth_chklist_t *
* guarantee ptr has space for up to 256 bytes
*/
int
-sctp_serialize_auth_chunks(const sctp_auth_chklist_t *list, uint8_t *ptr)
+sctp_serialize_auth_chunks(const sctp_auth_chklist_t * list, uint8_t * ptr)
{
int i, count = 0;
@@ -176,7 +176,7 @@ sctp_serialize_auth_chunks(const sctp_auth_chklist_t *
}
int
-sctp_pack_auth_chunks(const sctp_auth_chklist_t *list, uint8_t *ptr)
+sctp_pack_auth_chunks(const sctp_auth_chklist_t * list, uint8_t * ptr)
{
int i, size = 0;
@@ -208,8 +208,8 @@ sctp_pack_auth_chunks(const sctp_auth_chklist_t *list,
}
int
-sctp_unpack_auth_chunks(const uint8_t *ptr, uint8_t num_chunks,
- sctp_auth_chklist_t *list)
+sctp_unpack_auth_chunks(const uint8_t * ptr, uint8_t num_chunks,
+ sctp_auth_chklist_t * list)
{
int i;
int size;
@@ -259,14 +259,14 @@ sctp_alloc_key(uint32_t keylen)
}
void
-sctp_free_key(sctp_key_t *key)
+sctp_free_key(sctp_key_t * key)
{
if (key != NULL)
SCTP_FREE(key, SCTP_M_AUTH_KY);
}
void
-sctp_print_key(sctp_key_t *key, const char *str)
+sctp_print_key(sctp_key_t * key, const char *str)
{
uint32_t i;
@@ -285,7 +285,7 @@ sctp_print_key(sctp_key_t *key, const char *str)
}
void
-sctp_show_key(sctp_key_t *key, const char *str)
+sctp_show_key(sctp_key_t * key, const char *str)
{
uint32_t i;
@@ -304,8 +304,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);
else
@@ -331,7 +330,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;
@@ -351,7 +350,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;
@@ -402,7 +401,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;
@@ -476,7 +475,7 @@ sctp_alloc_sharedkey(void)
}
void
-sctp_free_sharedkey(sctp_sharedkey_t *skey)
+sctp_free_sharedkey(sctp_sharedkey_t * skey)
{
if (skey == NULL)
return;
@@ -502,7 +501,7 @@ sctp_find_sharedkey(struct sctp_keyhead *shared_keys,
int
sctp_insert_sharedkey(struct sctp_keyhead *shared_keys,
- sctp_sharedkey_t *new_skey)
+ sctp_sharedkey_t * new_skey)
{
sctp_sharedkey_t *skey;
@@ -596,8 +595,7 @@ sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t
}
static sctp_sharedkey_t *
-sctp_copy_sharedkey(const sctp_sharedkey_t *skey)
-{
+sctp_copy_sharedkey(const sctp_sharedkey_t * skey){
sctp_sharedkey_t *new_skey;
if (skey == NULL)
@@ -654,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);
@@ -663,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;
@@ -691,7 +689,7 @@ sctp_auth_add_hmacid(sctp_hmaclist_t *list, uint16_t h
}
sctp_hmaclist_t *
-sctp_copy_hmaclist(sctp_hmaclist_t *list)
+sctp_copy_hmaclist(sctp_hmaclist_t * list)
{
sctp_hmaclist_t *new_list;
int i;
@@ -729,8 +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;
if ((local == NULL) || (peer == NULL))
@@ -756,7 +753,7 @@ sctp_negotiate_hmacid(sctp_hmaclist_t *peer, sctp_hmac
* 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;
@@ -802,7 +799,7 @@ sctp_alloc_authinfo(void)
}
void
-sctp_free_authinfo(sctp_authinfo_t *authinfo)
+sctp_free_authinfo(sctp_authinfo_t * authinfo)
{
if (authinfo == NULL)
return;
@@ -822,8 +819,7 @@ sctp_free_authinfo(sctp_authinfo_t *authinfo)
uint32_t
-sctp_get_auth_chunk_len(uint16_t hmac_algo)
-{
+sctp_get_auth_chunk_len(uint16_t hmac_algo) {
int size;
size = sizeof(struct sctp_auth_chunk) + sctp_get_hmac_digest_len(hmac_algo);
@@ -831,8 +827,7 @@ sctp_get_auth_chunk_len(uint16_t hmac_algo)
}
uint32_t
-sctp_get_hmac_digest_len(uint16_t hmac_algo)
-{
+sctp_get_hmac_digest_len(uint16_t hmac_algo) {
switch (hmac_algo) {
case SCTP_AUTH_HMAC_ID_SHA1:
return (SCTP_AUTH_DIGEST_LEN_SHA1);
@@ -860,7 +855,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:
@@ -877,8 +872,8 @@ sctp_hmac_init(uint16_t hmac_algo, sctp_hash_context_t
}
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:
@@ -895,8 +890,8 @@ sctp_hmac_update(uint16_t hmac_algo, sctp_hash_context
}
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:
@@ -923,9 +918,8 @@ sctp_hmac_final(uint16_t hmac_algo, sctp_hash_context_
* resultant digest.
*/
uint32_t
-sctp_hmac(uint16_t hmac_algo, uint8_t *key, uint32_t keylen,
- uint8_t *text, uint32_t textlen, uint8_t *digest)
-{
+sctp_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen,
+ uint8_t * text, uint32_t textlen, uint8_t * digest) {
uint32_t digestlen;
uint32_t blocklen;
sctp_hash_context_t ctx;
@@ -983,9 +977,8 @@ sctp_hmac(uint16_t hmac_algo, uint8_t *key, uint32_t k
/* mbuf version */
uint32_t
-sctp_hmac_m(uint16_t hmac_algo, uint8_t *key, uint32_t keylen,
- struct mbuf *m, uint32_t m_offset, uint8_t *digest, uint32_t trailer)
-{
+sctp_hmac_m(uint16_t hmac_algo, uint8_t * key, uint32_t keylen,
+ struct mbuf *m, uint32_t m_offset, uint8_t * digest, uint32_t trailer){
uint32_t digestlen;
uint32_t blocklen;
sctp_hash_context_t ctx;
@@ -1031,17 +1024,17 @@ sctp_hmac_m(uint16_t hmac_algo, uint8_t *key, uint32_t
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);
}
@@ -1066,9 +1059,9 @@ sctp_hmac_m(uint16_t hmac_algo, uint8_t *key, uint32_t
* 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];
@@ -1099,9 +1092,8 @@ sctp_verify_hmac(uint16_t hmac_algo, uint8_t *key, uin
* the keylen exceeds the HMAC block len).
*/
uint32_t
-sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t *key, uint8_t *text,
- uint32_t textlen, uint8_t *digest)
-{
+sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t * key, uint8_t * text,
+ uint32_t textlen, uint8_t * digest) {
uint32_t digestlen;
uint32_t blocklen;
sctp_hash_context_t ctx;
@@ -1134,9 +1126,8 @@ sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t *key,
/* mbuf version */
uint32_t
-sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t *key, struct mbuf *m,
- uint32_t m_offset, uint8_t *digest)
-{
+sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t * key, struct mbuf *m,
+ uint32_t m_offset, uint8_t * digest){
uint32_t digestlen;
uint32_t blocklen;
sctp_hash_context_t ctx;
@@ -1166,7 +1157,7 @@ sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t *ke
}
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;
@@ -1309,6 +1300,7 @@ sctp_auth_setactivekey(struct sctp_tcb *stcb, uint16_t
/* can't reactivate a deactivated key with other refcounts */
return (-1);
}
+
/* set the (new) active key */
stcb->asoc.authinfo.active_keyid = keyid;
/* reset the deactivated flag */
@@ -1363,6 +1355,7 @@ sctp_deact_sharedkey(struct sctp_tcb *stcb, uint16_t k
sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb, keyid, 0,
SCTP_SO_LOCKED);
}
+
/* mark the key as deactivated */
skey->deactivated = 1;
@@ -1424,7 +1417,7 @@ sctp_auth_get_cookie_params(struct sctp_tcb *stcb, str
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);
@@ -1491,7 +1484,7 @@ sctp_auth_get_cookie_params(struct sctp_tcb *stcb, str
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;
@@ -1582,6 +1575,7 @@ sctp_fill_hmac_digest_m(struct mbuf *m, uint32_t auth_
"Assoc Key");
#endif
}
+
/* set in the active key id */
auth->shared_key_id = htons(keyid);
@@ -1603,14 +1597,14 @@ sctp_zero_m(struct mbuf *m, uint32_t m_offset, uint32_
/* find the correct starting mbuf and offset (get start position) */
m_tmp = m;
- while ((m_tmp != NULL) && (m_offset >= (uint32_t)SCTP_BUF_LEN(m_tmp))) {
+ while ((m_tmp != NULL) && (m_offset >= (uint32_t) SCTP_BUF_LEN(m_tmp))) {
m_offset -= SCTP_BUF_LEN(m_tmp);
m_tmp = SCTP_BUF_NEXT(m_tmp);
}
/* now use the rest of the mbuf chain */
while ((m_tmp != NULL) && (size > 0)) {
- data = mtod(m_tmp, uint8_t *)+m_offset;
- if (size > (uint32_t)(SCTP_BUF_LEN(m_tmp) - m_offset)) {
+ data = mtod(m_tmp, uint8_t *) + m_offset;
+ if (size > (uint32_t) (SCTP_BUF_LEN(m_tmp) - m_offset)) {
memset(data, 0, SCTP_BUF_LEN(m_tmp) - m_offset);
size -= SCTP_BUF_LEN(m_tmp) - m_offset;
} else {
@@ -1769,6 +1763,7 @@ sctp_notify_authentication(struct sctp_tcb *stcb, uint
/* If the socket is gone we are out of here */
return;
}
+
if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_AUTHEVNT))
/* event not enabled */
return;
@@ -1929,6 +1924,7 @@ sctp_validate_init_auth_params(struct mbuf *m, int off
if (num_chunks)
got_chklist = 1;
}
+
offset += SCTP_SIZE32(plen);
if (offset >= limit) {
break;
@@ -2023,6 +2019,7 @@ sctp_initialize_auth_params(struct sctp_inpcb *inp, st
new_key->key[keylen++] = i;
}
}
+
/* append in the HMACs */
ph = (struct sctp_paramhdr *)(new_key->key + keylen);
ph->param_type = htons(SCTP_HMAC_LIST);
Modified: head/sys/netinet/sctp_auth.h
==============================================================================
--- head/sys/netinet/sctp_auth.h Thu Jul 19 19:32:08 2018 (r336502)
+++ head/sys/netinet/sctp_auth.h Thu Jul 19 19:33:42 2018 (r336503)
@@ -53,12 +53,12 @@ __FBSDID("$FreeBSD$");
typedef union sctp_hash_context {
SCTP_SHA1_CTX sha1;
SCTP_SHA256_CTX sha256;
-} sctp_hash_context_t;
+} sctp_hash_context_t;
typedef struct sctp_key {
uint32_t keylen;
uint8_t key[];
-} sctp_key_t;
+} sctp_key_t;
typedef struct sctp_shared_key {
LIST_ENTRY(sctp_shared_key) next;
@@ -66,7 +66,7 @@ typedef struct sctp_shared_key {
uint32_t refcount; /* reference count */
uint16_t keyid; /* shared key ID */
uint8_t deactivated; /* key is deactivated */
-} sctp_sharedkey_t;
+} sctp_sharedkey_t;
LIST_HEAD(sctp_keyhead, sctp_shared_key);
@@ -74,26 +74,26 @@ LIST_HEAD(sctp_keyhead, sctp_shared_key);
typedef struct sctp_auth_chklist {
uint8_t chunks[256];
uint8_t num_chunks;
-} sctp_auth_chklist_t;
+} sctp_auth_chklist_t;
/* hmac algos supported list */
typedef struct sctp_hmaclist {
uint16_t max_algo; /* max algorithms allocated */
uint16_t num_algo; /* num algorithms used */
uint16_t hmac[];
-} sctp_hmaclist_t;
+} sctp_hmaclist_t;
/* authentication info */
typedef struct sctp_authinformation {
sctp_key_t *random; /* local random key (concatenated) */
uint32_t random_len; /* local random number length for param */
- sctp_key_t *peer_random;/* peer's random key (concatenated) */
+ sctp_key_t *peer_random; /* peer's random key (concatenated) */
sctp_key_t *assoc_key; /* cached concatenated send key */
sctp_key_t *recv_key; /* cached concatenated recv key */
uint16_t active_keyid; /* active send keyid */
uint16_t assoc_keyid; /* current send keyid (cached) */
uint16_t recv_keyid; /* last recv keyid (cached) */
-} sctp_authinfo_t;
+} sctp_authinfo_t;
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-head
mailing list