Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Add a (FreeBSD compatible) bpf_peers_present() predi...



details:   https://anonhg.NetBSD.org/src/rev/a21b92282aff
branches:  trunk
changeset: 983823:a21b92282aff
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Jun 09 15:38:39 2021 +0000

description:
Add a (FreeBSD compatible) bpf_peers_present() predicate to allow
testing for active listeners on a tap.

diffstat:

 sys/net/bpf.h |  12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diffs (26 lines):

diff -r 2dcbd4d9be6b -r a21b92282aff sys/net/bpf.h
--- a/sys/net/bpf.h     Wed Jun 09 15:15:35 2021 +0000
+++ b/sys/net/bpf.h     Wed Jun 09 15:38:39 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bpf.h,v 1.75 2020/06/11 13:36:20 roy Exp $     */
+/*     $NetBSD: bpf.h,v 1.76 2021/06/09 15:38:39 martin Exp $  */
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -501,6 +501,16 @@
        bpf_ops->bpf_change_type(_ifp, _dlt, _hdrlen);
 }
 
+static __inline bool
+bpf_peers_present(struct bpf_if *dp)
+{
+       /*
+        * Our code makes sure the driver visible pointer is NULL
+        * whenever there is no listener on this tap.
+        */
+       return dp != NULL;
+}
+
 static __inline void
 bpf_detach(struct ifnet *_ifp)
 {



Home | Main Index | Thread Index | Old Index