xref: /netbsd-src/dist/pf/share/man/man4/pflog.4 (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1.\"	$NetBSD: pflog.4,v 1.6 2009/03/22 14:29:34 perry 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 May 31, 2007
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
36The
37.Nm pflog
38interface is a pseudo-device which makes visible all packets logged by
39the packet filter,
40.Xr pf 4 .
41Logged packets can easily be monitored in real
42time by invoking
43.Xr tcpdump 8
44on the
45.Nm
46interface, or stored to disk using
47.Xr pflogd 8 .
48.Pp
49The pflog0 interface is created automatically at boot if both
50.Xr pf 4
51and
52.Xr pflogd 8
53are enabled;
54further instances can be created using
55.Xr ifconfig 8 .
56.Pp
57Each packet retrieved on this interface has a header associated
58with it of length
59.Dv PFLOG_HDRLEN .
60This header documents the address family, interface name, rule
61number, reason, action, and direction of the packet that was logged.
62This structure, defined in
63.Aq Pa net/if_pflog.h
64looks like
65.Bd -literal -offset indent
66struct pfloghdr {
67	u_int8_t	length;
68	sa_family_t	af;
69	u_int8_t	action;
70	u_int8_t	reason;
71	char		ifname[IFNAMSIZ];
72	char		ruleset[PF_RULESET_NAME_SIZE];
73	u_int32_t	rulenr;
74	u_int32_t	subrulenr;
75	uid_t		uid;
76	pid_t		pid;
77	uid_t		rule_uid;
78	pid_t		rule_pid;
79	u_int8_t	dir;
80	u_int8_t	pad[3];
81};
82.Ed
83.Sh EXAMPLES
84Create a
85.Nm
86interface
87and monitor all packets logged on it:
88.Bd -literal -offset indent
89# ifconfig pflog1 up
90# tcpdump -n -e -ttt -i pflog1
91.Ed
92.Sh SEE ALSO
93.Xr inet 4 ,
94.Xr inet6 4 ,
95.Xr netintro 4 ,
96.Xr pf 4 ,
97.Xr ifconfig 8 ,
98.Xr pflogd 8 ,
99.Xr tcpdump 8
100.Sh HISTORY
101The
102.Nm
103device first appeared in
104.Ox 3.0 .
105.\" .Sh BUGS
106.\" Anything here?
107