]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - share/man/man4/ng_ipfw.4
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / share / man / man4 / ng_ipfw.4
1 .\" Copyright (c) 2005 Gleb Smirnoff
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\"
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 .\" SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD$
26 .\"
27 .Dd February 5, 2005
28 .Dt NG_IPFW 4
29 .Os
30 .Sh NAME
31 .Nm ng_ipfw
32 .Nd interface between netgraph and IP firewall
33 .Sh SYNOPSIS
34 .In netgraph/ng_ipfw.h
35 .Sh DESCRIPTION
36 The
37 .Nm ipfw
38 node implements interface between
39 .Xr ipfw 4
40 and
41 .Xr netgraph 4
42 subsystems.
43 .Sh HOOKS
44 The
45 .Nm ipfw
46 node supports an arbitrary number of hooks,
47 which must be named using only numeric characters.
48 .Sh OPERATION
49 Once the
50 .Nm
51 module is loaded into the kernel, a single node named
52 .Va ipfw
53 is automatically created.
54 No more
55 .Nm ipfw
56 nodes can be created.
57 Once destroyed, the only way to recreate the node is to reload the
58 .Nm
59 module.
60 .Pp
61 Packets can be injected into
62 .Xr netgraph 4
63 using either the
64 .Cm netgraph
65 or
66 .Cm ngtee
67 commands of the
68 .Xr ipfw 8
69 utility.
70 These commands require a numeric cookie to be supplied as an argument.
71 Packets are sent out of the hook whose name equals the cookie value.
72 If no hook matches, packets are discarded.
73 Packets injected via the
74 .Cm netgraph
75 command are tagged with
76 .Vt "struct ng_ipfw_tag" .
77 This tag contains information that helps the packet to re-enter
78 .Xr ipfw 4
79 processing, should the packet come back from
80 .Xr netgraph 4
81 to
82 .Xr ipfw 4 .
83 .Bd -literal -offset 4n
84 struct ng_ipfw_tag {
85         struct m_tag    mt;             /* tag header */
86         struct ip_fw    *rule;          /* matching rule */
87         struct ifnet    *ifp;           /* interface, for ip_output */
88         int             dir;            /* packet direction */
89 #define NG_IPFW_OUT     0
90 #define NG_IPFW_IN      1
91         int             flags;          /* flags, for ip_output() */
92 };
93 .Ed
94 .Pp
95 Packets received by a node from
96 .Xr netgraph 4
97 must be tagged with
98 .Vt "struct ng_ipfw_tag"
99 tag.
100 Packets re-enter IP firewall processing at the next rule.
101 If no tag is supplied, packets are discarded.
102 .Sh CONTROL MESSAGES
103 This node type supports only the generic control messages.
104 .Sh SHUTDOWN
105 This node shuts down upon receipt of a
106 .Dv NGM_SHUTDOWN
107 control message.
108 Do not do this, since the new
109 .Nm ipfw
110 node can only be created by reloading the
111 .Nm
112 module.
113 .Sh SEE ALSO
114 .Xr ipfw 4 ,
115 .Xr netgraph 4 ,
116 .Xr ipfw 8 ,
117 .Xr mbuf_tags 9
118 .Sh HISTORY
119 The
120 .Nm ipfw
121 node type was implemented in
122 .Fx 6.0 .
123 .Sh AUTHORS
124 The
125 .Nm ipfw
126 node was written by
127 .An "Gleb Smirnoff" Aq glebius@FreeBSD.org .