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/48b25793a34e
branches:  trunk
changeset: 1021613:48b25793a34e
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 94d837867b45 -r 48b25793a34e 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