diff --git a/sys/netinet/sctp_asconf.c b/sys/netinet/sctp_asconf.c index 680c4ad0118e..19a28eeeda3f 100644 --- a/sys/netinet/sctp_asconf.c +++ b/sys/netinet/sctp_asconf.c @@ -151,24 +151,19 @@ sctp_process_asconf_add_ip(struct sockaddr *src, struct sctp_asconf_paramhdr *ap union sctp_sockstore store; struct sctp_paramhdr *ph; uint16_t param_type, aparam_length; - #if defined(INET) || defined(INET6) uint16_t param_length; - #endif struct sockaddr *sa; int zero_address = 0; int bad_address = 0; - #ifdef INET struct sockaddr_in *sin; struct sctp_ipv4addr_param *v4addr; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sctp_ipv6addr_param *v6addr; - #endif aparam_length = ntohs(aph->ph.param_length); @@ -306,24 +301,19 @@ sctp_process_asconf_delete_ip(struct sockaddr *src, union sctp_sockstore store; struct sctp_paramhdr *ph; uint16_t param_type, aparam_length; - #if defined(INET) || defined(INET6) uint16_t param_length; - #endif struct sockaddr *sa; int zero_address = 0; int result; - #ifdef INET struct sockaddr_in *sin; struct sctp_ipv4addr_param *v4addr; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sctp_ipv6addr_param *v6addr; - #endif aparam_length = ntohs(aph->ph.param_length); @@ -441,23 +431,18 @@ sctp_process_asconf_set_primary(struct sockaddr *src, union sctp_sockstore store; struct sctp_paramhdr *ph; uint16_t param_type, aparam_length; - #if defined(INET) || defined(INET6) uint16_t param_length; - #endif struct sockaddr *sa; int zero_address = 0; - #ifdef INET struct sockaddr_in *sin; struct sctp_ipv4addr_param *v4addr; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sctp_ipv6addr_param *v6addr; - #endif aparam_length = ntohs(aph->ph.param_length); @@ -1785,7 +1770,7 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset, * if there are any "sent" params still on the queue, these are * implicitly "success", or "failed" (if we got an error back) ... * so process these appropriately - * + * * we assume that the correlation_id's are monotonically increasing * beginning from 1 and that we don't have *that* many outstanding * at any given time @@ -1861,7 +1846,6 @@ sctp_is_scopeid_in_nets(struct sctp_tcb *stcb, struct sockaddr *sa) /* didn't find one */ return (0); } - #endif /* @@ -2435,10 +2419,8 @@ 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); @@ -2490,10 +2472,8 @@ 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); @@ -2510,10 +2490,8 @@ 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, @@ -2530,10 +2508,8 @@ 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); @@ -2781,14 +2757,11 @@ sctp_process_initack_addresses(struct sctp_tcb *stcb, struct mbuf *m, uint16_t plen, ptype; struct sctp_ifa *sctp_ifa; union sctp_sockstore store; - #ifdef INET6 struct sctp_ipv6addr_param addr6_store; - #endif #ifdef INET struct sctp_ipv4addr_param addr4_store; - #endif SCTPDBG(SCTP_DEBUG_ASCONF2, "processing init-ack addresses\n"); @@ -2915,19 +2888,16 @@ sctp_addr_in_initack(struct mbuf *m, uint32_t offset, uint32_t length, struct so { struct sctp_paramhdr tmp_param, *ph; uint16_t plen, ptype; - #ifdef INET struct sockaddr_in *sin; struct sctp_ipv4addr_param *a4p; struct sctp_ipv6addr_param addr4_store; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sctp_ipv6addr_param *a6p; struct sctp_ipv6addr_param addr6_store; struct sockaddr_in6 sin6_tmp; - #endif switch (sa->sa_family) { @@ -3079,14 +3049,11 @@ sctp_check_address_list_all(struct sctp_tcb *stcb, struct mbuf *m, int offset, struct sctp_ifn *sctp_ifn; struct sctp_ifa *sctp_ifa; uint32_t vrf_id; - #ifdef INET struct sockaddr_in *sin; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; - #endif if (stcb) { @@ -3301,14 +3268,11 @@ sctp_asconf_send_nat_state_update(struct sctp_tcb *stcb, struct sctp_asconf_addr *aa; struct sctp_ifa *sctp_ifap; struct sctp_asconf_tag_param *vtag; - #ifdef INET struct sockaddr_in *to; - #endif #ifdef INET6 struct sockaddr_in6 *to6; - #endif if (net == NULL) { SCTPDBG(SCTP_DEBUG_ASCONF1, "sctp_asconf_send_nat_state_update: Missing net\n"); diff --git a/sys/netinet/sctp_asconf.h b/sys/netinet/sctp_asconf.h index 183c99b4b982..c8d670e59bc5 100644 --- a/sys/netinet/sctp_asconf.h +++ b/sys/netinet/sctp_asconf.h @@ -90,7 +90,6 @@ sctp_asconf_send_nat_state_update(struct sctp_tcb *stcb, extern int sctp_is_addr_pending(struct sctp_tcb *, struct sctp_ifa *); - #endif /* _KERNEL */ #endif /* !_NETINET_SCTP_ASCONF_H_ */ diff --git a/sys/netinet/sctp_bsd_addr.h b/sys/netinet/sctp_bsd_addr.h index 24660ca569c3..5fb1efb433e9 100644 --- a/sys/netinet/sctp_bsd_addr.h +++ b/sys/netinet/sctp_bsd_addr.h @@ -48,7 +48,6 @@ void sctp_startup_iterator(void); #ifdef INET6 void sctp_gather_internal_ifa_flags(struct sctp_ifa *ifa); - #endif #ifdef SCTP_PACKET_LOGGING diff --git a/sys/netinet/sctp_cc_functions.c b/sys/netinet/sctp_cc_functions.c index d55006029426..b87ac05234d8 100644 --- a/sys/netinet/sctp_cc_functions.c +++ b/sys/netinet/sctp_cc_functions.c @@ -160,17 +160,13 @@ sctp_cwnd_update_after_fr(struct sctp_tcb *stcb, 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 - */ + /* Short Version => Equal to + * Contel Version MBe */ net->ssthresh = (uint32_t) (((uint64_t) 4 * (uint64_t) net->mtu * (uint64_t) net->cwnd) / @@ -405,10 +401,8 @@ 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; } @@ -784,9 +778,9 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb, /* * At this point our bw_bytes has been updated by * incoming sack information. - * + * * But our bw may not yet be set. - * + * */ if ((net->cc_mod.rtcc.new_tot_time / 1000) > 0) { nbw = net->cc_mod.rtcc.bw_bytes / (net->cc_mod.rtcc.new_tot_time / 1000); @@ -851,10 +845,8 @@ 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; @@ -938,10 +930,8 @@ 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; @@ -1108,10 +1098,8 @@ 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) { @@ -1125,10 +1113,8 @@ 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; @@ -1375,10 +1361,8 @@ 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 { /* @@ -1390,10 +1374,8 @@ 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; } } @@ -2023,10 +2005,8 @@ 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; } @@ -2109,7 +2089,6 @@ htcp_min_cwnd(struct sctp_tcb *stcb, struct sctp_nets *net) { return (net->ssthresh); } - #endif static void diff --git a/sys/netinet/sctp_crc32.c b/sys/netinet/sctp_crc32.c index e7d5c9bb13ec..58abce23c7f4 100644 --- a/sys/netinet/sctp_crc32.c +++ b/sys/netinet/sctp_crc32.c @@ -113,7 +113,6 @@ sctp_calculate_cksum(struct mbuf *m, uint32_t offset) base = sctp_finalize_crc32c(base); return (base); } - #endif /* !defined(SCTP_WITH_NO_CSUM) */ diff --git a/sys/netinet/sctp_crc32.h b/sys/netinet/sctp_crc32.h index 3f98be41c48a..7fe02f5cbff9 100644 --- a/sys/netinet/sctp_crc32.h +++ b/sys/netinet/sctp_crc32.h @@ -39,9 +39,7 @@ __FBSDID("$FreeBSD$"); #if defined(_KERNEL) #if !defined(SCTP_WITH_NO_CSUM) uint32_t sctp_calculate_cksum(struct mbuf *, uint32_t); - #endif void sctp_delayed_cksum(struct mbuf *, uint32_t offset); - #endif /* _KERNEL */ #endif /* __crc32c_h__ */ diff --git a/sys/netinet/sctp_header.h b/sys/netinet/sctp_header.h index 3f4948ddeb41..f0eec817cf9a 100644 --- a/sys/netinet/sctp_header.h +++ b/sys/netinet/sctp_header.h @@ -182,7 +182,6 @@ struct sctp_init { uint32_t initial_tsn; /* I-TSN */ /* optional param's follow */ } SCTP_PACKED; - #define SCTP_IDENTIFICATION_SIZE 16 #define SCTP_ADDRESS_SIZE 4 #define SCTP_RESERVE_SPACE 6 diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c index cfdcfe7d0ffb..e68ee4d1609b 100644 --- a/sys/netinet/sctp_indata.c +++ b/sys/netinet/sctp_indata.c @@ -341,10 +341,8 @@ 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); @@ -487,13 +485,13 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, * has wrapped but not in the stream. Is this worth worrying about * or should we just change our queue sort at the bottom to be by * TSN. - * - * Could it also be legal for a peer to send ssn 1 with TSN 2 and ssn 2 - * with TSN 1? If the peer is doing some sort of funky TSN/SSN + * + * Could it also be legal for a peer to send ssn 1 with TSN 2 and + * ssn 2 with TSN 1? If the peer is doing some sort of funky TSN/SSN * assignment this could happen... and I don't see how this would be * a violation. So for now I am undecided an will leave the sort by * SSN alone. Maybe a hybred approach is the answer - * + * */ struct sctp_queued_to_read *at; int queue_needed; @@ -828,10 +826,8 @@ restart: 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) { @@ -855,10 +851,8 @@ restart: } 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,10 +912,8 @@ sctp_inject_old_unordered_data(struct sctp_tcb *stcb, uint32_t tmp; if (SCTP_TSN_GT(chk->rec.data.fsn_num, 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_num == control->fsn_included) || @@ -931,10 +923,10 @@ sctp_inject_old_unordered_data(struct sctp_tcb *stcb, * started the pd-api on the higher TSN * (since the equals part is a TSN failure * it must be that). - * - * We are completly hosed in that case since I - * have no way to recover. This really will - * only happen if we can get more TSN's + * + * We are completly hosed in that case since + * I have no way to recover. This really + * will only happen if we can get more TSN's * higher before the pd-api-point. */ sctp_abort_in_reasm(stcb, control, chk, @@ -1136,10 +1128,8 @@ done_un: } } 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: @@ -1171,21 +1161,15 @@ deliver_more: 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; } } @@ -1387,10 +1371,8 @@ 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_num)) { - /* - * 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); @@ -1417,10 +1399,8 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc, */ if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn_num)) { - /* - * 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_num, control->fsn_included); @@ -1430,10 +1410,8 @@ 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_num, control->top_fsn)) { SCTPDBG(SCTP_DEBUG_XXX, "New fsn: %u is beyond or at top_fsn: %u -- abort\n", @@ -1467,10 +1445,8 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc, inserted = 1; break; } else if (at->rec.data.fsn_num == chk->rec.data.fsn_num) { - /* - * 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 @@ -1778,19 +1754,15 @@ 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; @@ -2086,7 +2058,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, * if it is not being reset.. that way we would not create a * HOLB when amongst streams being reset and those not being * reset. - * + * */ if (((liste = TAILQ_FIRST(&asoc->resetHead)) != NULL) && SCTP_TSN_GT(tsn, liste->tsn)) { @@ -2284,10 +2256,10 @@ sctp_slide_mapping_arrays(struct sctp_tcb *stcb) /* * Now we also need to check the mapping array in a couple of ways. * 1) Did we move the cum-ack point? - * - * When you first glance at this you might think that all entries that - * make up the position of the cum-ack would be in the nr-mapping - * array only.. i.e. things up to the cum-ack are always + * + * When you first glance at this you might think that all entries + * that make up the position of the cum-ack would be in the + * nr-mapping array only.. i.e. things up to the cum-ack are always * deliverable. Thats true with one exception, when its a fragmented * message we may not deliver the data until some threshold (or all * of it) is in place. So we must OR the nr_mapping_array and @@ -2346,10 +2318,8 @@ sctp_slide_mapping_arrays(struct sctp_tcb *stcb) /* The complete array was completed by a single FR */ /* highest becomes the cum-ack */ int clr; - #ifdef INVARIANTS unsigned int i; - #endif /* clear the array */ @@ -2497,8 +2467,7 @@ 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)) && @@ -2510,9 +2479,9 @@ sctp_sack_check(struct sctp_tcb *stcb, int was_a_gap) /* * CMT DAC algorithm: With CMT, delay acks * even in the face of - * - * reordering. Therefore, if acks that do not - * have to be sent because of the above + * + * reordering. Therefore, if acks that do + * not have to be sent because of the above * reasons, will be delayed. That is, acks * that would have been sent due to gap * reports will be delayed with DAC. Start @@ -2719,7 +2688,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, * Now, what do we do with KNOWN * chunks that are NOT in the right * place? - * + * * For now, I do nothing but ignore * them. We may later want to add * sysctl stuff to switch out and do @@ -2761,8 +2730,7 @@ 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); @@ -3019,10 +2987,8 @@ 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; @@ -3031,8 +2997,7 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1 } } break; - } /* if (tp1->TSN_seq == theTSN) */ - if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, theTSN)) { + } /* if (tp1->TSN_seq == theTSN) */ if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, theTSN)) { break; } tp1 = TAILQ_NEXT(tp1, sctp_next); @@ -3483,10 +3448,8 @@ 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) { @@ -3498,10 +3461,8 @@ 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_seq, tp1->snd_count, 0, SCTP_FR_MARKED); @@ -3521,18 +3482,14 @@ 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); } @@ -3713,10 +3670,8 @@ sctp_fs_audit(struct sctp_association *asoc) struct sctp_tmit_chunk *chk; int inflight = 0, resend = 0, inbetween = 0, acked = 0, above = 0; int ret; - #ifndef INVARIANTS int entry_flight, entry_cnt; - #endif ret = 0; @@ -3933,8 +3888,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack, tp1->whoTo->RTO = /* * sa_ignore - * NO_NULL_CH - * K + * NO_NULL_CHK */ sctp_calculate_rto(stcb, asoc, tp1->whoTo, @@ -4066,10 +4020,8 @@ 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; } @@ -4152,10 +4104,8 @@ again: } } 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, @@ -4775,7 +4725,7 @@ hopeless_peer: } /* * Check for revoked fragments: - * + * * if Previous sack - Had no frags then we can't have any revoked if * Previous sack - Had frag's then - If we now have frags aka * num_seg > 0 call sctp_check_for_revoked() to tell if peer revoked @@ -4840,10 +4790,8 @@ hopeless_peer: } 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; } @@ -5054,10 +5002,8 @@ again: } } 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); @@ -5213,10 +5159,8 @@ 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_sequence_delivered = ctl->sinfo_ssn - 1; need_reasm_check = 1; break; @@ -5280,10 +5224,8 @@ 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_sequence_delivered = ctl->sinfo_ssn - 1; need_reasm_check = 1; break; @@ -5392,11 +5334,11 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, /* * here we will perform all the data receiver side steps for * processing FwdTSN, as required in by pr-sctp draft: - * + * * Assume we get FwdTSN(x): - * - * 1) update local cumTSN to x 2) try to further advance cumTSN to x + - * others we have 3) examine and update re-ordering queue on + * + * 1) update local cumTSN to x 2) try to further advance cumTSN to x + * + others we have 3) examine and update re-ordering queue on * pr-in-streams 4) clean up re-assembly queue 5) Send a sack to * report where we are. */ diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 5e9a1f9f30e6..5f547bc0cd6f 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -161,10 +161,8 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset, *abort_no_unlock = 1; goto outnow; } - /* - * We are only accepting if we have a socket with positive - * so_qlimit. - */ + /* We are only accepting if we have a socket with positive + * so_qlimit. */ if ((stcb == NULL) && ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) || (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || @@ -709,10 +707,8 @@ 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); @@ -730,10 +726,8 @@ 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); @@ -764,7 +758,6 @@ sctp_handle_abort(struct sctp_abort_chunk *abort, { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif uint16_t len; uint16_t error; @@ -866,10 +859,8 @@ sctp_handle_shutdown(struct sctp_shutdown_chunk *cp, struct sctp_association *asoc; int some_on_streamwheel; int old_state; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif SCTPDBG(SCTP_DEBUG_INPUT2, @@ -946,10 +937,8 @@ 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 */ @@ -999,7 +988,6 @@ sctp_handle_shutdown_ack(struct sctp_shutdown_ack_chunk *cp SCTP_UNUSED, struct sctp_nets *net) { struct sctp_association *asoc; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; @@ -1169,10 +1157,8 @@ sctp_handle_error(struct sctp_chunkhdr *ch, uint16_t error_len; struct sctp_association *asoc; int adjust; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif /* parse through all of the errors and process */ @@ -1492,10 +1478,8 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, int retval; int spec_flag = 0; uint32_t how_indx; - #if defined(SCTP_DETAILED_STR_STATS) int j; - #endif net = *netp; @@ -1619,7 +1603,6 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, ) { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif /* * Here is where collision would go if we @@ -1820,7 +1803,6 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, (inp->sctp_socket->so_qlimit == 0)) { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; @@ -1880,10 +1862,8 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, cookie->tie_tag_peer_vtag == asoc->peer_vtag_nonce && cookie->tie_tag_peer_vtag != 0) { struct sctpasochead *head; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif if (asoc->peer_supports_nat) { @@ -2067,7 +2047,6 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, int retval; int error = 0; uint8_t auth_chunk_buf[SCTP_PARAM_BUFFER_SIZE]; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; @@ -2442,14 +2421,11 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset, struct sctp_nets *netl; int had_a_existing_tcb = 0; int send_int_conf = 0; - #ifdef INET struct sockaddr_in sin; - #endif #ifdef INET6 struct sockaddr_in6 sin6; - #endif SCTPDBG(SCTP_DEBUG_INPUT2, @@ -2771,10 +2747,8 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset, if (so == NULL) { struct mbuf *op_err; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *pcb_so; - #endif /* Too many sockets */ SCTPDBG(SCTP_DEBUG_INPUT1, "process_cookie_new: no room for another socket!\n"); @@ -2887,10 +2861,8 @@ 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)); @@ -3102,10 +3074,8 @@ 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 @@ -3193,10 +3163,8 @@ sctp_handle_shutdown_complete(struct sctp_shutdown_complete_chunk *cp SCTP_UNUSE struct sctp_tcb *stcb, struct sctp_nets *net) { struct sctp_association *asoc; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif SCTPDBG(SCTP_DEBUG_INPUT2, @@ -3430,10 +3398,8 @@ 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; @@ -3674,10 +3640,8 @@ 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; @@ -4530,10 +4494,8 @@ __attribute__((noinline)) uint32_t auth_offset = 0, auth_len = 0; int auth_skipped = 0; int asconf_cnt = 0; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif SCTPDBG(SCTP_DEBUG_INPUT1, "sctp_process_control: iphlen=%u, offset=%u, length=%u stcb:%p\n", @@ -4733,10 +4695,8 @@ __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)) && @@ -5030,10 +4990,8 @@ process_control_chunks: } } 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; @@ -5651,8 +5609,7 @@ process_control_chunks: /* 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) */ @@ -6109,10 +6066,8 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint16_t port) struct sctphdr *sh; struct sctp_chunkhdr *ch; int length, offset; - #if !defined(SCTP_WITH_NO_CSUM) uint8_t compute_crc; - #endif uint32_t mflowid; uint8_t mflowtype; @@ -6213,7 +6168,6 @@ out: #if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP) extern int *sctp_cpuarry; - #endif int @@ -6261,5 +6215,4 @@ sctp_input(struct mbuf **mp, int *offp, int proto SCTP_UNUSED) sctp_input_with_port(m, off, 0); return (IPPROTO_DONE); } - #endif diff --git a/sys/netinet/sctp_os_bsd.h b/sys/netinet/sctp_os_bsd.h index 777e0a72e778..b0c92da649f6 100644 --- a/sys/netinet/sctp_os_bsd.h +++ b/sys/netinet/sctp_os_bsd.h @@ -247,7 +247,6 @@ MALLOC_DECLARE(SCTP_M_MCORE); /* SCTP_ZONE_INIT: initialize the zone */ typedef struct uma_zone *sctp_zone_t; - #define SCTP_ZONE_INIT(zone, name, size, number) { \ zone = uma_zcreate(name, size, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR,\ 0); \ diff --git a/sys/netinet/sctp_pcb.h b/sys/netinet/sctp_pcb.h index 98204096e7bb..a2a1e7d79282 100644 --- a/sys/netinet/sctp_pcb.h +++ b/sys/netinet/sctp_pcb.h @@ -353,7 +353,6 @@ struct sctp_pcbtsn_rlog { uint16_t sz; uint16_t flgs; }; - #define SCTP_READ_LOG_SIZE 135 /* we choose the number to make a pcb a page */ @@ -380,10 +379,8 @@ 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 */ @@ -490,7 +487,6 @@ VNET_DECLARE(struct sctp_base_info, system_base_info); #ifdef INET6 int SCTP6_ARE_ADDR_EQUAL(struct sockaddr_in6 *a, struct sockaddr_in6 *b); - #endif void sctp_fill_pcbinfo(struct sctp_pcbinfo *); @@ -646,7 +642,6 @@ sctp_initiate_iterator(inp_func inpf, end_func ef, struct sctp_inpcb *, uint8_t co_off); - #if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP) void sctp_queue_to_mcore(struct mbuf *m, int off, int cpu_to_use); diff --git a/sys/netinet/sctp_peeloff.h b/sys/netinet/sctp_peeloff.h index dd905676bcdf..00b870312365 100644 --- a/sys/netinet/sctp_peeloff.h +++ b/sys/netinet/sctp_peeloff.h @@ -38,6 +38,5 @@ __FBSDID("$FreeBSD$"); #if defined(_KERNEL) int sctp_can_peel_off(struct socket *, sctp_assoc_t); int sctp_do_peeloff(struct socket *, struct socket *, sctp_assoc_t); - #endif /* _KERNEL */ #endif /* _NETINET_SCTP_PEELOFF_H_ */ diff --git a/sys/netinet/sctp_ss_functions.c b/sys/netinet/sctp_ss_functions.c index 672da91b659b..05ff11ee6ce8 100644 --- a/sys/netinet/sctp_ss_functions.c +++ b/sys/netinet/sctp_ss_functions.c @@ -144,10 +144,8 @@ 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)) { @@ -459,10 +457,8 @@ 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)) { @@ -635,10 +631,8 @@ 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 280100bbd163..6fd2d819549f 100644 --- a/sys/netinet/sctp_structs.h +++ b/sys/netinet/sctp_structs.h @@ -183,7 +183,6 @@ struct iterator_control { uint32_t iterator_running; uint32_t iterator_flags; }; - #define SCTP_ITERATOR_STOP_CUR_IT 0x00000004 #define SCTP_ITERATOR_STOP_CUR_INP 0x00000008 @@ -883,10 +882,8 @@ 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 de21941ae1b7..e46a8c7be736 100644 --- a/sys/netinet/sctp_sysctl.c +++ b/sys/netinet/sctp_sysctl.c @@ -643,12 +643,10 @@ static int sctp_sysctl_handle_stats(SYSCTL_HANDLER_ARGS) { int error; - #if defined(SMP) && defined(SCTP_USE_PERCPU_STAT) struct sctpstat *sarry; struct sctpstat sb; int cpu; - #endif struct sctpstat sb_temp; @@ -828,7 +826,6 @@ sctp_sysctl_handle_trace_log_clear(SYSCTL_HANDLER_ARGS) memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log)); return (error); } - #endif #define SCTP_UINT_SYSCTL(mib_name, var_name, prefix) \ diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index ae6ec4970d6d..3baa66e12e37 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -193,10 +193,8 @@ 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; @@ -286,11 +284,8 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, } else { return (max_cwnd_net); } - } - /* - * JRS 5/14/07 - If mode is set to 1, use the CMT policy for - * choosing an alternate net. - */ + } /* JRS 5/14/07 - If mode is set to 1, use the + * 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) || @@ -470,7 +465,6 @@ sctp_recover_sent_list(struct sctp_tcb *stcb) SCTP_PRINTF("chk:%p TSN:%x\n", (void *)chk, chk->rec.data.TSN_seq); } } - #endif static int diff --git a/sys/netinet/sctp_uio.h b/sys/netinet/sctp_uio.h index e65b7b5ede56..d6055163abba 100644 --- a/sys/netinet/sctp_uio.h +++ b/sys/netinet/sctp_uio.h @@ -147,7 +147,6 @@ struct sctp_extrcvinfo { uint16_t sinfo_keynumber_valid; uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD_SHORT]; }; - #define sinfo_pr_value sinfo_timetolive #define sreinfo_next_flags serinfo_next_flags #define sreinfo_next_stream serinfo_next_stream @@ -573,7 +572,6 @@ struct sctp_paddrparams { uint16_t spp_pathmaxrxt; uint8_t spp_dscp; }; - #define spp_ipv4_tos spp_dscp #define SPP_HB_ENABLE 0x00000001 @@ -1284,7 +1282,6 @@ sctp_sorecvmsg(struct socket *so, int *msg_flags, struct sctp_sndrcvinfo *sinfo, int filling_sinfo); - #endif /* diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 77dd6345bfe4..b1711ccd18e1 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -156,7 +156,6 @@ sctp_notify(struct sctp_inpcb *inp, { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif int timer_stopped; @@ -344,7 +343,6 @@ sctp_ctlinput(int cmd, struct sockaddr *sa, void *vip) } return; } - #endif static int @@ -977,10 +975,8 @@ 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); @@ -1021,14 +1017,11 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, struct sctp_ifa *sctp_ifa; size_t actual; int loopback_scope; - #if defined(INET) int ipv4_local_scope, ipv4_addr_legal; - #endif #if defined(INET6) int local_scope, site_scope, ipv6_addr_legal; - #endif struct sctp_vrf *vrf; @@ -1174,19 +1167,14 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, if (sin6->sin6_scope_id == 0) { if (sa6_recoverscope(sin6) != 0) /* - * + * * bad - * - * li - * nk - * - * loc - * al - * - * add - * re - * ss - * */ + * link + * + * local + * + * address + */ continue; } } @@ -1521,19 +1509,19 @@ out_now: stcb = LIST_FIRST(&inp->sctp_asoc_list); \ if (stcb) { \ SCTP_TCB_LOCK(stcb); \ - } \ + } \ SCTP_INP_RUNLOCK(inp); \ } else if (assoc_id > SCTP_ALL_ASSOC) { \ stcb = sctp_findassociation_ep_asocid(inp, assoc_id, 1); \ if (stcb == NULL) { \ - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT); \ + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT); \ error = ENOENT; \ break; \ } \ } else { \ stcb = NULL; \ - } \ - } + } \ +} #define SCTP_CHECK_AND_CAST(destp, srcp, type, size) {\ @@ -1544,7 +1532,7 @@ out_now: } else { \ destp = (type *)srcp; \ } \ - } +} static int sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize, @@ -1823,10 +1811,8 @@ flags_out: } 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; } @@ -2326,10 +2312,8 @@ flags_out: struct sctp_paddrparams *paddrp; struct sctp_nets *net; struct sockaddr *addr; - #if defined(INET) && defined(INET6) struct sockaddr_in sin_store; - #endif SCTP_CHECK_AND_CAST(paddrp, optval, struct sctp_paddrparams, *optsize); @@ -2529,10 +2513,8 @@ flags_out: struct sctp_paddrinfo *paddri; struct sctp_nets *net; struct sockaddr *addr; - #if defined(INET) && defined(INET6) struct sockaddr_in sin_store; - #endif SCTP_CHECK_AND_CAST(paddri, optval, struct sctp_paddrinfo, *optsize); @@ -3198,10 +3180,8 @@ flags_out: struct sctp_paddrthlds *thlds; struct sctp_nets *net; struct sockaddr *addr; - #if defined(INET) && defined(INET6) struct sockaddr_in sin_store; - #endif SCTP_CHECK_AND_CAST(thlds, optval, struct sctp_paddrthlds, *optsize); @@ -3312,10 +3292,8 @@ flags_out: struct sctp_udpencaps *encaps; struct sctp_nets *net; struct sockaddr *addr; - #if defined(INET) && defined(INET6) struct sockaddr_in sin_store; - #endif SCTP_CHECK_AND_CAST(encaps, optval, struct sctp_udpencaps, *optsize); @@ -3909,12 +3887,10 @@ 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; } @@ -4125,10 +4101,8 @@ 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; } @@ -4358,10 +4332,8 @@ 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 @@ -4760,10 +4732,8 @@ 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; @@ -4811,10 +4781,8 @@ 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: @@ -4960,10 +4928,8 @@ 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 { @@ -5106,10 +5072,8 @@ 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)) { @@ -5195,10 +5159,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, struct sctp_paddrparams *paddrp; struct sctp_nets *net; struct sockaddr *addr; - #if defined(INET) && defined(INET6) struct sockaddr_in sin_store; - #endif SCTP_CHECK_AND_CAST(paddrp, optval, struct sctp_paddrparams, optsize); @@ -5699,10 +5661,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, struct sctp_setprim *spa; struct sctp_nets *net; struct sockaddr *addr; - #if defined(INET) && defined(INET6) struct sockaddr_in sin_store; - #endif SCTP_CHECK_AND_CAST(spa, optval, struct sctp_setprim, optsize); @@ -5791,10 +5751,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, { struct sctp_setpeerprim *sspp; struct sockaddr *addr; - #if defined(INET) && defined(INET6) struct sockaddr_in sin_store; - #endif SCTP_CHECK_AND_CAST(sspp, optval, struct sctp_setpeerprim, optsize); @@ -5826,10 +5784,8 @@ 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; @@ -6244,10 +6200,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, struct sctp_paddrthlds *thlds; struct sctp_nets *net; struct sockaddr *addr; - #if defined(INET) && defined(INET6) struct sockaddr_in sin_store; - #endif SCTP_CHECK_AND_CAST(thlds, optval, struct sctp_paddrthlds, optsize); @@ -6415,10 +6369,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, struct sctp_udpencaps *encaps; struct sctp_nets *net; struct sockaddr *addr; - #if defined(INET) && defined(INET6) struct sockaddr_in sin_store; - #endif SCTP_CHECK_AND_CAST(encaps, optval, struct sctp_udpencaps, optsize); @@ -6589,10 +6541,8 @@ 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 { @@ -6628,10 +6578,8 @@ 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 { @@ -7010,7 +6958,6 @@ out_now: SCTP_INP_DECR_REF(inp); return (error); } - #endif int @@ -7064,10 +7011,8 @@ 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) { @@ -7108,10 +7053,8 @@ 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) { @@ -7184,10 +7127,8 @@ sctp_accept(struct socket *so, struct sockaddr **addr) struct sctp_tcb *stcb; struct sctp_inpcb *inp; union sctp_sockstore store; - #ifdef INET6 int error; - #endif inp = (struct sctp_inpcb *)so->so_pcb; @@ -7470,5 +7411,4 @@ struct pr_usrreqs sctp_usrreqs = { .pru_sosend = sctp_sosend, .pru_soreceive = sctp_soreceive }; - #endif diff --git a/sys/netinet/sctp_var.h b/sys/netinet/sctp_var.h index a4d2b99867a9..858acfbca056 100644 --- a/sys/netinet/sctp_var.h +++ b/sys/netinet/sctp_var.h @@ -332,11 +332,9 @@ void sctp_close(struct socket *so); int sctp_disconnect(struct socket *so); void sctp_ctlinput(int, struct sockaddr *, void *); int sctp_ctloutput(struct socket *, struct sockopt *); - #ifdef INET void sctp_input_with_port(struct mbuf *, int, uint16_t); int sctp_input(struct mbuf **, int *, int); - #endif void sctp_pathmtu_adjustment(struct sctp_tcb *, uint16_t); void sctp_drain(void); diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 6eb9e2393997..fbe9d129a280 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -255,7 +255,6 @@ sctp_log_mbc(struct mbuf *m, int from) sctp_log_mb(mat, from); } } - #endif void @@ -447,7 +446,6 @@ sctp_log_mbcnt(uint8_t from, uint32_t total_oq, uint32_t book, uint32_t total_mb sctp_clog.x.misc.log3, sctp_clog.x.misc.log4); } - #endif void @@ -957,10 +955,8 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, * caller in the sctp_aloc_assoc() function. */ int i; - #if defined(SCTP_DETAILED_STR_STATS) int j; - #endif asoc = &stcb->asoc; @@ -1486,10 +1482,8 @@ 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 { @@ -1512,10 +1506,8 @@ sctp_timeout_handler(void *t) struct sctp_nets *net; struct sctp_timer *tmr; struct mbuf *op_err; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif int did_output; int type; @@ -2491,10 +2483,8 @@ sctp_calculate_rto(struct sctp_tcb *stcb, /* compute rtt in ms */ 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); } /* @@ -2686,10 +2676,8 @@ sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, unsigned int notif_len; uint16_t abort_len; unsigned int i; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif if (stcb == NULL) { @@ -3975,10 +3963,8 @@ sctp_abort_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, uint32_t vrf_id, uint16_t port) { uint32_t vtag; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif vtag = 0; @@ -4014,7 +4000,6 @@ sctp_abort_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, #endif } } - #ifdef SCTP_ASOCLOG_OF_TSNS void sctp_print_out_track_log(struct sctp_tcb *stcb) @@ -4076,7 +4061,6 @@ none_in: } #endif } - #endif void @@ -4090,7 +4074,6 @@ sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) @@ -4302,7 +4285,6 @@ sctp_recover_scope(struct sockaddr_in6 *addr, struct sockaddr_in6 *store) } return (addr); } - #endif /* @@ -4356,7 +4338,6 @@ sctp_print_address(struct sockaddr *sa) { #ifdef INET6 char ip6buf[INET6_ADDRSTRLEN]; - #endif switch (sa->sa_family) { @@ -4810,10 +4791,8 @@ 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--; @@ -5187,7 +5166,7 @@ sctp_sorecvmsg(struct socket *so, * mp=NULL thus uio is the copy method to userland) MSG_WAITALL - ?? * On the way out we may send out any combination of: * MSG_NOTIFICATION MSG_EOR - * + * */ struct sctp_inpcb *inp = NULL; int my_len = 0; @@ -5306,10 +5285,8 @@ restart_nosblocks: * connect. */ if (inp->sctp_flags & SCTP_PCB_FLAGS_WAS_ABORTED) { - /* - * You were aborted, passive side - * always hits here - */ + /* You were aborted, passive side + * always hits here */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, ECONNRESET); error = ECONNRESET; } @@ -5408,10 +5385,8 @@ restart_nosblocks: } if ((control->length == 0) && (control->end_added == 1)) { - /* - * Do we also need to check for (control->pdapi_aborted == - * 1)? - */ + /* Do we also need to check for (control->pdapi_aborted == + * 1)? */ if (hold_rlock == 0) { hold_rlock = 1; SCTP_INP_READ_LOCK(inp); @@ -5754,10 +5729,8 @@ get_more_data: atomic_subtract_int(&control->length, cp_len); control->data = sctp_m_free(m); m = control->data; - /* - * been through it all, must hold sb - * lock ok to null tail - */ + /* been through it all, must hold sb + * lock ok to null tail */ if (control->data == NULL) { #ifdef INVARIANTS if ((control->end_added == 0) || @@ -5976,10 +5949,8 @@ wait_some_more: */ SCTP_INP_READ_LOCK(inp); if ((control->length > 0) && (control->data == NULL)) { - /* - * big trouble.. we have the lock and its - * corrupt? - */ + /* big trouble.. we have the lock and its + * corrupt? */ #ifdef INVARIANTS panic("Impossible data==NULL length !=0"); #endif @@ -6270,14 +6241,11 @@ sctp_connectx_helper_add(struct sctp_tcb *stcb, struct sockaddr *addr, struct sctp_inpcb *inp; struct sockaddr *sa; size_t incr = 0; - #ifdef INET struct sockaddr_in *sin; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; - #endif sa = addr; @@ -6433,10 +6401,8 @@ sctp_bindx_add_address(struct socket *so, struct sctp_inpcb *inp, uint32_t vrf_id, int *error, void *p) { struct sockaddr *addr_touse; - #if defined(INET) && defined(INET6) struct sockaddr_in sin; - #endif /* see if we're bound all already! */ @@ -6565,10 +6531,8 @@ sctp_bindx_delete_address(struct sctp_inpcb *inp, uint32_t vrf_id, int *error) { struct sockaddr *addr_touse; - #if defined(INET) && defined(INET6) struct sockaddr_in sin; - #endif /* see if we're bound all already! */ @@ -6582,7 +6546,6 @@ sctp_bindx_delete_address(struct sctp_inpcb *inp, if (sa->sa_family == AF_INET6) { #ifdef INET struct sockaddr_in6 *sin6; - #endif if (sa->sa_len != sizeof(struct sockaddr_in6)) { @@ -6653,14 +6616,11 @@ int sctp_local_addr_count(struct sctp_tcb *stcb) { int loopback_scope; - #if defined(INET) int ipv4_local_scope, ipv4_addr_legal; - #endif #if defined (INET6) int local_scope, site_scope, ipv6_addr_legal; - #endif struct sctp_vrf *vrf; struct sctp_ifn *sctp_ifn; @@ -6705,10 +6665,8 @@ 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, @@ -6745,19 +6703,14 @@ sctp_local_addr_count(struct sctp_tcb *stcb) if (sin6->sin6_scope_id == 0) { if (sa6_recoverscope(sin6) != 0) /* - * + * * bad - * - * li - * nk - * - * loc - * al - * - * add - * re - * ss - * */ + * link + * + * local + * + * address + */ continue; } } @@ -6829,10 +6782,8 @@ sctp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *inp, const struct sockaddr *sa SCTP_UNUSED, void *ctx SCTP_UNUSED) { struct ip *iph; - #ifdef INET6 struct ip6_hdr *ip6; - #endif struct mbuf *sp, *last; struct udphdr *uhdr; @@ -7017,7 +6968,6 @@ sctp_recv_icmp_tunneled_packet(int cmd, struct sockaddr *sa, void *vip, void *ct } return; } - #endif #ifdef INET6 @@ -7159,7 +7109,6 @@ sctp_recv_icmp6_tunneled_packet(int cmd, struct sockaddr *sa, void *d, void *ctx } } } - #endif void @@ -7188,14 +7137,11 @@ sctp_over_udp_start(void) { uint16_t port; int ret; - #ifdef INET struct sockaddr_in sin; - #endif #ifdef INET6 struct sockaddr_in6 sin6; - #endif /* * This function assumes sysctl caller holds sctp_sysctl_info_lock() diff --git a/sys/netinet/sctputil.h b/sys/netinet/sctputil.h index 292068af4da3..a3a4f3c60915 100644 --- a/sys/netinet/sctputil.h +++ b/sys/netinet/sctputil.h @@ -43,13 +43,11 @@ __FBSDID("$FreeBSD$"); #ifdef SCTP_ASOCLOG_OF_TSNS void sctp_print_out_track_log(struct sctp_tcb *stcb); - #endif #ifdef SCTP_MBUF_LOGGING struct mbuf *sctp_m_free(struct mbuf *m); void sctp_m_freem(struct mbuf *m); - #else #define sctp_m_free m_free #define sctp_m_freem m_freem @@ -58,7 +56,6 @@ void sctp_m_freem(struct mbuf *m); #if defined(SCTP_LOCAL_TRACE_BUF) || defined(__APPLE__) void sctp_log_trace(uint32_t fr, const char *str SCTP_UNUSED, uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_t e, uint32_t f); - #endif #define sctp_get_associd(stcb) ((sctp_assoc_t)stcb->asoc.assoc_id) @@ -222,7 +219,6 @@ sctp_connectx_helper_find(struct sctp_inpcb *inp, struct sockaddr *addr, int *error, unsigned int limit, int *bad_addr); int sctp_is_there_an_abort_here(struct mbuf *, int, uint32_t *); - #ifdef INET6 uint32_t sctp_is_same_scope(struct sockaddr_in6 *, struct sockaddr_in6 *); @@ -357,7 +353,6 @@ void void sctp_log_mbc(struct mbuf *m, int from); - #endif void diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c index cbe50d93eaac..7d5654172b9f 100644 --- a/sys/netinet6/sctp6_usrreq.c +++ b/sys/netinet6/sctp6_usrreq.c @@ -74,10 +74,8 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, uint16_t port) struct sctphdr *sh; struct sctp_chunkhdr *ch; int length, offset; - #if !defined(SCTP_WITH_NO_CSUM) uint8_t compute_crc; - #endif uint32_t mflowid; uint8_t mflowtype; @@ -194,7 +192,6 @@ sctp6_notify(struct sctp_inpcb *inp, { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif int timer_stopped; @@ -696,7 +693,6 @@ sctp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, #ifdef INET struct sockaddr_in6 *sin6; - #endif /* INET */ /* No SPL needed since sctp_output does this */ @@ -798,12 +794,10 @@ sctp6_connect(struct socket *so, struct sockaddr *addr, struct thread *p) int error = 0; struct sctp_inpcb *inp; struct sctp_tcb *stcb; - #ifdef INET struct in6pcb *inp6; struct sockaddr_in6 *sin6; union sctp_sockstore store; - #endif #ifdef INET diff --git a/sys/netinet6/sctp6_var.h b/sys/netinet6/sctp6_var.h index 782567c554ef..232fee15da1d 100644 --- a/sys/netinet6/sctp6_var.h +++ b/sys/netinet6/sctp6_var.h @@ -50,6 +50,5 @@ void sctp6_ctlinput(int, struct sockaddr *, void *); void sctp6_notify(struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *, uint8_t, uint8_t, uint16_t); - #endif #endif