git: 60bc195745b8 - main - tcp bblog: cleanup

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Fri, 05 Apr 2024 15:41:00 UTC
The branch main has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=60bc195745b8c1e1896c535a491906cdf11fe057

commit 60bc195745b8c1e1896c535a491906cdf11fe057
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-04-05 15:36:40 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-04-05 15:36:40 +0000

    tcp bblog: cleanup
    
    Remove redundant checks and improve error checking.
    
    Reported by:            Coverity Scan
    CID:                    1523780
    Reviewed by:            rscheff
    MFC after:              3 days
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D44616
---
 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 2e91d9cbdf3c..38f66e69b093 100644
--- a/sys/netinet/tcp_log_buf.h
+++ b/sys/netinet/tcp_log_buf.h
@@ -421,7 +421,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
@@ -431,11 +431,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;
 	}
 }