168161616SGleb Smirnoff.\" 268161616SGleb Smirnoff.\" Copyright (c) 2006, Alexander Motin <mav@alkar.net> 368161616SGleb Smirnoff.\" All rights reserved. 468161616SGleb Smirnoff.\" 568161616SGleb Smirnoff.\" Redistribution and use in source and binary forms, with or without 668161616SGleb Smirnoff.\" modification, are permitted provided that the following conditions 768161616SGleb Smirnoff.\" are met: 868161616SGleb Smirnoff.\" 1. Redistributions of source code must retain the above copyright 968161616SGleb Smirnoff.\" notice unmodified, this list of conditions, and the following 1068161616SGleb Smirnoff.\" disclaimer. 1168161616SGleb Smirnoff.\" 2. Redistributions in binary form must reproduce the above copyright 1268161616SGleb Smirnoff.\" notice, this list of conditions and the following disclaimer in the 1368161616SGleb Smirnoff.\" documentation and/or other materials provided with the distribution. 1468161616SGleb Smirnoff.\" 1568161616SGleb Smirnoff.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1668161616SGleb Smirnoff.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1768161616SGleb Smirnoff.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1868161616SGleb Smirnoff.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1968161616SGleb Smirnoff.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2068161616SGleb Smirnoff.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2168161616SGleb Smirnoff.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2268161616SGleb Smirnoff.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2368161616SGleb Smirnoff.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2468161616SGleb Smirnoff.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2568161616SGleb Smirnoff.\" SUCH DAMAGE. 2668161616SGleb Smirnoff.\" 2768161616SGleb Smirnoff.\" $FreeBSD$ 2868161616SGleb Smirnoff.\" 2968161616SGleb Smirnoff.Dd December 24, 2006 3068161616SGleb Smirnoff.Dt NG_PRED1 4 3168161616SGleb Smirnoff.Os 3268161616SGleb Smirnoff.Sh NAME 3368161616SGleb Smirnoff.Nm ng_pred1 3468161616SGleb Smirnoff.Nd Predictor-1 PPP compression (RFC 1978) netgraph node type 3568161616SGleb Smirnoff.Sh SYNOPSIS 3668161616SGleb Smirnoff.In sys/types.h 3768161616SGleb Smirnoff.In netgraph/ng_pred1.h 3868161616SGleb Smirnoff.Sh DESCRIPTION 3968161616SGleb SmirnoffThe 4068161616SGleb Smirnoff.Nm pred1 4168161616SGleb Smirnoffnode type implements the Predictor-1 sub-protocols of the Compression Control 4268161616SGleb SmirnoffProtocol (CCP). 4368161616SGleb Smirnoff.Pp 4468161616SGleb SmirnoffThe node has two hooks, 4568161616SGleb Smirnoff.Va comp 4668161616SGleb Smirnofffor compression and 4768161616SGleb Smirnoff.Va decomp 4868161616SGleb Smirnofffor decompression. 4968161616SGleb SmirnoffOnly one of them can be connected at the same time, specifying node's 5068161616SGleb Smirnoffoperation mode. 5168161616SGleb SmirnoffTypically that hooks would be connected to the 5268161616SGleb Smirnoff.Xr ng_ppp 4 5368161616SGleb Smirnoffnode type hook of the same name. 5468161616SGleb Smirnoff.Sh HOOKS 5568161616SGleb SmirnoffThis node type supports the following hooks: 5668161616SGleb Smirnoff.Pp 57*c60bda17SJoel Dahl.Bl -tag -compact -width ".Va decomp" 5868161616SGleb Smirnoff.It Va comp 5968161616SGleb SmirnoffConnection to 6068161616SGleb Smirnoff.Xr ng_ppp 4 6168161616SGleb Smirnoff.Va compress 6268161616SGleb Smirnoffhook. 6368161616SGleb SmirnoffIncoming frames are compressed and sent back out the same hook. 6468161616SGleb Smirnoff.It Va decomp 6568161616SGleb SmirnoffConnection to 6668161616SGleb Smirnoff.Xr ng_ppp 4 6768161616SGleb Smirnoff.Va decompress 6868161616SGleb Smirnoffhook. 6968161616SGleb SmirnoffIncoming frames are decompressed and sent back out the same hook. 7068161616SGleb Smirnoff.El 7168161616SGleb Smirnoff.Pp 7268161616SGleb SmirnoffOnly one hook can be connected at the same time, 7368161616SGleb Smirnoffspecifying node's operation mode. 7468161616SGleb Smirnoff.Sh CONTROL MESSAGES 7568161616SGleb SmirnoffThis node type supports the generic control messages, plus the following: 7668161616SGleb Smirnoff.Bl -tag -width foo 77*c60bda17SJoel Dahl.It Dv NGM_PRED1_CONFIG Pq Ic config 7868161616SGleb SmirnoffThis command resets and configures the node for a session 7968161616SGleb Smirnoff(i.e., for compression or decompression). 8068161616SGleb SmirnoffThis command takes a 8168161616SGleb Smirnoff.Vt "struct ng_pred1_config" 8268161616SGleb Smirnoffas an argument: 8368161616SGleb Smirnoff.Bd -literal -offset 0n 8468161616SGleb Smirnoffstruct ng_pred1_config { 8568161616SGleb Smirnoff u_char enable; /* node enabled */ 8668161616SGleb Smirnoff}; 8768161616SGleb Smirnoff.Ed 8868161616SGleb SmirnoffThe 8968161616SGleb Smirnoff.Ft enable 9068161616SGleb Smirnofffield enables traffic flow through the node. 91*c60bda17SJoel Dahl.It Dv NGM_PRED1_RESETREQ Pq Ic resetreq 9268161616SGleb SmirnoffThis message contains no arguments, and is bi-directional. 9368161616SGleb SmirnoffIf an error is detected during decompression, this message is sent by the 9468161616SGleb Smirnoffnode to the originator of the 9568161616SGleb Smirnoff.Dv NGM_PRED1_CONFIG 9668161616SGleb Smirnoffmessage that initiated the session. 9768161616SGleb SmirnoffThe receiver should respond by sending a PPP CCP Reset-Request to the peer. 9868161616SGleb Smirnoff.Pp 9968161616SGleb SmirnoffThis message may also be received by this node type when a CCP Reset-Request 10068161616SGleb Smirnoffor Reset-Ack is received by the local PPP entity. 10168161616SGleb SmirnoffThe node will respond by flushing its compression state so the sides 10268161616SGleb Smirnoffcan resynchronize. 103*c60bda17SJoel Dahl.It Dv NGM_PRED1_GET_STATS Pq Ic getstats 10468161616SGleb SmirnoffThis control message obtains statistics for a given hook. 10568161616SGleb SmirnoffThe statistics are returned in 10668161616SGleb Smirnoff.Vt "struct ng_pred1_stats" : 10768161616SGleb Smirnoff.Bd -literal 10868161616SGleb Smirnoffstruct ng_pred1_stats { 10968161616SGleb Smirnoff uint64_t FramesPlain; 11068161616SGleb Smirnoff uint64_t FramesComp; 11168161616SGleb Smirnoff uint64_t FramesUncomp; 11268161616SGleb Smirnoff uint64_t InOctets; 11368161616SGleb Smirnoff uint64_t OutOctets; 11468161616SGleb Smirnoff uint64_t Errors; 11568161616SGleb Smirnoff}; 11668161616SGleb Smirnoff.Ed 117*c60bda17SJoel Dahl.It Dv NGM_PRED1_CLR_STATS Pq Ic clrstats 11868161616SGleb SmirnoffThis control message clears statistics for a given hook. 119*c60bda17SJoel Dahl.It Dv NGM_PRED1_GETCLR_STATS Pq Ic getclrstats 12068161616SGleb SmirnoffThis control message obtains and clears statistics for a given hook. 12168161616SGleb Smirnoff.El 12268161616SGleb Smirnoff.Sh SHUTDOWN 12368161616SGleb SmirnoffThis node shuts down upon receipt of a 12468161616SGleb Smirnoff.Dv NGM_SHUTDOWN 12568161616SGleb Smirnoffcontrol message, or when hook have been disconnected. 12668161616SGleb Smirnoff.Sh SEE ALSO 12768161616SGleb Smirnoff.Xr netgraph 4 , 12868161616SGleb Smirnoff.Xr ng_ppp 4 , 12968161616SGleb Smirnoff.Xr ngctl 8 13068161616SGleb Smirnoff.Rs 13168161616SGleb Smirnoff.%A D. Rand 13268161616SGleb Smirnoff.%T "PPP Predictor Compression Protocol" 13368161616SGleb Smirnoff.%O RFC 1978 13468161616SGleb Smirnoff.Re 13568161616SGleb Smirnoff.Rs 13668161616SGleb Smirnoff.%A W. Simpson 13768161616SGleb Smirnoff.%T "The Point-to-Point Protocol (PPP)" 13868161616SGleb Smirnoff.%O RFC 1661 13968161616SGleb Smirnoff.Re 14068161616SGleb Smirnoff.Sh AUTHORS 14168161616SGleb Smirnoff.An Alexander Motin Aq mav@alkar.net 14268161616SGleb Smirnoff.Sh BUGS 14368161616SGleb SmirnoffDue to nature of netgraph PPP implementation there are possible race conditions 14468161616SGleb Smirnoffbetween data packet and ResetAck CCP packet in case of packet loss. As result, 14568161616SGleb Smirnoffpacket loss can produce bigger performance degradation than supposed by protocol. 146