Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 May 2009 17:18:40 +0000 (UTC)
From:      Sam Leffler <sam@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192313 - in head/sys: net sys
Message-ID:  <200905181718.n4IHIeFN068630@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sam
Date: Mon May 18 17:18:40 2009
New Revision: 192313
URL: http://svn.freebsd.org/changeset/base/192313

Log:
  add bpf_track eventhandler for monitoring bpf taps attached/detached
  
  Reviewed by:	csjp

Modified:
  head/sys/net/bpf.c
  head/sys/sys/eventhandler.h

Modified: head/sys/net/bpf.c
==============================================================================
--- head/sys/net/bpf.c	Mon May 18 17:14:48 2009	(r192312)
+++ head/sys/net/bpf.c	Mon May 18 17:18:40 2009	(r192313)
@@ -534,6 +534,8 @@ bpf_attachd(struct bpf_d *d, struct bpf_
 
 	bpf_bpfd_cnt++;
 	BPFIF_UNLOCK(bp);
+
+	EVENTHANDLER_INVOKE(bpf_track, bp->bif_ifp, 1);
 }
 
 /*
@@ -561,6 +563,8 @@ bpf_detachd(struct bpf_d *d)
 	BPFD_UNLOCK(d);
 	BPFIF_UNLOCK(bp);
 
+	EVENTHANDLER_INVOKE(bpf_track, ifp, 0);
+
 	/*
 	 * Check if this descriptor had requested promiscuous mode.
 	 * If so, turn it off.

Modified: head/sys/sys/eventhandler.h
==============================================================================
--- head/sys/sys/eventhandler.h	Mon May 18 17:14:48 2009	(r192312)
+++ head/sys/sys/eventhandler.h	Mon May 18 17:18:40 2009	(r192313)
@@ -182,6 +182,11 @@ typedef void (*vlan_unconfig_fn)(void *,
 EVENTHANDLER_DECLARE(vlan_config, vlan_config_fn);
 EVENTHANDLER_DECLARE(vlan_unconfig, vlan_unconfig_fn);
 
+/* BPF attach/detach events */
+struct ifnet;
+typedef void (*bpf_track_fn)(void *, struct ifnet *, int /* 1 =>'s attach */);
+EVENTHANDLER_DECLARE(bpf_track, bpf_track_fn);
+
 /*
  * Process events
  * process_fork and exit handlers are called without Giant.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905181718.n4IHIeFN068630>