From nobody Wed Feb 01 22:47:11 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P6cVl42bRz3cFJM; Wed, 1 Feb 2023 22:47:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P6cVl3qWzz4PBd; Wed, 1 Feb 2023 22:47:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675291631; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Wj+njOQS5wPfN1QN+z78WG30mtXNNKi2XfbFj89n2MI=; b=mVr9c0UEG1rnouQ8Lmq+1vTWaEeY7SkXxIMcoiMtWjj0XDM47q5ZUv4sAEnKWrVA5nPz4r VN2muXejt4iYHzEfk7ImvTEoJ8LGb6WjpOnY//2nD3JffZtQGFL/11NxWyS1AwkqMtBKLe MqwjNVQJYe/HebfYXtYaAGgHUrKiHRoN9BCaU0fGULyHXwZi9iFhjDknWQhbxVLG+u4p4D PMHFUYl8eKydxmKYlvY4eL2vu5f3OMhJ29GQ/5Ue98jUkDdCbpEwJILlWTumRyzuEwg1Lm npkMzFRPhIdevPUhf3VlQafYczKhsECuSBqWt1Fc/WcsPE4CQa2BtvPRQsuokA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675291631; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Wj+njOQS5wPfN1QN+z78WG30mtXNNKi2XfbFj89n2MI=; b=d0oU525NnYv+ubI6sG2KSIF4wcuK/DWh50Nvhj2P5uyYIi5vcCriToYlmtevyk2y72mpT1 GXsGuGPonvJKEYcm+3r0Ba/KqxmyP09U+MgCnSLxBC2L32hcBpRvZUHGb4JyGJf0kyUUwD HSNsfijTmijb3wbklqIj7xY3xIk9Hc/2l3neG9QNeC76NAMNBAVKSQbNpa813bAJKBXxTW /Ult9pk2JNH4cB99aI27yCPRtAiGl+AGfKdDDJG/fRkmS1tOF1UCFJXXWKtRrPI21qmaRs 3lF7zAwRHqfAPzYn0Y9IXVfe0HUbp4dllzDzfhmZPYvBweDQg1MH97+i5mO8og== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675291631; a=rsa-sha256; cv=none; b=QVTJqy1JLl6qsk9d69Eid1RLLxvGSk7olbUEXxborarVXx3KLETHaRmMDstUxQJur5R2q+ F+pjjsWQunXsCPngfa7pTJrWF1SszqZl6CeA8Xp7LR2r9GKZDN7duoh7EG5sQ0VEudBWzT CCFqyXURLmNvYrC50itV+RKJZH+Rx3GAb35/uuktI3md1XklnAGr4yHWrIQYUvOc+OXzMm d6hu9f3SOEVn7EeUqx93OcPEGFeRt9h9RMqRhkzaOt2Fv1crklCO8Sjz1VDNjjvr0N5/6A ih0BZ5jx3xc5xmy6HhBGLtEmnPOycHXuMjh+iQKiYNBL6XZcPUaPKF/WWt+CNQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4P6cVl2ZMHzWTF; Wed, 1 Feb 2023 22:47:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 311MlBKh003038; Wed, 1 Feb 2023 22:47:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 311MlBHj003037; Wed, 1 Feb 2023 22:47:11 GMT (envelope-from git) Date: Wed, 1 Feb 2023 22:47:11 GMT Message-Id: <202302012247.311MlBHj003037@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 80972c67922a - stable/13 - sctp: improve consistency List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 80972c67922a74bfd67e036629236004e905fbc9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=80972c67922a74bfd67e036629236004e905fbc9 commit 80972c67922a74bfd67e036629236004e905fbc9 Author: Michael Tuexen AuthorDate: 2022-05-14 04:28:19 +0000 Commit: Michael Tuexen CommitDate: 2023-02-01 22:46:49 +0000 sctp: improve consistency No functional change intended. (cherry picked from commit 9b2a35b3a96b44019d7884da9de92c4f92d64994) --- sys/netinet/sctp_asconf.c | 4 ++-- sys/netinet/sctp_indata.c | 4 ++-- sys/netinet/sctp_input.c | 16 ++++++++-------- sys/netinet/sctp_output.c | 9 ++++----- sys/netinet/sctp_pcb.c | 8 ++++---- sys/netinet/sctp_timer.c | 36 ++++++++++++++++-------------------- sys/netinet/sctp_usrreq.c | 18 ++++++++---------- sys/netinet/sctputil.c | 12 ++++++------ 8 files changed, 50 insertions(+), 57 deletions(-) diff --git a/sys/netinet/sctp_asconf.c b/sys/netinet/sctp_asconf.c index 675530c65fb6..129ef30b3882 100644 --- a/sys/netinet/sctp_asconf.c +++ b/sys/netinet/sctp_asconf.c @@ -541,8 +541,8 @@ sctp_process_asconf_set_primary(struct sockaddr *src, /* notify upper layer */ sctp_ulp_notify(SCTP_NOTIFY_ASCONF_SET_PRIMARY, stcb, 0, sa, SCTP_SO_NOT_LOCKED); if ((stcb->asoc.primary_destination->dest_state & SCTP_ADDR_REACHABLE) && - (!(stcb->asoc.primary_destination->dest_state & SCTP_ADDR_PF)) && - (stcb->asoc.alternate)) { + ((stcb->asoc.primary_destination->dest_state & SCTP_ADDR_PF) == 0) && + (stcb->asoc.alternate != NULL)) { sctp_free_remote_addr(stcb->asoc.alternate); stcb->asoc.alternate = NULL; } diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c index c4620b7cfa0d..9cbbf69d2421 100644 --- a/sys/netinet/sctp_indata.c +++ b/sys/netinet/sctp_indata.c @@ -4162,7 +4162,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack, * count, this is optional. */ net->error_count = 0; - if (!(net->dest_state & SCTP_ADDR_REACHABLE)) { + if ((net->dest_state & SCTP_ADDR_REACHABLE) == 0) { /* addr came good */ net->dest_state |= SCTP_ADDR_REACHABLE; sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, @@ -4905,7 +4905,7 @@ hopeless_peer: * count, this is optional. */ net->error_count = 0; - if (!(net->dest_state & SCTP_ADDR_REACHABLE)) { + if ((net->dest_state & SCTP_ADDR_REACHABLE) == 0) { /* addr came good */ net->dest_state |= SCTP_ADDR_REACHABLE; sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index eb4ad6de12f1..6c9720a974ad 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -620,7 +620,7 @@ sctp_handle_heartbeat_ack(struct sctp_heartbeat_chunk *cp, /* Now lets do a RTO with this */ sctp_calculate_rto(stcb, &stcb->asoc, r_net, &tv, SCTP_RTT_FROM_NON_DATA); - if (!(r_net->dest_state & SCTP_ADDR_REACHABLE)) { + if ((r_net->dest_state & SCTP_ADDR_REACHABLE) == 0) { r_net->dest_state |= SCTP_ADDR_REACHABLE; sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, (void *)r_net, SCTP_SO_NOT_LOCKED); @@ -2235,7 +2235,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(tag, SCTP_BASE_INFO(hashasocmark))]; LIST_FOREACH(stcb, head, sctp_asocs) { - if ((stcb->asoc.my_vtag == tag) && (stcb->rport == rport) && (inp == stcb->sctp_ep)) { + if ((stcb->asoc.my_vtag == tag) && (stcb->rport == rport) && (inp == stcb->sctp_ep)) { -- SEND ABORT - TRY AGAIN -- } } @@ -3616,7 +3616,7 @@ sctp_handle_str_reset_request_in(struct sctp_tcb *stcb, seq = ntohl(req->request_seq); if (asoc->str_reset_seq_in == seq) { asoc->last_reset_action[1] = asoc->last_reset_action[0]; - if (!(asoc->local_strreset_support & SCTP_ENABLE_RESET_STREAM_REQ)) { + if ((asoc->local_strreset_support & SCTP_ENABLE_RESET_STREAM_REQ) == 0) { asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; } else if (trunc) { /* Can't do it, since they exceeded our buffer size */ @@ -3682,7 +3682,7 @@ sctp_handle_str_reset_request_tsn(struct sctp_tcb *stcb, seq = ntohl(req->request_seq); if (asoc->str_reset_seq_in == seq) { asoc->last_reset_action[1] = stcb->asoc.last_reset_action[0]; - if (!(asoc->local_strreset_support & SCTP_ENABLE_CHANGE_ASSOC_REQ)) { + if ((asoc->local_strreset_support & SCTP_ENABLE_CHANGE_ASSOC_REQ) == 0) { asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; } else { fwdtsn.ch.chunk_length = htons(sizeof(struct sctp_forward_tsn_chunk)); @@ -3754,7 +3754,7 @@ sctp_handle_str_reset_request_out(struct sctp_tcb *stcb, /* move the reset action back one */ asoc->last_reset_action[1] = asoc->last_reset_action[0]; - if (!(asoc->local_strreset_support & SCTP_ENABLE_RESET_STREAM_REQ)) { + if ((asoc->local_strreset_support & SCTP_ENABLE_RESET_STREAM_REQ) == 0) { asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; } else if (trunc) { asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; @@ -3825,7 +3825,7 @@ sctp_handle_str_reset_add_strm(struct sctp_tcb *stcb, struct sctp_tmit_chunk *ch if (asoc->str_reset_seq_in == seq) { num_stream += stcb->asoc.streamincnt; stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; - if (!(asoc->local_strreset_support & SCTP_ENABLE_CHANGE_ASSOC_REQ)) { + if ((asoc->local_strreset_support & SCTP_ENABLE_CHANGE_ASSOC_REQ) == 0) { asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; } else if ((num_stream > stcb->asoc.max_inbound_streams) || (num_stream > 0xffff)) { @@ -3915,7 +3915,7 @@ sctp_handle_str_reset_add_out_strm(struct sctp_tcb *stcb, struct sctp_tmit_chunk /* Now what would be the new total? */ if (asoc->str_reset_seq_in == seq) { stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; - if (!(asoc->local_strreset_support & SCTP_ENABLE_CHANGE_ASSOC_REQ)) { + if ((asoc->local_strreset_support & SCTP_ENABLE_CHANGE_ASSOC_REQ) == 0) { asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; } else if (stcb->asoc.stream_reset_outstanding) { /* We must reject it we have something pending */ @@ -4882,7 +4882,7 @@ process_control_chunks: */ if ((stcb == NULL) && (!SCTP_IS_LISTENING(inp) || - (!(inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) && + (((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) == 0) && inp->sctp_socket->sol_qlen >= inp->sctp_socket->sol_qlimit))) { if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && (SCTP_BASE_SYSCTL(sctp_abort_if_one_2_one_hits_limit))) { diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 63310a6cc48b..306755d659eb 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -2844,8 +2844,7 @@ sctp_select_nth_preferred_addr_from_ifn_boundall(struct sctp_ifn *ifn, #ifdef INET6 if (stcb && fam == AF_INET6 && sctp_is_mobility_feature_on(stcb->sctp_ep, SCTP_MOBILITY_BASE)) { - if (sctp_v6src_match_nexthop(&sifa->address.sin6, ro) - == 0) { + if (sctp_v6src_match_nexthop(&sifa->address.sin6, ro) == 0) { continue; } } @@ -7869,7 +7868,7 @@ nothing_to_send: net->window_probe = 0; if ((net != stcb->asoc.alternate) && ((net->dest_state & SCTP_ADDR_PF) || - (!(net->dest_state & SCTP_ADDR_REACHABLE)) || + ((net->dest_state & SCTP_ADDR_REACHABLE) == 0) || (net->dest_state & SCTP_ADDR_UNCONFIRMED))) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) { sctp_log_cwnd(stcb, net, 1, @@ -10033,7 +10032,7 @@ do_it_again: #endif /* Check for bad destinations, if they exist move chunks around. */ TAILQ_FOREACH(net, &asoc->nets, sctp_next) { - if (!(net->dest_state & SCTP_ADDR_REACHABLE)) { + if ((net->dest_state & SCTP_ADDR_REACHABLE) == 0) { /*- * if possible move things off of this address we * still may send below due to the dormant state but @@ -10494,7 +10493,7 @@ sctp_send_sack(struct sctp_tcb *stcb, int so_locked) a_chk->sent = SCTP_DATAGRAM_UNSENT; a_chk->whoTo = NULL; - if (!(asoc->last_data_chunk_from->dest_state & SCTP_ADDR_REACHABLE)) { + if ((asoc->last_data_chunk_from->dest_state & SCTP_ADDR_REACHABLE) == 0) { /*- * Ok, the destination for the SACK is unreachable, lets see if * we can select an alternate to asoc->last_data_chunk_from diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index ee1ff6bd56d9..be41276351fe 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -3504,8 +3504,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) } } inp->sctp_socket = NULL; - if ((inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) != - SCTP_PCB_FLAGS_UNBOUND) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) == 0) { /* * ok, this guy has been bound. It's port is somewhere in * the SCTP_BASE_INFO(hash table). Remove it! @@ -4265,7 +4264,7 @@ sctp_aloc_assoc_locked(struct sctp_inpcb *inp, struct sockaddr *firstaddr, (sin->sin_addr.s_addr == INADDR_ANY) || (sin->sin_addr.s_addr == INADDR_BROADCAST) || IN_MULTICAST(ntohl(sin->sin_addr.s_addr)) || - (((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) != 0) && + ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) && (SCTP_IPV6_V6ONLY(inp) != 0))) { /* Invalid address */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); @@ -6687,7 +6686,8 @@ sctp_set_primary_addr(struct sctp_tcb *stcb, struct sockaddr *sa, return (0); } stcb->asoc.primary_destination = net; - if (!(net->dest_state & SCTP_ADDR_PF) && (stcb->asoc.alternate)) { + if (((net->dest_state & SCTP_ADDR_PF) == 0) && + (stcb->asoc.alternate != NULL)) { sctp_free_remote_addr(stcb->asoc.alternate); stcb->asoc.alternate = NULL; } diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index 8a7d9be866f8..baaed2c78fb1 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -107,7 +107,7 @@ sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } } else if ((net->pf_threshold < net->failure_threshold) && (net->error_count > net->pf_threshold)) { - if (!(net->dest_state & SCTP_ADDR_PF)) { + if ((net->dest_state & SCTP_ADDR_PF) == 0) { net->dest_state |= SCTP_ADDR_PF; net->last_active = sctp_get_tick_count(); sctp_send_hb(stcb, net, SCTP_SO_NOT_LOCKED); @@ -355,7 +355,7 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, } if (((alt->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE) && (alt->ro.ro_nh != NULL) && - (!(alt->dest_state & SCTP_ADDR_UNCONFIRMED)) && + ((alt->dest_state & SCTP_ADDR_UNCONFIRMED) == 0) && (alt != net)) { /* Found an alternate net, which is reachable. */ break; @@ -385,7 +385,7 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, break; } } - if ((!(alt->dest_state & SCTP_ADDR_UNCONFIRMED)) && + if (((alt->dest_state & SCTP_ADDR_UNCONFIRMED) == 0) && (alt != net)) { /* * Found an alternate net, which is @@ -933,7 +933,7 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, /* Backoff the timer and cwnd */ sctp_backoff_on_timeout(stcb, net, win_probe, num_mk, num_abandoned); - if ((!(net->dest_state & SCTP_ADDR_REACHABLE)) || + if (((net->dest_state & SCTP_ADDR_REACHABLE) == 0) || (net->dest_state & SCTP_ADDR_PF)) { /* Move all pending over too */ sctp_move_chunks_from_net(stcb, net); @@ -942,7 +942,7 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, * Get the address that failed, to force a new src address * selection and a route allocation. */ - if (net->ro._s_addr) { + if (net->ro._s_addr != NULL) { sctp_free_ifa(net->ro._s_addr); net->ro._s_addr = NULL; } @@ -960,7 +960,7 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, * change-primary then this flag must be cleared * from any net structures. */ - if (stcb->asoc.alternate) { + if (stcb->asoc.alternate != NULL) { sctp_free_remote_addr(stcb->asoc.alternate); } stcb->asoc.alternate = alt; @@ -1159,7 +1159,7 @@ sctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb) atomic_add_int(&alt->ref_count, 1); } } - if (!(net->dest_state & SCTP_ADDR_REACHABLE)) { + if ((net->dest_state & SCTP_ADDR_REACHABLE) == 0) { /* * If the address went un-reachable, we need to move to * alternates for ALL chk's in queue @@ -1255,7 +1255,7 @@ sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb, chk->sent = SCTP_DATAGRAM_RESEND; chk->flags |= CHUNK_FLAGS_FRAGMENT_OK; } - if (!(net->dest_state & SCTP_ADDR_REACHABLE)) { + if ((net->dest_state & SCTP_ADDR_REACHABLE) == 0) { /* * If the address went un-reachable, we need to move * to the alternate for ALL chunks in queue @@ -1413,15 +1413,11 @@ int sctp_heartbeat_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets *net) { - uint8_t net_was_pf; + bool net_was_pf; - if (net->dest_state & SCTP_ADDR_PF) { - net_was_pf = 1; - } else { - net_was_pf = 0; - } + net_was_pf = (net->dest_state & SCTP_ADDR_PF) != 0; if (net->hb_responded == 0) { - if (net->ro._s_addr) { + if (net->ro._s_addr != NULL) { /* * Invalidate the src address if we did not get a * response last time. @@ -1437,7 +1433,7 @@ sctp_heartbeat_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } } /* Zero PBA, if it needs it */ - if (net->partial_bytes_acked) { + if (net->partial_bytes_acked > 0) { net->partial_bytes_acked = 0; } if ((stcb->asoc.total_output_queue_size > 0) && @@ -1445,11 +1441,11 @@ sctp_heartbeat_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb, (TAILQ_EMPTY(&stcb->asoc.sent_queue))) { sctp_audit_stream_queues_for_size(inp, stcb); } - if (!(net->dest_state & SCTP_ADDR_NOHB) && - !((net_was_pf == 0) && (net->dest_state & SCTP_ADDR_PF))) { + if (((net->dest_state & SCTP_ADDR_NOHB) == 0) && + (net_was_pf || ((net->dest_state & SCTP_ADDR_PF) == 0))) { /* - * when move to PF during threshold management, a HB has - * been queued in that routine + * When moving to PF during threshold management, a HB has + * been queued in that routine. */ uint32_t ms_gone_by; diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 89ff532bcbec..0a7d28d978f0 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -1420,8 +1420,7 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb *inp, void *optval, } } #endif /* INET6 */ - if ((inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) == - SCTP_PCB_FLAGS_UNBOUND) { + if (inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) { /* Bind a ephemeral port */ error = sctp_inpcb_bind(so, NULL, NULL, p); if (error) { @@ -5325,8 +5324,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, if (net != NULL) { /************************NET SPECIFIC SET ******************/ if (paddrp->spp_flags & SPP_HB_DISABLE) { - if (!(net->dest_state & SCTP_ADDR_UNCONFIRMED) && - !(net->dest_state & SCTP_ADDR_NOHB)) { + if (((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0) && + ((net->dest_state & SCTP_ADDR_NOHB) == 0)) { sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net, SCTP_FROM_SCTP_USRREQ + SCTP_LOC_9); } @@ -5482,9 +5481,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, } if (paddrp->spp_flags & SPP_HB_DISABLE) { TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { - if (!(net->dest_state & SCTP_ADDR_NOHB)) { + if ((net->dest_state & SCTP_ADDR_NOHB) == 0) { net->dest_state |= SCTP_ADDR_NOHB; - if (!(net->dest_state & SCTP_ADDR_UNCONFIRMED)) { + if ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0) { sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net, SCTP_FROM_SCTP_USRREQ + SCTP_LOC_15); @@ -5798,11 +5797,11 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, if ((stcb != NULL) && (net != NULL)) { if (net != stcb->asoc.primary_destination) { - if (!(net->dest_state & SCTP_ADDR_UNCONFIRMED)) { + if ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0) { /* Ok we need to set it */ if (sctp_set_primary_addr(stcb, (struct sockaddr *)NULL, net) == 0) { if ((stcb->asoc.alternate) && - (!(net->dest_state & SCTP_ADDR_PF)) && + ((net->dest_state & SCTP_ADDR_PF) == 0) && (net->dest_state & SCTP_ADDR_REACHABLE)) { sctp_free_remote_addr(stcb->asoc.alternate); stcb->asoc.alternate = NULL; @@ -7013,8 +7012,7 @@ sctp_connect(struct socket *so, struct sockaddr *addr, struct thread *p) goto out_now; } #endif - if ((inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) == - SCTP_PCB_FLAGS_UNBOUND) { + if (inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) { /* Bind a ephemeral port */ error = sctp_inpcb_bind(so, NULL, NULL, p); if (error) { diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index dad937f15172..29d8c6a5e964 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1911,7 +1911,7 @@ sctp_timeout_handler(void *t) #ifdef SCTP_AUDITING_ENABLED sctp_auditing(4, inp, stcb, net); #endif - if (!(net->dest_state & SCTP_ADDR_NOHB)) { + if ((net->dest_state & SCTP_ADDR_NOHB) == 0) { sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net); sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_HB_TMR, SCTP_SO_NOT_LOCKED); did_output = true; @@ -2278,7 +2278,7 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb, #endif } if ((net->dest_state & SCTP_ADDR_NOHB) && - !(net->dest_state & SCTP_ADDR_UNCONFIRMED)) { + ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0)) { SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type %d not started: inp=%p, stcb=%p, net=%p.\n", t_type, inp, stcb, net); @@ -2300,8 +2300,8 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb, } else { to_ticks = UINT32_MAX; } - if (!(net->dest_state & SCTP_ADDR_UNCONFIRMED) && - !(net->dest_state & SCTP_ADDR_PF)) { + if (((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0) && + ((net->dest_state & SCTP_ADDR_PF) == 0)) { if (net->heart_beat_delay < (UINT32_MAX - to_ticks)) { to_ticks += net->heart_beat_delay; } else { @@ -4887,7 +4887,7 @@ sctp_add_to_readq(struct sctp_inpcb *inp, } return; } - if (!(control->spec_flags & M_NOTIFICATION)) { + if ((control->spec_flags & M_NOTIFICATION) == 0) { atomic_add_int(&inp->total_recvs, 1); if (!control->do_not_ref_stcb) { atomic_add_int(&stcb->total_recvs, 1); @@ -5054,7 +5054,7 @@ sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1, sid = tp1->rec.data.sid; mid = tp1->rec.data.mid; - if (sent || !(tp1->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG)) { + if (sent || ((tp1->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) == 0)) { stcb->asoc.abandoned_sent[0]++; stcb->asoc.abandoned_sent[PR_SCTP_POLICY(tp1->flags)]++; stcb->asoc.strmout[sid].abandoned_sent[0]++;