xref: /freebsd/share/man/man4/ng_tcpmss.4 (revision f92d9b1aad73fc47f8f0b960808ca2c1a938e9e7)
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.Dd June 9, 2005
26.Dt NG_TCPMSS 4
27.Os
28.Sh NAME
29.Nm ng_tcpmss
30.Nd "netgraph node to adjust TCP MSS option"
31.Sh SYNOPSIS
32.In netgraph.h
33.In netgraph/ng_tcpmss.h
34.Sh DESCRIPTION
35The
36.Nm tcpmss
37node type is designed to alter the Maximum Segment Size option
38of TCP packets.
39This node accepts an arbitrary number of hooks.
40Initially a new hook is considered unconfigured.
41The
42.Dv NG_TCPMSS_CONFIG
43control message is used to configure a hook.
44.Sh CONTROL MESSAGES
45This node type supports the generic control messages, plus the following.
46.Bl -tag -width foo
47.It Dv NGM_TCPMSS_CONFIG Pq Ic config
48This control message configures node to do given MSS adjusting on
49a particular hook.
50It requires the
51.Vt "struct ng_tcpmss_config"
52to be supplied as an argument:
53.Bd -literal
54struct ng_tcpmss_config {
55	char		inHook[NG_HOOKSIZ];
56	char		outHook[NG_HOOKSIZ];
57	uint16_t	maxMSS;
58}
59.Ed
60.Pp
61This means: packets received on
62.Va inHook
63would be checked for TCP MSS option and the latter would be
64reduced down to
65.Va maxMSS
66if it exceeds
67.Va maxMSS .
68After that, packets would be sent to hook
69.Va outHook .
70.It Dv NGM_TCPMSS_GET_STATS Pq Ic getstats
71This control message obtains statistics for a given hook.
72The statistics are returned in
73.Vt "struct ng_tcpmss_hookstat" :
74.Bd -literal
75struct ng_tcpmss_hookstat {
76	uint64_t	Octets;		/* total bytes */
77	uint64_t	Packets;	/* total packets */
78	uint16_t	maxMSS;		/* maximum MSS */
79	uint64_t	SYNPkts;	/* TCP SYN packets */
80	uint64_t	FixedPkts;	/* changed packets */
81};
82.Ed
83.It Dv NGM_TCPMSS_CLR_STATS Pq Ic clrstats
84This control message clears statistics for a given hook.
85.It Dv NGM_TCPMSS_GETCLR_STATS Pq Ic getclrstats
86This control message obtains and clears statistics for a given hook.
87.El
88.Sh EXAMPLES
89In the following example, packets are injected into the
90.Nm tcpmss
91node using the
92.Xr ng_ipfw 4
93node.
94.Bd -literal -offset indent
95# Create tcpmss node and connect it to ng_ipfw node
96ngctl mkpeer ipfw: tcpmss 100 qqq
97
98# Adjust MSS to 1452
99ngctl msg ipfw:100 config '{ inHook="qqq" outHook="qqq" maxMSS=1452 }'
100
101# Divert traffic into tcpmss node
102ipfw add 300 netgraph 100 tcp from any to any tcpflags syn out via fxp0
103
104# Let packets continue with ipfw after being hacked
105sysctl net.inet.ip.fw.one_pass=0
106.Ed
107.Sh SHUTDOWN
108This node shuts down upon receipt of an
109.Dv NGM_SHUTDOWN
110control message, or when all hooks have been disconnected.
111.Sh SEE ALSO
112.Xr netgraph 4 ,
113.Xr ng_ipfw 4
114.Sh HISTORY
115The
116.Nm
117node type was implemented in
118.Fx 6.0 .
119.Sh AUTHORS
120.An Alexey Popov Aq Mt lollypop@flexuser.ru
121.An Gleb Smirnoff Aq Mt glebius@FreeBSD.org
122.Sh BUGS
123When running on SMP, system statistics may be broken.
124