xref: /freebsd/share/man/man4/ng_vjc.4 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
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.\" $Whistle: ng_vjc.8,v 1.4 1999/01/25 23:46:28 archie Exp $
354cf49a43SJulian Elischer.\"
364cf49a43SJulian Elischer.Dd January 19, 1999
37bec35b9aSArchie Cobbs.Dt NG_VJC 4
383d45e180SRuslan Ermilov.Os
394cf49a43SJulian Elischer.Sh NAME
404cf49a43SJulian Elischer.Nm ng_vjc
419dcab530SArchie Cobbs.Nd Van Jacobson compression netgraph node type
424cf49a43SJulian Elischer.Sh SYNOPSIS
43fbad9e2dSRuslan Ermilov.In sys/types.h
44fbad9e2dSRuslan Ermilov.In netinet/in.h
45fbad9e2dSRuslan Ermilov.In netinet/in_systm.h
46fbad9e2dSRuslan Ermilov.In netinet/ip.h
4732eef9aeSRuslan Ermilov.In net/slcompress.h
4832eef9aeSRuslan Ermilov.In netgraph/ng_vjc.h
494cf49a43SJulian Elischer.Sh DESCRIPTION
504cf49a43SJulian ElischerThe
514cf49a43SJulian Elischer.Nm vjc
529dcab530SArchie Cobbsnode type performs Van Jacobson compression, which is used
534cf49a43SJulian Elischerover PPP, SLIP, and other point-to-point IP connections to
545203edcdSRuslan Ermilovcompress TCP packet headers.
555203edcdSRuslan ErmilovThe
564cf49a43SJulian Elischer.Dv ip
574cf49a43SJulian Elischerhook represents the uncompressed side of the node, while the
584cf49a43SJulian Elischer.Dv vjcomp ,
594cf49a43SJulian Elischer.Dv vjuncomp ,
604cf49a43SJulian Elischerand
614cf49a43SJulian Elischer.Dv vjip
62b5e7e999SRuslan Ermilovhooks represent the compressed side of the node.
63b5e7e999SRuslan ErmilovPackets received on the
644cf49a43SJulian Elischer.Dv ip
65b5e7e999SRuslan Ermilovwill be compressed or passed through as appropriate.
66b5e7e999SRuslan ErmilovPackets received on the other three hooks will be uncompressed as appropriate.
6751291597SJulian ElischerThis node also supports
6851291597SJulian Elischer.Dq always pass through
6951291597SJulian Elischermode in either direction.
704cf49a43SJulian Elischer.Pp
719dcab530SArchie CobbsVan Jacobson compression only applies to TCP packets.
7251291597SJulian ElischerOnly
7351291597SJulian Elischer.Dq normal
7451291597SJulian Elischer(i.e., common case) TCP packets are actually compressed.
754cf49a43SJulian ElischerThese are output on the
764cf49a43SJulian Elischer.Dv vjcomp
77b5e7e999SRuslan Ermilovhook.
78b5e7e999SRuslan ErmilovOther TCP packets are run through the state machine but not
794cf49a43SJulian Elischercompressed; these appear on the
804cf49a43SJulian Elischer.Dv vjuncomp
814cf49a43SJulian Elischerhook.
824cf49a43SJulian ElischerOther non-TCP IP packets are forwarded unchanged to
834cf49a43SJulian Elischer.Dv vjip .
844cf49a43SJulian Elischer.Pp
854cf49a43SJulian ElischerWhen connecting to a
86bec35b9aSArchie Cobbs.Xr ng_ppp 4
874cf49a43SJulian Elischernode, the
88a14a0223SJulian Elischer.Dv ip ,
894cf49a43SJulian Elischer.Dv vjuncomp ,
904cf49a43SJulian Elischer.Dv vjcomp ,
914cf49a43SJulian Elischerand
924cf49a43SJulian Elischer.Dv vjip
930f9183beSArchie Cobbshooks should be connected to the
94bec35b9aSArchie Cobbs.Xr ng_ppp 4
954cf49a43SJulian Elischernode's
96a14a0223SJulian Elischer.Dv vjc_ip ,
97a14a0223SJulian Elischer.Dv vjc_vjcomp ,
98a14a0223SJulian Elischer.Dv vjc_vjuncomp ,
994cf49a43SJulian Elischerand
100a14a0223SJulian Elischer.Dv vjc_ip
1010f9183beSArchie Cobbshooks, respectively.
1024cf49a43SJulian Elischer.Sh HOOKS
1034cf49a43SJulian ElischerThis node type supports the following hooks:
104c60bda17SJoel Dahl.Bl -tag -width ".Va vjuncomp"
105c60bda17SJoel Dahl.It Va ip
1064cf49a43SJulian ElischerUpstream (uncompressed) IP packets.
107c60bda17SJoel Dahl.It Va vjcomp
1084cf49a43SJulian ElischerDownstream compressed TCP packets.
109c60bda17SJoel Dahl.It Va vjuncomp
1104cf49a43SJulian ElischerDownstream uncompressed TCP packets.
111c60bda17SJoel Dahl.It Va vjip
1124cf49a43SJulian ElischerDownstream uncompressed IP packets.
1133136363fSRuslan Ermilov.El
1144cf49a43SJulian Elischer.Sh CONTROL MESSAGES
1154cf49a43SJulian ElischerThis node type supports the generic control messages, plus the following:
1164cf49a43SJulian Elischer.Bl -tag -width foo
117c60bda17SJoel Dahl.It Dv NGM_VJC_SET_CONFIG Pq Ic setconfig
1184cf49a43SJulian ElischerThis command resets the compression state and configures it according
1194cf49a43SJulian Elischerto the supplied
1204cf49a43SJulian Elischer.Dv "struct ngm_vjc_config"
1215203edcdSRuslan Ermilovargument.
1225203edcdSRuslan ErmilovThis structure contains the following fields:
1234cf49a43SJulian Elischer.Bd -literal -offset 4n
1244cf49a43SJulian Elischerstruct ngm_vjc_config {
125a14a0223SJulian Elischer  u_char   enableComp;    /* Enable compression */
126a14a0223SJulian Elischer  u_char   enableDecomp;  /* Enable decompression */
12771cb548dSArchie Cobbs  u_char   maxChannel;    /* Number of outgoing channels - 1 */
1284cf49a43SJulian Elischer  u_char   compressCID;   /* OK to compress outgoing CID's */
1294cf49a43SJulian Elischer};
1304cf49a43SJulian Elischer.Ed
1314cf49a43SJulian Elischer.Pp
1324cf49a43SJulian ElischerWhen
133a14a0223SJulian Elischer.Dv enableComp
134a14a0223SJulian Elischeris set to zero, all packets received on the
1354cf49a43SJulian Elischer.Dv ip
136a14a0223SJulian Elischerhook are forwarded unchanged out the
1374cf49a43SJulian Elischer.Dv vjip
1385203edcdSRuslan Ermilovhook.
1395203edcdSRuslan ErmilovSimilarly, when
140a14a0223SJulian Elischer.Dv enableDecomp
141a14a0223SJulian Elischeris set to zero, all packets received on the
142a14a0223SJulian Elischer.Dv vjip
143a14a0223SJulian Elischerhook are forwarded unchanged out the
144a14a0223SJulian Elischer.Dv ip
145a14a0223SJulian Elischerhook, and packets are not accepted on the
146a14a0223SJulian Elischer.Dv vjcomp
147a14a0223SJulian Elischerand
148a14a0223SJulian Elischer.Dv vjuncomp
1494cf49a43SJulian Elischerhooks.
150a14a0223SJulian ElischerWhen a node is first created,
151a14a0223SJulian Elischerboth compression and decompression are disabled and the node is
15251291597SJulian Elischertherefore operating in bi-directional
15351291597SJulian Elischer.Dq pass through
15451291597SJulian Elischermode.
1554cf49a43SJulian Elischer.Pp
156a14a0223SJulian ElischerWhen enabling compression,
15771cb548dSArchie Cobbs.Dv maxChannel
15871cb548dSArchie Cobbsshould be set to the number of outgoing compression channels minus one,
159b5e7e999SRuslan Ermilovand is a value between 3 and 15, inclusive.
160b5e7e999SRuslan ErmilovThe
1614cf49a43SJulian Elischer.Dv compressCID
1620f9183beSArchie Cobbsfield indicates whether it is OK to compress the CID header field for
163b5e7e999SRuslan Ermilovoutgoing compressed TCP packets.
164b5e7e999SRuslan ErmilovThis value should be zero unless
1650f9183beSArchie Cobbseither (a) it is not possible for an outgoing frame to be lost, or
1660f9183beSArchie Cobbs(b) lost frames can be reliably detected and immediately
1670f9183beSArchie Cobbsreported to the peer's decompression engine (see
1684cf49a43SJulian Elischer.Dv NGM_VJC_RECV_ERROR
1690f9183beSArchie Cobbsbelow).
170c60bda17SJoel Dahl.It Dv NGM_VJC_GET_STATE Pq Ic getstate
1714cf49a43SJulian ElischerThis command returns the node's current state described by the
1724cf49a43SJulian Elischer.Dv "struct slcompress"
1734cf49a43SJulian Elischerstructure, which is defined in
174743d5d51SRuslan Ermilov.In net/slcompress.h .
175c60bda17SJoel Dahl.It Dv NGM_VJC_CLR_STATS Pq Ic clrstats
176b5e7e999SRuslan ErmilovClears the node statistics counters.
177b5e7e999SRuslan ErmilovStatistics are also cleared whenever the
178a14a0223SJulian Elischer.Dv enableComp
179a14a0223SJulian Elischeror
180a14a0223SJulian Elischer.Dv enableDecomp
181a14a0223SJulian Elischerfields are changed from zero to one by a
182a14a0223SJulian Elischer.Dv NGM_VJC_SET_CONFIG
1834cf49a43SJulian Elischercontrol message.
184c60bda17SJoel Dahl.It Dv NGM_VJC_RECV_ERROR Pq Ic recverror
1850f9183beSArchie CobbsWhen the peer has CID header field compression enabled,
1860f9183beSArchie Cobbsthis message must be sent to the local
1870f9183beSArchie Cobbs.Nm vjc
1880f9183beSArchie Cobbsnode immediately
1897f9d26bdSMike Pritchardafter detecting that a received frame has been lost, due to a bad
190b5e7e999SRuslan Ermilovchecksum or for any other reason.
191b5e7e999SRuslan ErmilovFailing to do this can result in corrupted TCP stream data.
1923136363fSRuslan Ermilov.El
1934cf49a43SJulian Elischer.Sh SHUTDOWN
1944cf49a43SJulian ElischerThis node shuts down upon receipt of a
1954cf49a43SJulian Elischer.Dv NGM_SHUTDOWN
1964cf49a43SJulian Elischercontrol message, or when all hooks have been disconnected.
1974cf49a43SJulian Elischer.Sh SEE ALSO
1984cf49a43SJulian Elischer.Xr netgraph 4 ,
199bec35b9aSArchie Cobbs.Xr ng_iface 4 ,
2005521ff5aSRuslan Ermilov.Xr ng_ppp 4 ,
201bec35b9aSArchie Cobbs.Xr ngctl 8
2024cf49a43SJulian Elischer.Rs
2039dcab530SArchie Cobbs.%A V. Jacobson
2044cf49a43SJulian Elischer.%T "Compressing TCP/IP Headers"
2054cf49a43SJulian Elischer.%O RFC 1144
2064cf49a43SJulian Elischer.Re
2074cf49a43SJulian Elischer.Rs
2084cf49a43SJulian Elischer.%A G. McGregor
2094cf49a43SJulian Elischer.%T "The PPP Internet Control Protocol (IPCP)"
2104cf49a43SJulian Elischer.%O RFC 1332
2114cf49a43SJulian Elischer.Re
21251291597SJulian Elischer.Sh HISTORY
21351291597SJulian ElischerThe
21451291597SJulian Elischer.Nm
21551291597SJulian Elischernode type was implemented in
21651291597SJulian Elischer.Fx 4.0 .
21751291597SJulian Elischer.Sh AUTHORS
218*6c899950SBaptiste Daroussin.An Archie Cobbs Aq Mt archie@FreeBSD.org
2199cbda590SRuslan Ermilov.Sh BUGS
2209cbda590SRuslan ErmilovAs the initialization routine in the kernel implementation of
2219cbda590SRuslan ErmilovVan Jacobson compression initializes both compression and decompression
2229cbda590SRuslan Ermilovat once, this node does not allow compression and decompression to
2239cbda590SRuslan Ermilovbe enabled in separate operations.
2249cbda590SRuslan ErmilovIn order to enable one when
2259cbda590SRuslan Ermilovthe other is already enabled, first both must be disabled, then
2269cbda590SRuslan Ermilovboth enabled.
2279cbda590SRuslan ErmilovThis of course resets the node state.
2289cbda590SRuslan ErmilovThis restriction may be lifted in a later version.
2299cbda590SRuslan Ermilov.Pp
2309cbda590SRuslan ErmilovWhen built as a loadable kernel module, this module includes the file
2319cbda590SRuslan Ermilov.Pa net/slcompress.c .
2329cbda590SRuslan ErmilovAlthough loading the module should fail if
2339cbda590SRuslan Ermilov.Pa net/slcompress.c
2349cbda590SRuslan Ermilovalready exists in the kernel, currently it does not, and the duplicate
2359cbda590SRuslan Ermilovcopies of the file do not interfere.
2369cbda590SRuslan ErmilovHowever, this may change in the future.
237