xref: /freebsd/share/man/man4/ng_ipfw.4 (revision 2be1a816)
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
36The
37.Nm ipfw
38node implements interface between
39.Xr ipfw 4
40and
41.Xr netgraph 4
42subsystems.
43.Sh HOOKS
44The
45.Nm ipfw
46node supports an arbitrary number of hooks,
47which must be named using only numeric characters.
48.Sh OPERATION
49Once the
50.Nm
51module is loaded into the kernel, a single node named
52.Va ipfw
53is automatically created.
54No more
55.Nm ipfw
56nodes can be created.
57Once destroyed, the only way to recreate the node is to reload the
58.Nm
59module.
60.Pp
61Packets can be injected into
62.Xr netgraph 4
63using either the
64.Cm netgraph
65or
66.Cm ngtee
67commands of the
68.Xr ipfw 8
69utility.
70These commands require a numeric cookie to be supplied as an argument.
71Packets are sent out of the hook whose name equals the cookie value.
72If no hook matches, packets are discarded.
73Packets injected via the
74.Cm netgraph
75command are tagged with
76.Vt "struct ng_ipfw_tag" .
77This tag contains information that helps the packet to re-enter
78.Xr ipfw 4
79processing, should the packet come back from
80.Xr netgraph 4
81to
82.Xr ipfw 4 .
83.Bd -literal -offset 4n
84struct 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
95Packets received by a node from
96.Xr netgraph 4
97must be tagged with
98.Vt "struct ng_ipfw_tag"
99tag.
100Packets re-enter IP firewall processing at the next rule.
101If no tag is supplied, packets are discarded.
102.Sh CONTROL MESSAGES
103This node type supports only the generic control messages.
104.Sh SHUTDOWN
105This node shuts down upon receipt of a
106.Dv NGM_SHUTDOWN
107control message.
108Do not do this, since the new
109.Nm ipfw
110node can only be created by reloading the
111.Nm
112module.
113.Sh SEE ALSO
114.Xr ipfw 4 ,
115.Xr netgraph 4 ,
116.Xr ipfw 8 ,
117.Xr mbuf_tags 9
118.Sh HISTORY
119The
120.Nm ipfw
121node type was implemented in
122.Fx 6.0 .
123.Sh AUTHORS
124The
125.Nm ipfw
126node was written by
127.An "Gleb Smirnoff" Aq glebius@FreeBSD.org .
128