1 .\" Copyright (c) 2005 Gleb Smirnoff
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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.
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
32 .Nd netgraph node to adjust TCP MSS option
34 .In netgraph/ng_tcpmss.h
38 node type is designed to alter the Maximum Segment Size option
40 This node accepts an arbitrary number of hooks.
41 Initially a new hook is considered unconfigured.
42 To configure a hook, user should send
44 control message to node.
46 This node type supports the generic control messages, plus the following.
48 .It Dv NGM_TCPMSS_CONFIG Pq Ic config
49 This control message configures node to do given MSS adjusting on
52 .Vt "struct ng_tcpmss_config"
53 to be supplied as argument:
55 struct ng_tcpmss_config {
56 char inHook[NG_HOOKSIZ];
57 char outHook[NG_HOOKSIZ];
62 This means: packets received on
64 would be checked for TCP MSS option and the latter would be
69 After that packets would be sent to hook
71 .It Dv NGM_TCPMSS_GET_STATS Pq Ic getstats
72 This control message obtains statistics for the given hook.
73 The statistics are returned in
74 .Vt "struct ng_tcpmss_hookstat" :
76 struct ng_tcpmss_hookstat {
77 uint64_t Octets; /* total bytes */
78 uint64_t Packets; /* total packets */
79 uint16_t maxMSS; /* maximum MSS */
80 uint64_t SYNPkts; /* TCP SYN packets */
81 uint64_t FixedPkts; /* changed packets */
85 .It Dv NGM_TCPMSS_CLR_STATS Pq Ic clrstats
86 This control message clears statistics for the given hook.
87 .It Dv NGM_TCPMSS_GETCLR_STATS Pq Ic getclrstats
88 This control message obtains and clears statistics for the given hook.
91 In the following example packets are injected into
96 .Bd -literal -offset indent
97 # Create tcpmss node and connect it to ng_ipfw node
98 ngctl mkpeer ipfw: tcpmss 100 qqq
101 ngctl msg ipfw:100 config '{ inHook="qqq" outHook="qqq" maxMSS=1452 }'
103 # Divert traffic into tcpmss node
104 ipfw add 300 netgraph 100 tcp from any to any tcpflags syn out via fxp0
106 # Let packets continue with ipfw after being hacked
107 sysctl net.inet.ip.fw.one_pass=0
110 This node shuts down upon receipt of an
112 control message, or when all hooks have been disconnected.
119 node type was implemented in
122 .An Alexey Popov Aq lollypop@flexuser.ru
124 .An Gleb Smirnoff Aq glebius@FreeBSD.org
126 When running on SMP system statistics may be broken.