xref: /freebsd/share/man/man4/ng_vjc.4 (revision 32eef9aeb1f39a1623cea55da147c89abbd5b9a5)
14cf49a43SJulian Elischer.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
24cf49a43SJulian Elischer.\" All rights reserved.
34cf49a43SJulian Elischer.\"
44cf49a43SJulian Elischer.\" Subject to the following obligations and disclaimer of warranty, use and
54cf49a43SJulian Elischer.\" redistribution of this software, in source or object code forms, with or
64cf49a43SJulian Elischer.\" without modifications are expressly permitted by Whistle Communications;
74cf49a43SJulian Elischer.\" provided, however, that:
84cf49a43SJulian Elischer.\" 1. Any and all reproductions of the source or object code must include the
94cf49a43SJulian Elischer.\"    copyright notice above and the following disclaimer of warranties; and
104cf49a43SJulian Elischer.\" 2. No rights are granted, in any manner or form, to use Whistle
114cf49a43SJulian Elischer.\"    Communications, Inc. trademarks, including the mark "WHISTLE
124cf49a43SJulian Elischer.\"    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
134cf49a43SJulian Elischer.\"    such appears in the above copyright notice or in the software.
144cf49a43SJulian Elischer.\"
154cf49a43SJulian Elischer.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
164cf49a43SJulian Elischer.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
174cf49a43SJulian Elischer.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
184cf49a43SJulian Elischer.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
194cf49a43SJulian Elischer.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
204cf49a43SJulian Elischer.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
214cf49a43SJulian Elischer.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
224cf49a43SJulian Elischer.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
234cf49a43SJulian Elischer.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
244cf49a43SJulian Elischer.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
254cf49a43SJulian Elischer.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
264cf49a43SJulian Elischer.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
274cf49a43SJulian Elischer.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
284cf49a43SJulian Elischer.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
294cf49a43SJulian Elischer.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
304cf49a43SJulian Elischer.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
314cf49a43SJulian Elischer.\" OF SUCH DAMAGE.
324cf49a43SJulian Elischer.\"
33eddc45e7SJeroen Ruigrok van der Werven.\" Author: Archie Cobbs <archie@FreeBSD.org>
344cf49a43SJulian Elischer.\"
354cf49a43SJulian Elischer.\" $FreeBSD$
364cf49a43SJulian Elischer.\" $Whistle: ng_vjc.8,v 1.4 1999/01/25 23:46:28 archie Exp $
374cf49a43SJulian Elischer.\"
384cf49a43SJulian Elischer.Dd January 19, 1999
39bec35b9aSArchie Cobbs.Dt NG_VJC 4
403d45e180SRuslan Ermilov.Os
414cf49a43SJulian Elischer.Sh NAME
424cf49a43SJulian Elischer.Nm ng_vjc
439dcab530SArchie Cobbs.Nd Van Jacobson compression netgraph node type
444cf49a43SJulian Elischer.Sh SYNOPSIS
4532eef9aeSRuslan Ermilov.In net/slcompress.h
4632eef9aeSRuslan Ermilov.In netgraph/ng_vjc.h
474cf49a43SJulian Elischer.Sh DESCRIPTION
484cf49a43SJulian ElischerThe
494cf49a43SJulian Elischer.Nm vjc
509dcab530SArchie Cobbsnode type performs Van Jacobson compression, which is used
514cf49a43SJulian Elischerover PPP, SLIP, and other point-to-point IP connections to
524cf49a43SJulian Elischercompress TCP packet headers.  The
534cf49a43SJulian Elischer.Dv ip
544cf49a43SJulian Elischerhook represents the uncompressed side of the node, while the
554cf49a43SJulian Elischer.Dv vjcomp ,
564cf49a43SJulian Elischer.Dv vjuncomp ,
574cf49a43SJulian Elischerand
584cf49a43SJulian Elischer.Dv vjip
590f9183beSArchie Cobbshooks represent the compressed side of the node.  Packets received on the
604cf49a43SJulian Elischer.Dv ip
614cf49a43SJulian Elischerwill be compressed or passed through as appropriate.  Packets received
624cf49a43SJulian Elischeron the other three hooks will be uncompressed as appropriate.
6351291597SJulian ElischerThis node also supports
6451291597SJulian Elischer.Dq always pass through
6551291597SJulian Elischermode in either direction.
664cf49a43SJulian Elischer.Pp
679dcab530SArchie CobbsVan Jacobson compression only applies to TCP packets.
6851291597SJulian ElischerOnly
6951291597SJulian Elischer.Dq normal
7051291597SJulian Elischer(i.e., common case) TCP packets are actually compressed.
714cf49a43SJulian ElischerThese are output on the
724cf49a43SJulian Elischer.Dv vjcomp
734cf49a43SJulian Elischerhook.  Other TCP packets are run through the state machine but not
744cf49a43SJulian Elischercompressed; these appear on the
754cf49a43SJulian Elischer.Dv vjuncomp
764cf49a43SJulian Elischerhook.
774cf49a43SJulian ElischerOther non-TCP IP packets are forwarded unchanged to
784cf49a43SJulian Elischer.Dv vjip .
794cf49a43SJulian Elischer.Pp
804cf49a43SJulian ElischerWhen connecting to a
81bec35b9aSArchie Cobbs.Xr ng_ppp 4
824cf49a43SJulian Elischernode, the
83a14a0223SJulian Elischer.Dv ip ,
844cf49a43SJulian Elischer.Dv vjuncomp ,
854cf49a43SJulian Elischer.Dv vjcomp ,
864cf49a43SJulian Elischerand
874cf49a43SJulian Elischer.Dv vjip
880f9183beSArchie Cobbshooks should be connected to the
89bec35b9aSArchie Cobbs.Xr ng_ppp 4
904cf49a43SJulian Elischernode's
91a14a0223SJulian Elischer.Dv vjc_ip ,
92a14a0223SJulian Elischer.Dv vjc_vjcomp ,
93a14a0223SJulian Elischer.Dv vjc_vjuncomp ,
944cf49a43SJulian Elischerand
95a14a0223SJulian Elischer.Dv vjc_ip
960f9183beSArchie Cobbshooks, respectively.
974cf49a43SJulian Elischer.Sh HOOKS
984cf49a43SJulian ElischerThis node type supports the following hooks:
994cf49a43SJulian Elischer.Pp
1004cf49a43SJulian Elischer.Bl -tag -width foobarbazi
1014cf49a43SJulian Elischer.It Dv ip
1024cf49a43SJulian ElischerUpstream (uncompressed) IP packets.
1034cf49a43SJulian Elischer.It Dv vjcomp
1044cf49a43SJulian ElischerDownstream compressed TCP packets.
1054cf49a43SJulian Elischer.It Dv vjuncomp
1064cf49a43SJulian ElischerDownstream uncompressed TCP packets.
1074cf49a43SJulian Elischer.It Dv vjip
1084cf49a43SJulian ElischerDownstream uncompressed IP packets.
1093136363fSRuslan Ermilov.El
1104cf49a43SJulian Elischer.Sh CONTROL MESSAGES
1114cf49a43SJulian ElischerThis node type supports the generic control messages, plus the following:
1124cf49a43SJulian Elischer.Bl -tag -width foo
113a14a0223SJulian Elischer.It Dv NGM_VJC_SET_CONFIG
1144cf49a43SJulian ElischerThis command resets the compression state and configures it according
1154cf49a43SJulian Elischerto the supplied
1164cf49a43SJulian Elischer.Dv "struct ngm_vjc_config"
1174cf49a43SJulian Elischerargument.  This structure contains the following fields:
1184cf49a43SJulian Elischer.Bd -literal -offset 4n
1194cf49a43SJulian Elischerstruct ngm_vjc_config {
120a14a0223SJulian Elischer  u_char   enableComp;    /* Enable compression */
121a14a0223SJulian Elischer  u_char   enableDecomp;  /* Enable decompression */
12271cb548dSArchie Cobbs  u_char   maxChannel;    /* Number of outgoing channels - 1 */
1234cf49a43SJulian Elischer  u_char   compressCID;   /* OK to compress outgoing CID's */
1244cf49a43SJulian Elischer};
1254cf49a43SJulian Elischer.Ed
1264cf49a43SJulian Elischer.Pp
1274cf49a43SJulian ElischerWhen
128a14a0223SJulian Elischer.Dv enableComp
129a14a0223SJulian Elischeris set to zero, all packets received on the
1304cf49a43SJulian Elischer.Dv ip
131a14a0223SJulian Elischerhook are forwarded unchanged out the
1324cf49a43SJulian Elischer.Dv vjip
133a14a0223SJulian Elischerhook.  Similarly, when
134a14a0223SJulian Elischer.Dv enableDecomp
135a14a0223SJulian Elischeris set to zero, all packets received on the
136a14a0223SJulian Elischer.Dv vjip
137a14a0223SJulian Elischerhook are forwarded unchanged out the
138a14a0223SJulian Elischer.Dv ip
139a14a0223SJulian Elischerhook, and packets are not accepted on the
140a14a0223SJulian Elischer.Dv vjcomp
141a14a0223SJulian Elischerand
142a14a0223SJulian Elischer.Dv vjuncomp
1434cf49a43SJulian Elischerhooks.
144a14a0223SJulian ElischerWhen a node is first created,
145a14a0223SJulian Elischerboth compression and decompression are disabled and the node is
14651291597SJulian Elischertherefore operating in bi-directional
14751291597SJulian Elischer.Dq pass through
14851291597SJulian Elischermode.
1494cf49a43SJulian Elischer.Pp
150a14a0223SJulian ElischerWhen enabling compression,
15171cb548dSArchie Cobbs.Dv maxChannel
15271cb548dSArchie Cobbsshould be set to the number of outgoing compression channels minus one,
1530f9183beSArchie Cobbsand is a value between 3 and 15, inclusive.  The
1544cf49a43SJulian Elischer.Dv compressCID
1550f9183beSArchie Cobbsfield indicates whether it is OK to compress the CID header field for
1564cf49a43SJulian Elischeroutgoing compressed TCP packets.  This value should be zero unless
1570f9183beSArchie Cobbseither (a) it is not possible for an outgoing frame to be lost, or
1580f9183beSArchie Cobbs(b) lost frames can be reliably detected and immediately
1590f9183beSArchie Cobbsreported to the peer's decompression engine (see
1604cf49a43SJulian Elischer.Dv NGM_VJC_RECV_ERROR
1610f9183beSArchie Cobbsbelow).
1624cf49a43SJulian Elischer.It Dv NGM_VJC_GET_STATE
1634cf49a43SJulian ElischerThis command returns the node's current state described by the
1644cf49a43SJulian Elischer.Dv "struct slcompress"
1654cf49a43SJulian Elischerstructure, which is defined in
16651291597SJulian Elischer.Pa net/slcompress.h .
1674cf49a43SJulian Elischer.It Dv NGM_VJC_CLR_STATS
1684cf49a43SJulian ElischerClears the node statistics counters.  Statistics are also cleared whenever the
169a14a0223SJulian Elischer.Dv enableComp
170a14a0223SJulian Elischeror
171a14a0223SJulian Elischer.Dv enableDecomp
172a14a0223SJulian Elischerfields are changed from zero to one by a
173a14a0223SJulian Elischer.Dv NGM_VJC_SET_CONFIG
1744cf49a43SJulian Elischercontrol message.
1754cf49a43SJulian Elischer.It Dv NGM_VJC_RECV_ERROR
1760f9183beSArchie CobbsWhen the peer has CID header field compression enabled,
1770f9183beSArchie Cobbsthis message must be sent to the local
1780f9183beSArchie Cobbs.Nm vjc
1790f9183beSArchie Cobbsnode immediately
1807f9d26bdSMike Pritchardafter detecting that a received frame has been lost, due to a bad
1814cf49a43SJulian Elischerchecksum or for any other reason.  Failing to do this can result
1824cf49a43SJulian Elischerin corrupted TCP stream data.
1833136363fSRuslan Ermilov.El
1844cf49a43SJulian Elischer.Sh SHUTDOWN
1854cf49a43SJulian ElischerThis node shuts down upon receipt of a
1864cf49a43SJulian Elischer.Dv NGM_SHUTDOWN
1874cf49a43SJulian Elischercontrol message, or when all hooks have been disconnected.
1884cf49a43SJulian Elischer.Sh BUGS
189a14a0223SJulian ElischerBecause the initialization routine in the kernel implementation of
1909dcab530SArchie CobbsVan Jacobson compression initializes both compression and decompression
191a14a0223SJulian Elischerat once, this node does not allow compression and decompression to
192a14a0223SJulian Elischerbe enabled in separate operations.  In order to enable one when
193a14a0223SJulian Elischerthe other is already enabled, first both must be disabled, then
194a14a0223SJulian Elischerboth enabled.  This of course resets the node state.  This restriction
195a14a0223SJulian Elischermay be lifted in a later version.
1964562620cSArchie Cobbs.Pp
1974562620cSArchie CobbsWhen built as a loadable kernel module, this module includes the file
19851291597SJulian Elischer.Pa net/slcompress.c .
1994562620cSArchie CobbsAlthough loading the module should fail if
20051291597SJulian Elischer.Pa net/slcompress.c
2014562620cSArchie Cobbsalready exists in the kernel, currently it does not, and the duplicate
2024562620cSArchie Cobbscopies of the file do not interfere.
2034562620cSArchie CobbsHowever, this may change in the future.
2044cf49a43SJulian Elischer.Sh SEE ALSO
2054cf49a43SJulian Elischer.Xr netgraph 4 ,
206bec35b9aSArchie Cobbs.Xr ng_iface 4 ,
2075521ff5aSRuslan Ermilov.Xr ng_ppp 4 ,
208bec35b9aSArchie Cobbs.Xr ngctl 8
2094cf49a43SJulian Elischer.Rs
2109dcab530SArchie Cobbs.%A V. Jacobson
2114cf49a43SJulian Elischer.%T "Compressing TCP/IP Headers"
2124cf49a43SJulian Elischer.%O RFC 1144
2134cf49a43SJulian Elischer.Re
2144cf49a43SJulian Elischer.Rs
2154cf49a43SJulian Elischer.%A G. McGregor
2164cf49a43SJulian Elischer.%T "The PPP Internet Control Protocol (IPCP)"
2174cf49a43SJulian Elischer.%O RFC 1332
2184cf49a43SJulian Elischer.Re
21951291597SJulian Elischer.Sh HISTORY
22051291597SJulian ElischerThe
22151291597SJulian Elischer.Nm
22251291597SJulian Elischernode type was implemented in
22351291597SJulian Elischer.Fx 4.0 .
22451291597SJulian Elischer.Sh AUTHORS
225eddc45e7SJeroen Ruigrok van der Werven.An Archie Cobbs Aq archie@FreeBSD.org
226