NetBSD-Bugs archive

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

bin/51941: pfil_{add,remove}_ihook, pfil_run_{addr,if}hooks are not exist in pfil.9



>Number:         51941
>Category:       bin
>Synopsis:       pfil_{add,remove}_ihook, pfil_run_{addr,if}hooks are not exist in pfil.9
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 03 07:10:00 +0000 2017
>Originator:     Ryo Shimizu
>Release:        NetBSD 7.99.59
>Organization:
>Environment:
System: NetBSD n 7.99.59 NetBSD 7.99.59 (GENERIC-PF) #5: Wed Feb  1 20:30:04 JST 2017  ryo@n:/usr/src/sys/arch/amd64/compile/GENERIC-PF amd64
Architecture: x86_64
Machine: amd64
>Description:
Descriptions for pfil_{add,remove}_ihook, pfil_run_{addr,if}hooks are not exist in pfil.9
>How-To-Repeat:
>Fix:
Apply this patch.
but my english is poor, please correct appropriately.

diff --git a/distrib/sets/lists/comp/mi b/distrib/sets/lists/comp/mi
index 0af2a62..f49a489 100644
--- a/distrib/sets/lists/comp/mi
+++ b/distrib/sets/lists/comp/mi
@@ -10799,13 +10799,17 @@
 ./usr/share/man/cat9/percpu_putref.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/pfil.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/pfil_add_hook.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pfil_add_ihook.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/pfil_get_head.0		comp-obsolete		obsolete
 ./usr/share/man/cat9/pfil_head_get.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/pfil_head_register.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/pfil_head_unregister.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/pfil_hook_get.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/pfil_remove_hook.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pfil_remove_ihook.0	comp-sys-catman		.cat
+./usr/share/man/cat9/pfil_run_addrhooks.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/pfil_run_hooks.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pfil_run_ifhooks.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/pfind.0			comp-obsolete		obsolete
 ./usr/share/man/cat9/pg_find.0			comp-obsolete		obsolete
 ./usr/share/man/cat9/pgfind.0			comp-obsolete		obsolete
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index 719a315..d9bbe36 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -641,10 +641,14 @@ MLINKS+=percpu.9 percpu_alloc.9 \
 MLINKS+=pfil.9 pfil_hook_get.9 \
 	pfil.9 pfil_add_hook.9 \
 	pfil.9 pfil_remove_hook.9 \
+	pfil.9 pfil_add_ihook.9 \
+	pfil.9 pfil_remove_ihook.9 \
 	pfil.9 pfil_head_register.9 \
 	pfil.9 pfil_head_unregister.9 \
 	pfil.9 pfil_head_get.9 \
-	pfil.9 pfil_run_hooks.9
+	pfil.9 pfil_run_hooks.9 \
+	pfil.9 pfil_run_addrhooks.9 \
+	pfil.9 pfil_run_ifhooks.9
 MLINKS+=pmap.9 pmap_init.9 \
 	pmap.9 pmap_virtual_space.9 \
 	pmap.9 pmap_steal_memory.9 \
diff --git a/share/man/man9/pfil.9 b/share/man/man9/pfil.9
index b823f03..a39ac60 100644
--- a/share/man/man9/pfil.9
+++ b/share/man/man9/pfil.9
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd June 1, 2016
+.Dd February 3, 2017
 .Dt PFIL 9
 .Os
 .Sh NAME
@@ -35,7 +35,11 @@
 .Nm pfil_hook_get ,
 .Nm pfil_add_hook ,
 .Nm pfil_remove_hook ,
-.Nm pfil_run_hooks
+.Nm pfil_run_hooks ,
+.Nm pfil_add_ihook ,
+.Nm pfil_remove_ihook ,
+.Nm pfil_run_addrhooks ,
+.Nm pfil_run_ifhooks
 .Nd packet filter interface
 .Sh SYNOPSIS
 .In sys/param.h
@@ -58,6 +62,16 @@
 .Fn (*func) "void *arg" "struct mbuf **mp" "struct ifnet *" "int dir"
 .Ft int
 .Fn pfil_run_hooks "struct pfil_head *ph" "struct mbuf **mp" "struct ifnet *ifp" "int dir"
+.Ft int
+.Fn pfil_add_ihook "void (*ifunc)()" "void *arg" "int flags" "struct pfil_head *ph"
+.Ft int
+.Fn pfil_remove_ihook "void (*ifunc)()" "void *arg" "int flags" "struct pfil_head *ph"
+.Ft void
+.Fn (*ifunc) "void *arg" "unsigned long cmd" "void *ptr"
+.Ft void
+.Fn pfil_run_addrhooks "struct pfil_head *ph" "unsigned long" "struct ifaddr *ifa"
+.Ft void
+.Fn pfil_run_ifhooks "struct pfil_head *ph" "unsigned long" "struct ifnet *ifp"
 .Sh DESCRIPTION
 The
 .Nm
@@ -120,22 +134,45 @@ and
 .Fn pfil_remove_hook
 functions, indicates when the filter should be called.
 The flags are:
-.Bl -tag -offset indent -width PFIL_WAITOK -compact
+.Bl -tag -offset indent -width PFIL_ALL -compact
 .It PFIL_IN
 call me on incoming packets
 .It PFIL_OUT
 call me on outgoing packets
 .It PFIL_ALL
 call me on all of the above
+.Pp
+.El
+.Pp
+By the same token, Event handlers register/unregister themselves
+with the
+.Fn pfil_add_ihook
+and
+.Fn pfil_remove_ihook
+functions, respectively.
+The event handler is called with its specified argument, the event id
+.Dv ( PFIL_IFNET_ATTACH
+or
+.Dv PFIL_IFNET_DETACH ,
+see also below) or ioctl number, and the pointer
+to the network interface or the pointer to the ifaddr.
+.Pp
+The
+.Em flags
+parameter, used in the
+.Fn pfil_add_ihook
+and
+.Fn pfil_remove_ihook
+functions, indicates when the filter should be called.
+The flags are:
+.Bl -tag -offset indent -width PFIL_IFADDR -compact
 .It PFIL_IFADDR
-call me on interface reconfig (mbuf ** is ioctl #)
+call me on interface reconfig (cmd is ioctl #)
 .It PFIL_IFNET
-call me on interface attach/detach (mbuf ** is either
+call me on interface attach/detach (cmd is either
 .Dv PFIL_IFNET_ATTACH
 or
 .Dv PFIL_IFNET_DETACH )
-.It PFIL_WAITOK
-OK to call malloc with M_WAITOK.
 .El
 .Sh SEE ALSO
 .Xr bpf 4
@@ -171,6 +208,12 @@ In 1.5K, the
 .Nm
 framework was changed to work with an arbitrary number of filtering points,
 as well as be less IP-centric.
+.Pp
+In 8.0,
+.Fn pfil_add_ihook
+and
+.Fn pfil_remove_ihook
+were added.
 .Sh AUTHORS
 .An -nosplit
 The



Home | Main Index | Thread Index | Old Index