xref: /freebsd/share/man/man4/ng_vjc.4 (revision 6ef644f5889afbd0f681b08ed1a2f369524af83e)
1.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
2.\" All rights reserved.
3.\"
4.\" Subject to the following obligations and disclaimer of warranty, use and
5.\" redistribution of this software, in source or object code forms, with or
6.\" without modifications are expressly permitted by Whistle Communications;
7.\" provided, however, that:
8.\" 1. Any and all reproductions of the source or object code must include the
9.\"    copyright notice above and the following disclaimer of warranties; and
10.\" 2. No rights are granted, in any manner or form, to use Whistle
11.\"    Communications, Inc. trademarks, including the mark "WHISTLE
12.\"    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
13.\"    such appears in the above copyright notice or in the software.
14.\"
15.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
16.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
17.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
18.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
19.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
20.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
21.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
22.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
23.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
24.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
25.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
27.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
28.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
31.\" OF SUCH DAMAGE.
32.\"
33.\" Author: Archie Cobbs <archie@FreeBSD.org>
34.\" $Whistle: ng_vjc.8,v 1.4 1999/01/25 23:46:28 archie Exp $
35.\"
36.Dd January 19, 1999
37.Dt NG_VJC 4
38.Os
39.Sh NAME
40.Nm ng_vjc
41.Nd Van Jacobson compression netgraph node type
42.Sh SYNOPSIS
43.In sys/types.h
44.In netinet/in.h
45.In netinet/in_systm.h
46.In netinet/ip.h
47.In net/slcompress.h
48.In netgraph/ng_vjc.h
49.Sh DESCRIPTION
50The
51.Nm vjc
52node type performs Van Jacobson compression, which is used
53over PPP, SLIP, and other point-to-point IP connections to
54compress TCP packet headers.
55The
56.Dv ip
57hook represents the uncompressed side of the node, while the
58.Dv vjcomp ,
59.Dv vjuncomp ,
60and
61.Dv vjip
62hooks represent the compressed side of the node.
63Packets received on the
64.Dv ip
65will be compressed or passed through as appropriate.
66Packets received on the other three hooks will be uncompressed as appropriate.
67This node also supports
68.Dq always pass through
69mode in either direction.
70.Pp
71Van Jacobson compression only applies to TCP packets.
72Only
73.Dq normal
74(i.e., common case) TCP packets are actually compressed.
75These are output on the
76.Dv vjcomp
77hook.
78Other TCP packets are run through the state machine but not
79compressed; these appear on the
80.Dv vjuncomp
81hook.
82Other non-TCP IP packets are forwarded unchanged to
83.Dv vjip .
84.Pp
85When connecting to a
86.Xr ng_ppp 4
87node, the
88.Dv ip ,
89.Dv vjuncomp ,
90.Dv vjcomp ,
91and
92.Dv vjip
93hooks should be connected to the
94.Xr ng_ppp 4
95node's
96.Dv vjc_ip ,
97.Dv vjc_vjcomp ,
98.Dv vjc_vjuncomp ,
99and
100.Dv vjc_ip
101hooks, respectively.
102.Sh HOOKS
103This node type supports the following hooks:
104.Bl -tag -width ".Va vjuncomp"
105.It Va ip
106Upstream (uncompressed) IP packets.
107.It Va vjcomp
108Downstream compressed TCP packets.
109.It Va vjuncomp
110Downstream uncompressed TCP packets.
111.It Va vjip
112Downstream uncompressed IP packets.
113.El
114.Sh CONTROL MESSAGES
115This node type supports the generic control messages, plus the following:
116.Bl -tag -width foo
117.It Dv NGM_VJC_SET_CONFIG Pq Ic setconfig
118This command resets the compression state and configures it according
119to the supplied
120.Dv "struct ngm_vjc_config"
121argument.
122This structure contains the following fields:
123.Bd -literal -offset 4n
124struct ngm_vjc_config {
125  u_char   enableComp;    /* Enable compression */
126  u_char   enableDecomp;  /* Enable decompression */
127  u_char   maxChannel;    /* Number of outgoing channels - 1 */
128  u_char   compressCID;   /* OK to compress outgoing CID's */
129};
130.Ed
131.Pp
132When
133.Dv enableComp
134is set to zero, all packets received on the
135.Dv ip
136hook are forwarded unchanged out the
137.Dv vjip
138hook.
139Similarly, when
140.Dv enableDecomp
141is set to zero, all packets received on the
142.Dv vjip
143hook are forwarded unchanged out the
144.Dv ip
145hook, and packets are not accepted on the
146.Dv vjcomp
147and
148.Dv vjuncomp
149hooks.
150When a node is first created,
151both compression and decompression are disabled and the node is
152therefore operating in bi-directional
153.Dq pass through
154mode.
155.Pp
156When enabling compression,
157.Dv maxChannel
158should be set to the number of outgoing compression channels minus one,
159and is a value between 3 and 15, inclusive.
160The
161.Dv compressCID
162field indicates whether it is OK to compress the CID header field for
163outgoing compressed TCP packets.
164This value should be zero unless
165either (a) it is not possible for an outgoing frame to be lost, or
166(b) lost frames can be reliably detected and immediately
167reported to the peer's decompression engine (see
168.Dv NGM_VJC_RECV_ERROR
169below).
170.It Dv NGM_VJC_GET_STATE Pq Ic getstate
171This command returns the node's current state described by the
172.Dv "struct slcompress"
173structure, which is defined in
174.In net/slcompress.h .
175.It Dv NGM_VJC_CLR_STATS Pq Ic clrstats
176Clears the node statistics counters.
177Statistics are also cleared whenever the
178.Dv enableComp
179or
180.Dv enableDecomp
181fields are changed from zero to one by a
182.Dv NGM_VJC_SET_CONFIG
183control message.
184.It Dv NGM_VJC_RECV_ERROR Pq Ic recverror
185When the peer has CID header field compression enabled,
186this message must be sent to the local
187.Nm vjc
188node immediately
189after detecting that a received frame has been lost, due to a bad
190checksum or for any other reason.
191Failing to do this can result in corrupted TCP stream data.
192.El
193.Sh SHUTDOWN
194This node shuts down upon receipt of a
195.Dv NGM_SHUTDOWN
196control message, or when all hooks have been disconnected.
197.Sh SEE ALSO
198.Xr netgraph 4 ,
199.Xr ng_iface 4 ,
200.Xr ng_ppp 4 ,
201.Xr ngctl 8
202.Rs
203.%A V. Jacobson
204.%T "Compressing TCP/IP Headers"
205.%O RFC 1144
206.Re
207.Rs
208.%A G. McGregor
209.%T "The PPP Internet Control Protocol (IPCP)"
210.%O RFC 1332
211.Re
212.Sh HISTORY
213The
214.Nm
215node type was implemented in
216.Fx 4.0 .
217.Sh AUTHORS
218.An Archie Cobbs Aq Mt archie@FreeBSD.org
219.Sh BUGS
220As the initialization routine in the kernel implementation of
221Van Jacobson compression initializes both compression and decompression
222at once, this node does not allow compression and decompression to
223be enabled in separate operations.
224In order to enable one when
225the other is already enabled, first both must be disabled, then
226both enabled.
227This of course resets the node state.
228This restriction may be lifted in a later version.
229.Pp
230When built as a loadable kernel module, this module includes the file
231.Pa net/slcompress.c .
232Although loading the module should fail if
233.Pa net/slcompress.c
234already exists in the kernel, currently it does not, and the duplicate
235copies of the file do not interfere.
236However, this may change in the future.
237