Merge from vendor branch GCC:
[dragonfly.git] / share / man / man4 / pfsync.4
1 .\"     $OpenBSD: pfsync.4,v 1.14 2004/03/21 19:47:59 miod Exp $
2 .\"     $DragonFly: src/share/man/man4/pfsync.4,v 1.1 2005/03/24 01:15:59 corecode Exp $
3 .\"
4 .\" Copyright (c) 2002 Michael Shalayeff
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 MIND,
22 .\" USE, 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 November 29, 2002
28 .Dt PFSYNC 4
29 .Os
30 .Sh NAME
31 .Nm pfsync
32 .Nd packet filter states table logging interface
33 .Sh SYNOPSIS
34 .Cd "device pfsync"
35 .Sh DESCRIPTION
36 The
37 .Nm
38 interface is a pseudo-device which exposes certain changes to the state
39 table used by
40 .Xr pf 4 .
41 State changes can be viewed by invoking
42 .Xr tcpdump 8
43 on the
44 .Nm
45 interface.
46 If configured with a physical synchronisation interface,
47 .Nm
48 will also send state changes out on that interface using IP multicast,
49 and insert state changes received on that interface from other systems
50 into the state table.
51 .Pp
52 By default, all local changes to the state table are exposed via
53 .Nm .
54 However, state changes from packets received by
55 .Nm
56 over the network are not rebroadcast.
57 States created by a rule marked with the
58 .Ar no-sync
59 keyword are omitted from the
60 .Nm
61 interface (see
62 .Xr pf.conf 5
63 for details).
64 .Pp
65 The
66 .Nm
67 interface will attempt to collapse multiple updates of the same
68 state into one message where possible.
69 The maximum number of times this can be done before the update is sent out
70 is controlled by the
71 .Ar maxupd
72 to ifconfig.
73 (see
74 .Xr ifconfig 8
75 and the example below for more details)
76 .Pp
77 Each packet retrieved on this interface has a header associated
78 with it of length
79 .Dv PFSYNC_HDRLEN .
80 The header indicates the version of the protocol, address family,
81 action taken on the following states and the number of state
82 table entries attached in this packet.
83 This structure, defined in
84 .Aq Pa net/if_pfsync.h
85 looks like:
86 .Bd -literal -offset indent
87 struct pfsync_header {
88         u_int8_t version;
89         u_int8_t af;
90         u_int8_t action;
91         u_int8_t count;
92 };
93 .Ed
94 .Sh NETWORK SYNCHRONISATION
95 States can be synchronised between two or more firewalls using this
96 interface, by specifying a synchronisation interface using
97 .Xr ifconfig 8 .
98 For example, the following command sets fxp0 as the synchronisation
99 interface.
100 .Bd -literal -offset indent
101 # ifconfig pfsync0 syncif fxp0
102 .Ed
103 .Pp
104 State change messages are sent out on the synchronisation
105 interface using IP multicast packets.
106 The protocol is IP protocol 240, PFSYNC, and the multicast group
107 used is 224.0.0.240.
108 .Pp
109 It is important that the synchronisation interface be on a trusted
110 network as there is no authentication on the protocol and it would
111 be trivial to spoof packets which create states, bypassing the pf ruleset.
112 Ideally, this is a network dedicated to pfsync messages,
113 i.e. a crossover cable between two firewalls.
114 .Pp
115 There is a one-to-one correspondence between packets seen by
116 .Xr bpf 4
117 on the
118 .Nm
119 interface, and packets sent out on the synchronisation interface, i.e.\&
120 a packet with 4 state deletion messages on
121 .Nm
122 means that the same 4 deletions were sent out on the synchronisation
123 interface.
124 However, the actual packet contents may differ as the messages
125 sent over the network are "compressed" where possible, containing
126 only the necessary information.
127 .Sh EXAMPLES
128 .Bd -literal -offset indent
129 # ifconfig pfsync0 up syncif fxp0 maxupd 64
130 # tcpdump -s1500 -evtni pfsync0
131 .Ed
132 .Sh SEE ALSO
133 .Xr bpf 4 ,
134 .Xr inet 4 ,
135 .Xr inet6 4 ,
136 .Xr netintro 4 ,
137 .Xr pf 4 ,
138 .Xr pf.conf 5 ,
139 .Xr protocols 5 ,
140 .Xr ifconfig 8 ,
141 .Xr tcpdump 8
142 .Sh HISTORY
143 The
144 .Nm
145 device first appeared in
146 .Ox 3.3
147 and was imported into
148 .Dx 1.1
149 by Devon H. O'Dell and Simon Schubert.