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