xref: /netbsd-src/dist/pf/share/man/man4/pflog.4 (revision 4a7a0dc0325d733f5a58d31e9a0b884a671294b8)
1.\"	$NetBSD: pflog.4,v 1.7 2018/08/17 12:36:53 maxv Exp $
2.\"	$OpenBSD: pflog.4,v 1.10 2007/05/31 19:19:51 jmc Exp $
3.\"
4.\" Copyright (c) 2001 Tobias Weingartner
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.Dd August 17, 2018
28.Dt PFLOG 4
29.Os
30.Sh NAME
31.Nm pflog
32.Nd packet filter logging interface
33.Sh SYNOPSIS
34.Cd "pseudo-device pflog"
35.Sh DESCRIPTION
36.Bf -symbolic
37The NetBSD version of PF is obsolete, and its use is strongly discouraged.
38Use
39.Xr npf 7
40instead.
41.Pp
42.Ef
43The
44.Nm pflog
45interface is a pseudo-device which makes visible all packets logged by
46the packet filter,
47.Xr pf 4 .
48Logged packets can easily be monitored in real
49time by invoking
50.Xr tcpdump 8
51on the
52.Nm
53interface, or stored to disk using
54.Xr pflogd 8 .
55.Pp
56The pflog0 interface is created automatically at boot if both
57.Xr pf 4
58and
59.Xr pflogd 8
60are enabled;
61further instances can be created using
62.Xr ifconfig 8 .
63.Pp
64Each packet retrieved on this interface has a header associated
65with it of length
66.Dv PFLOG_HDRLEN .
67This header documents the address family, interface name, rule
68number, reason, action, and direction of the packet that was logged.
69This structure, defined in
70.Aq Pa net/if_pflog.h
71looks like
72.Bd -literal -offset indent
73struct pfloghdr {
74	u_int8_t	length;
75	sa_family_t	af;
76	u_int8_t	action;
77	u_int8_t	reason;
78	char		ifname[IFNAMSIZ];
79	char		ruleset[PF_RULESET_NAME_SIZE];
80	u_int32_t	rulenr;
81	u_int32_t	subrulenr;
82	uid_t		uid;
83	pid_t		pid;
84	uid_t		rule_uid;
85	pid_t		rule_pid;
86	u_int8_t	dir;
87	u_int8_t	pad[3];
88};
89.Ed
90.Sh EXAMPLES
91Create a
92.Nm
93interface
94and monitor all packets logged on it:
95.Bd -literal -offset indent
96# ifconfig pflog1 up
97# tcpdump -n -e -ttt -i pflog1
98.Ed
99.Sh SEE ALSO
100.Xr inet 4 ,
101.Xr inet6 4 ,
102.Xr netintro 4 ,
103.Xr pf 4 ,
104.Xr ifconfig 8 ,
105.Xr pflogd 8 ,
106.Xr tcpdump 8
107.Sh HISTORY
108The
109.Nm
110device first appeared in
111.Ox 3.0 .
112.\" .Sh BUGS
113.\" Anything here?
114