Module Name: src Committed By: martin Date: Wed Jun 9 15:38:40 UTC 2021
Modified Files: src/sys/net: bpf.h Log Message: Add a (FreeBSD compatible) bpf_peers_present() predicate to allow testing for active listeners on a tap. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/sys/net/bpf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/bpf.h diff -u src/sys/net/bpf.h:1.75 src/sys/net/bpf.h:1.76 --- src/sys/net/bpf.h:1.75 Thu Jun 11 13:36:20 2020 +++ src/sys/net/bpf.h Wed Jun 9 15:38:39 2021 @@ -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_change_type(struct ifnet *_ifp, u_in 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) {