git: d27149888c39 - stable/13 - bpf: Make bpf_peers_present a boolean inline function

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Mon, 17 Jun 2024 04:28:01 UTC
The branch stable/13 has been updated by zlei:

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

commit d27149888c39fbf9a7cc174af50888cce0ca297d
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2024-06-07 15:06:08 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-06-17 04:10:23 +0000

    bpf: Make bpf_peers_present a boolean inline function
    
    This function was introduced in commit [1] and is actually used as a
    boolean function although it was not defined as so.
    
    No functional change intended.
    
    1. 16d878cc99ef Fix the following bpf(4) race condition which can result in a panic
    
    Reviewed by:    markj, kp, #network
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D45509
    
    (cherry picked from commit 0dfd11abc4bd0dcb96a6d287cc4e52e8f59b64c1)
    (cherry picked from commit 6ad2e347fcf8fa6aa9ebd84cfa4c71a1af90b4dd)
---
 sys/net/bpf.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sys/net/bpf.h b/sys/net/bpf.h
index 88331c2f663a..347b764735d0 100644
--- a/sys/net/bpf.h
+++ b/sys/net/bpf.h
@@ -431,15 +431,13 @@ int	 bpf_get_bp_params(struct bpf_if *, u_int *, u_int *);
 void	 bpfilterattach(int);
 u_int	 bpf_filter(const struct bpf_insn *, u_char *, u_int, u_int);
 
-static __inline int
+static __inline bool
 bpf_peers_present(struct bpf_if *bpf)
 {
 	struct bpf_if_ext *ext;
 
 	ext = (struct bpf_if_ext *)bpf;
-	if (!CK_LIST_EMPTY(&ext->bif_dlist))
-		return (1);
-	return (0);
+	return (!CK_LIST_EMPTY(&ext->bif_dlist));
 }
 
 #define	BPF_TAP(_ifp,_pkt,_pktlen) do {				\