Module Name: src Committed By: martin Date: Thu Jul 13 09:07:37 UTC 2023
Modified Files: src/distrib/sets/lists/man [netbsd-10]: mi src/share/man/man4 [netbsd-10]: Makefile Added Files: src/share/man/man4 [netbsd-10]: npflog.4 Log Message: Pull up following revision(s) (requested by gutteridge in ticket #230): share/man/man4/npflog.4: revision 1.1 share/man/man4/npflog.4: revision 1.2 share/man/man4/Makefile: revision 1.732 distrib/sets/lists/man/mi: revision 1.1762 npflog.4: add a man page for the npflog device Addresses PR misc/57441 from Taylor R Campbell. (Not yet hooked into source sets, will be done separately.) (Borrows heavily from the equivalent pflog.4 man page already in tree, and so retains the original copyright attribution as well.) npflog.4: add and adjust some details Add details about the header structure (though the if_npflog.h file is not presently installed and has a _KERNEL guard). Also adjust some sentences (requested by riastradh@), and include the original OpenBSD RCS ID, since much of this content shares that origin. Add npflog.4 to sets To generate a diff of this commit: cvs rdiff -u -r1.1757 -r1.1757.2.1 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.730 -r1.730.2.1 src/share/man/man4/Makefile cvs rdiff -u -r0 -r1.2.2.2 src/share/man/man4/npflog.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1757 src/distrib/sets/lists/man/mi:1.1757.2.1 --- src/distrib/sets/lists/man/mi:1.1757 Mon Nov 21 22:01:32 2022 +++ src/distrib/sets/lists/man/mi Thu Jul 13 09:07:37 2023 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1757 2022/11/21 22:01:32 christos Exp $ +# $NetBSD: mi,v 1.1757.2.1 2023/07/13 09:07:37 martin Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -1548,6 +1548,7 @@ ./usr/share/man/cat4/nfsmbc.0 man-sys-catman .cat ./usr/share/man/cat4/njata.0 man-sys-catman .cat ./usr/share/man/cat4/njs.0 man-sys-catman .cat +./usr/share/man/cat4/npflog.0 man-sys-catman .cat ./usr/share/man/cat4/ns.0 man-obsolete obsolete ./usr/share/man/cat4/nsclpcsio.0 man-sys-catman .cat ./usr/share/man/cat4/nside.0 man-sys-catman .cat @@ -4778,6 +4779,7 @@ ./usr/share/man/html4/nfsmbc.html man-sys-htmlman html ./usr/share/man/html4/njata.html man-sys-htmlman html ./usr/share/man/html4/njs.html man-sys-htmlman html +./usr/share/man/html4/npflog.html man-sys-htmlman html ./usr/share/man/html4/nsclpcsio.html man-sys-htmlman html ./usr/share/man/html4/nside.html man-sys-htmlman html ./usr/share/man/html4/nsmb.html man-obsolete obsolete @@ -7862,6 +7864,7 @@ ./usr/share/man/man4/nfsmbc.4 man-sys-man .man ./usr/share/man/man4/njata.4 man-sys-man .man ./usr/share/man/man4/njs.4 man-sys-man .man +./usr/share/man/man4/npflog.4 man-sys-man .man ./usr/share/man/man4/ns.4 man-obsolete obsolete ./usr/share/man/man4/nsclpcsio.4 man-sys-man .man ./usr/share/man/man4/nside.4 man-sys-man .man Index: src/share/man/man4/Makefile diff -u src/share/man/man4/Makefile:1.730 src/share/man/man4/Makefile:1.730.2.1 --- src/share/man/man4/Makefile:1.730 Mon Nov 21 21:24:00 2022 +++ src/share/man/man4/Makefile Thu Jul 13 09:07:37 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.730 2022/11/21 21:24:00 brad Exp $ +# $NetBSD: Makefile,v 1.730.2.1 2023/07/13 09:07:37 martin Exp $ # @(#)Makefile 8.1 (Berkeley) 6/18/93 MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \ @@ -42,7 +42,7 @@ MAN= aac.4 ac97.4 acardide.4 aceride.4 a mcx.4 md.4 mfb.4 mfi.4 mfii.4 mhzc.4 \ micphy.4 midi.4 mii.4 mk48txx.4 mlx.4 mly.4 mpls.4 mpii.4 mpt.4 \ mpu.4 mtd.4 mtio.4 msm6242b.4 multicast.4 mvsata.4 \ - nadb.4 ne.4 neo.4 netintro.4 nfe.4 nfsmb.4 njata.4 njs.4 \ + nadb.4 ne.4 neo.4 netintro.4 nfe.4 nfsmb.4 njata.4 njs.4 npflog.4 \ nsclpcsio.4 nside.4 nsphy.4 nsphyter.4 ntwoc.4 null.4 \ nvme.4 nvmm.4 \ oak.4 oosiop.4 opl.4 options.4 optiide.4 osiop.4 otus.4 \ Added files: Index: src/share/man/man4/npflog.4 diff -u /dev/null src/share/man/man4/npflog.4:1.2.2.2 --- /dev/null Thu Jul 13 09:07:38 2023 +++ src/share/man/man4/npflog.4 Thu Jul 13 09:07:37 2023 @@ -0,0 +1,102 @@ +.\" $NetBSD: npflog.4,v 1.2.2.2 2023/07/13 09:07:37 martin Exp $ +.\" $OpenBSD: pflog.4,v 1.10 2007/05/31 19:19:51 jmc Exp $ +.\" +.\" Copyright (c) 2001 Tobias Weingartner +.\" All rights reserved. +.\" +.\" Copyright (c) 2023 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" Portions of this documentation are derived from text contributed by +.\" David H. Gutteridge. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd June 29, 2023 +.Dt NPFLOG 4 +.Os +.Sh NAME +.Nm npflog +.Nd packet filter logging interface +.Sh SYNOPSIS +.Cd "pseudo-device npflog" +.Sh DESCRIPTION +The +.Nm +interface is a pseudo-device which makes visible all packets logged by +the +.Xr npf 7 +packet filter. +Logged packets can be monitored in real time by invoking +.Xr tcpdump 8 +on the +.Nm +interface, or stored to disk using +.Xr npfd 8 . +.Pp +The npflog0 interface is created automatically at boot if +.Xr npf 7 +is enabled; +further instances can be created using +.Xr ifconfig 8 . +.Pp +Each packet retrieved on this interface has a header associated +that presently matches the format used by +.Xr pf 4 . +This header documents the address family, interface name, rule +number, reason, action, and direction of the packet that was logged. +This structure looks like: +.Bd -literal -offset indent +struct npfloghdr { + uint8_t length; + sa_family_t af; + uint8_t action; + uint8_t reason; + char ifname[IFNAMSIZ]; + char ruleset[NPFLOG_RULESET_NAME_SIZE]; + uint32_t rulenr; + uint32_t subrulenr; + uint32_t uid; + uint32_t pid; + uint32_t rule_uid; + uint32_t rule_pid; + uint8_t dir; + uint8_t pad[3]; +}; +.Ed +.Sh EXAMPLES +Monitor all packets logged on the default interface: +.Bd -literal -offset indent +# tcpdump -n -e -tttt -i npflog0 +.Ed +.Sh SEE ALSO +.Xr inet 4 , +.Xr inet6 4 , +.Xr netintro 4 , +.Xr npf 7 , +.Xr ifconfig 8 , +.Xr npfd 8 , +.Xr tcpdump 8 +.Sh HISTORY +The +.Nm +device first appeared in +.Nx 6.0 .