xref: /freebsd/share/man/man4/pflog.4 (revision 7cc42f6d25ef2e19059d088fa7d4853fe9afefb5)
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.\" $FreeBSD$
27.\"
28.Dd April 18, 2019
29.Dt PFLOG 4
30.Os
31.Sh NAME
32.Nm pflog
33.Nd packet filter logging interface
34.Sh SYNOPSIS
35.Cd "device pflog"
36.Sh DESCRIPTION
37The
38.Nm pflog
39interface is a device which makes visible all packets logged by
40the packet filter,
41.Xr pf 4 .
42Logged packets can easily be monitored in real
43time by invoking
44.Xr tcpdump 1
45on the
46.Nm
47interface, or stored to disk using
48.Xr pflogd 8 .
49.Pp
50The pflog0 interface is created when the
51.Nm
52module is loaded;
53further instances can be created using
54.Xr ifconfig 8 .
55The
56.Nm
57module is loaded automatically if both
58.Xr pf 4
59and
60.Xr pflogd 8
61are enabled.
62.Pp
63Each packet retrieved on this interface has a header associated
64with it of length
65.Dv PFLOG_HDRLEN .
66This header documents the address family, interface name, rule
67number, reason, action, and direction of the packet that was logged.
68This structure, defined in
69.Aq Pa net/if_pflog.h
70looks like
71.Bd -literal -offset indent
72struct pfloghdr {
73	u_int8_t	length;
74	sa_family_t	af;
75	u_int8_t	action;
76	u_int8_t	reason;
77	char		ifname[IFNAMSIZ];
78	char		ruleset[PF_RULESET_NAME_SIZE];
79	u_int32_t	rulenr;
80	u_int32_t	subrulenr;
81	uid_t		uid;
82	pid_t		pid;
83	uid_t		rule_uid;
84	pid_t		rule_pid;
85	u_int8_t	dir;
86	u_int8_t	pad[3];
87};
88.Ed
89.Sh EXAMPLES
90Create a
91.Nm
92interface
93and monitor all packets logged on it:
94.Bd -literal -offset indent
95# ifconfig pflog create
96pflog1
97# ifconfig pflog1 up
98# tcpdump -n -e -ttt -i pflog1
99.Ed
100.Sh SEE ALSO
101.Xr tcpdump 1 ,
102.Xr inet 4 ,
103.Xr inet6 4 ,
104.Xr netintro 4 ,
105.Xr pf 4 ,
106.Xr ifconfig 8 ,
107.Xr pflogd 8
108.Sh HISTORY
109The
110.Nm
111device first appeared in
112.Ox 3.0 .
113.Sh BUGS
114FreeBSD does not set a process id in the
115.Fa pid
116field in pfloghdr.
117