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.\" 35.\" $FreeBSD$ 36.\" $Whistle: ng_vjc.8,v 1.4 1999/01/25 23:46:28 archie Exp $ 37.\" 38.Dd January 19, 1999 39.Dt NG_VJC 4 40.Os 41.Sh NAME 42.Nm ng_vjc 43.Nd Van Jacobson compression netgraph node type 44.Sh SYNOPSIS 45.In net/slcompress.h 46.In netgraph/ng_vjc.h 47.Sh DESCRIPTION 48The 49.Nm vjc 50node type performs Van Jacobson compression, which is used 51over PPP, SLIP, and other point-to-point IP connections to 52compress TCP packet headers. The 53.Dv ip 54hook represents the uncompressed side of the node, while the 55.Dv vjcomp , 56.Dv vjuncomp , 57and 58.Dv vjip 59hooks represent the compressed side of the node. 60Packets received on the 61.Dv ip 62will be compressed or passed through as appropriate. 63Packets received on the other three hooks will be uncompressed as appropriate. 64This node also supports 65.Dq always pass through 66mode in either direction. 67.Pp 68Van Jacobson compression only applies to TCP packets. 69Only 70.Dq normal 71(i.e., common case) TCP packets are actually compressed. 72These are output on the 73.Dv vjcomp 74hook. 75Other TCP packets are run through the state machine but not 76compressed; these appear on the 77.Dv vjuncomp 78hook. 79Other non-TCP IP packets are forwarded unchanged to 80.Dv vjip . 81.Pp 82When connecting to a 83.Xr ng_ppp 4 84node, the 85.Dv ip , 86.Dv vjuncomp , 87.Dv vjcomp , 88and 89.Dv vjip 90hooks should be connected to the 91.Xr ng_ppp 4 92node's 93.Dv vjc_ip , 94.Dv vjc_vjcomp , 95.Dv vjc_vjuncomp , 96and 97.Dv vjc_ip 98hooks, respectively. 99.Sh HOOKS 100This node type supports the following hooks: 101.Pp 102.Bl -tag -width foobarbazi 103.It Dv ip 104Upstream (uncompressed) IP packets. 105.It Dv vjcomp 106Downstream compressed TCP packets. 107.It Dv vjuncomp 108Downstream uncompressed TCP packets. 109.It Dv vjip 110Downstream uncompressed IP packets. 111.El 112.Sh CONTROL MESSAGES 113This node type supports the generic control messages, plus the following: 114.Bl -tag -width foo 115.It Dv NGM_VJC_SET_CONFIG 116This command resets the compression state and configures it according 117to the supplied 118.Dv "struct ngm_vjc_config" 119argument. This structure contains the following fields: 120.Bd -literal -offset 4n 121struct ngm_vjc_config { 122 u_char enableComp; /* Enable compression */ 123 u_char enableDecomp; /* Enable decompression */ 124 u_char maxChannel; /* Number of outgoing channels - 1 */ 125 u_char compressCID; /* OK to compress outgoing CID's */ 126}; 127.Ed 128.Pp 129When 130.Dv enableComp 131is set to zero, all packets received on the 132.Dv ip 133hook are forwarded unchanged out the 134.Dv vjip 135hook. Similarly, when 136.Dv enableDecomp 137is set to zero, all packets received on the 138.Dv vjip 139hook are forwarded unchanged out the 140.Dv ip 141hook, and packets are not accepted on the 142.Dv vjcomp 143and 144.Dv vjuncomp 145hooks. 146When a node is first created, 147both compression and decompression are disabled and the node is 148therefore operating in bi-directional 149.Dq pass through 150mode. 151.Pp 152When enabling compression, 153.Dv maxChannel 154should be set to the number of outgoing compression channels minus one, 155and is a value between 3 and 15, inclusive. 156The 157.Dv compressCID 158field indicates whether it is OK to compress the CID header field for 159outgoing compressed TCP packets. 160This value should be zero unless 161either (a) it is not possible for an outgoing frame to be lost, or 162(b) lost frames can be reliably detected and immediately 163reported to the peer's decompression engine (see 164.Dv NGM_VJC_RECV_ERROR 165below). 166.It Dv NGM_VJC_GET_STATE 167This command returns the node's current state described by the 168.Dv "struct slcompress" 169structure, which is defined in 170.In net/slcompress.h . 171.It Dv NGM_VJC_CLR_STATS 172Clears the node statistics counters. 173Statistics are also cleared whenever the 174.Dv enableComp 175or 176.Dv enableDecomp 177fields are changed from zero to one by a 178.Dv NGM_VJC_SET_CONFIG 179control message. 180.It Dv NGM_VJC_RECV_ERROR 181When the peer has CID header field compression enabled, 182this message must be sent to the local 183.Nm vjc 184node immediately 185after detecting that a received frame has been lost, due to a bad 186checksum or for any other reason. 187Failing to do this can result in corrupted TCP stream data. 188.El 189.Sh SHUTDOWN 190This node shuts down upon receipt of a 191.Dv NGM_SHUTDOWN 192control message, or when all hooks have been disconnected. 193.Sh BUGS 194As the initialization routine in the kernel implementation of 195Van Jacobson compression initializes both compression and decompression 196at once, this node does not allow compression and decompression to 197be enabled in separate operations. 198In order to enable one when 199the other is already enabled, first both must be disabled, then 200both enabled. 201This of course resets the node state. 202This restriction may be lifted in a later version. 203.Pp 204When built as a loadable kernel module, this module includes the file 205.Pa net/slcompress.c . 206Although loading the module should fail if 207.Pa net/slcompress.c 208already exists in the kernel, currently it does not, and the duplicate 209copies of the file do not interfere. 210However, this may change in the future. 211.Sh SEE ALSO 212.Xr netgraph 4 , 213.Xr ng_iface 4 , 214.Xr ng_ppp 4 , 215.Xr ngctl 8 216.Rs 217.%A V. Jacobson 218.%T "Compressing TCP/IP Headers" 219.%O RFC 1144 220.Re 221.Rs 222.%A G. McGregor 223.%T "The PPP Internet Control Protocol (IPCP)" 224.%O RFC 1332 225.Re 226.Sh HISTORY 227The 228.Nm 229node type was implemented in 230.Fx 4.0 . 231.Sh AUTHORS 232.An Archie Cobbs Aq archie@FreeBSD.org 233