git: 6572d12cfc67 - stable/14 - tcp bblog: cleanup

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Wed, 17 Apr 2024 13:55:56 UTC
The branch stable/14 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=6572d12cfc67632127576c9e4ce16d7d433f122d

commit 6572d12cfc67632127576c9e4ce16d7d433f122d
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-04-05 15:36:40 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-04-17 13:55:27 +0000

    tcp bblog: cleanup
    
    Remove redundant checks and improve error checking.
    
    Reported by:            Coverity Scan
    CID:                    1523780
    Reviewed by:            rscheff
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D44616
    
    (cherry picked from commit 60bc195745b8c1e1896c535a491906cdf11fe057)
---
 sys/netinet/tcp_log_buf.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sys/netinet/tcp_log_buf.h b/sys/netinet/tcp_log_buf.h
index 1f5b7cf9b54f..79f96bab1345 100644
--- a/sys/netinet/tcp_log_buf.h
+++ b/sys/netinet/tcp_log_buf.h
@@ -418,7 +418,7 @@ static inline void
 tcp_set_bblog_state(struct tcpcb *tp, uint8_t ls, uint8_t bbpoint)
 {
 	if ((ls == TCP_LOG_VIA_BBPOINTS) &&
-	    (tp->_t_logstate <= TCP_LOG_STATE_OFF)){
+	    (tp->_t_logstate == TCP_LOG_STATE_OFF)){
 		/*
 		 * We don't allow a BBPOINTS set to override
 		 * other types of BB logging set by other means such
@@ -428,11 +428,9 @@ tcp_set_bblog_state(struct tcpcb *tp, uint8_t ls, uint8_t bbpoint)
 		 */
 		tp->_t_logpoint = bbpoint;
 		tp->_t_logstate = ls;
-	} else if (ls != TCP_LOG_VIA_BBPOINTS) {
-		tp->_t_logpoint = 0;
-		if ((ls >= TCP_LOG_STATE_OFF) &&
-		    (ls < TCP_LOG_VIA_BBPOINTS))
-			tp->_t_logstate = ls;
+	} else if (ls < TCP_LOG_VIA_BBPOINTS) {
+		tp->_t_logpoint = TCP_BBPOINT_NONE;
+		tp->_t_logstate = ls;
 	}
 }