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.Dd December 24, 2006 2868161616SGleb Smirnoff.Dt NG_PRED1 4 2968161616SGleb Smirnoff.Os 3068161616SGleb Smirnoff.Sh NAME 3168161616SGleb Smirnoff.Nm ng_pred1 3268161616SGleb Smirnoff.Nd Predictor-1 PPP compression (RFC 1978) netgraph node type 3368161616SGleb Smirnoff.Sh SYNOPSIS 3468161616SGleb Smirnoff.In sys/types.h 3568161616SGleb Smirnoff.In netgraph/ng_pred1.h 3668161616SGleb Smirnoff.Sh DESCRIPTION 3768161616SGleb SmirnoffThe 3868161616SGleb Smirnoff.Nm pred1 3968161616SGleb Smirnoffnode type implements the Predictor-1 sub-protocols of the Compression Control 4068161616SGleb SmirnoffProtocol (CCP). 4168161616SGleb Smirnoff.Pp 4268161616SGleb SmirnoffThe node has two hooks, 4368161616SGleb Smirnoff.Va comp 4468161616SGleb Smirnofffor compression and 4568161616SGleb Smirnoff.Va decomp 4668161616SGleb Smirnofffor decompression. 4768161616SGleb SmirnoffOnly one of them can be connected at the same time, specifying node's 4868161616SGleb Smirnoffoperation mode. 4968161616SGleb SmirnoffTypically that hooks would be connected to the 5068161616SGleb Smirnoff.Xr ng_ppp 4 5168161616SGleb Smirnoffnode type hook of the same name. 5268161616SGleb Smirnoff.Sh HOOKS 5368161616SGleb SmirnoffThis node type supports the following hooks: 5468161616SGleb Smirnoff.Pp 55c60bda17SJoel Dahl.Bl -tag -compact -width ".Va decomp" 5668161616SGleb Smirnoff.It Va comp 5768161616SGleb SmirnoffConnection to 5868161616SGleb Smirnoff.Xr ng_ppp 4 5968161616SGleb Smirnoff.Va compress 6068161616SGleb Smirnoffhook. 6168161616SGleb SmirnoffIncoming frames are compressed and sent back out the same hook. 6268161616SGleb Smirnoff.It Va decomp 6368161616SGleb SmirnoffConnection to 6468161616SGleb Smirnoff.Xr ng_ppp 4 6568161616SGleb Smirnoff.Va decompress 6668161616SGleb Smirnoffhook. 6768161616SGleb SmirnoffIncoming frames are decompressed and sent back out the same hook. 6868161616SGleb Smirnoff.El 6968161616SGleb Smirnoff.Pp 7068161616SGleb SmirnoffOnly one hook can be connected at the same time, 7168161616SGleb Smirnoffspecifying node's operation mode. 7268161616SGleb Smirnoff.Sh CONTROL MESSAGES 7368161616SGleb SmirnoffThis node type supports the generic control messages, plus the following: 7468161616SGleb Smirnoff.Bl -tag -width foo 75c60bda17SJoel Dahl.It Dv NGM_PRED1_CONFIG Pq Ic config 7668161616SGleb SmirnoffThis command resets and configures the node for a session 7768161616SGleb Smirnoff(i.e., for compression or decompression). 7868161616SGleb SmirnoffThis command takes a 7968161616SGleb Smirnoff.Vt "struct ng_pred1_config" 8068161616SGleb Smirnoffas an argument: 8168161616SGleb Smirnoff.Bd -literal -offset 0n 8268161616SGleb Smirnoffstruct ng_pred1_config { 8368161616SGleb Smirnoff u_char enable; /* node enabled */ 8468161616SGleb Smirnoff}; 8568161616SGleb Smirnoff.Ed 8668161616SGleb SmirnoffThe 8768161616SGleb Smirnoff.Ft enable 8868161616SGleb Smirnofffield enables traffic flow through the node. 89c60bda17SJoel Dahl.It Dv NGM_PRED1_RESETREQ Pq Ic resetreq 9068161616SGleb SmirnoffThis message contains no arguments, and is bi-directional. 9168161616SGleb SmirnoffIf an error is detected during decompression, this message is sent by the 9268161616SGleb Smirnoffnode to the originator of the 9368161616SGleb Smirnoff.Dv NGM_PRED1_CONFIG 9468161616SGleb Smirnoffmessage that initiated the session. 9568161616SGleb SmirnoffThe receiver should respond by sending a PPP CCP Reset-Request to the peer. 9668161616SGleb Smirnoff.Pp 9768161616SGleb SmirnoffThis message may also be received by this node type when a CCP Reset-Request 9868161616SGleb Smirnoffor Reset-Ack is received by the local PPP entity. 9968161616SGleb SmirnoffThe node will respond by flushing its compression state so the sides 10068161616SGleb Smirnoffcan resynchronize. 101c60bda17SJoel Dahl.It Dv NGM_PRED1_GET_STATS Pq Ic getstats 10268161616SGleb SmirnoffThis control message obtains statistics for a given hook. 10368161616SGleb SmirnoffThe statistics are returned in 10468161616SGleb Smirnoff.Vt "struct ng_pred1_stats" : 10568161616SGleb Smirnoff.Bd -literal 10668161616SGleb Smirnoffstruct ng_pred1_stats { 10768161616SGleb Smirnoff uint64_t FramesPlain; 10868161616SGleb Smirnoff uint64_t FramesComp; 10968161616SGleb Smirnoff uint64_t FramesUncomp; 11068161616SGleb Smirnoff uint64_t InOctets; 11168161616SGleb Smirnoff uint64_t OutOctets; 11268161616SGleb Smirnoff uint64_t Errors; 11368161616SGleb Smirnoff}; 11468161616SGleb Smirnoff.Ed 115c60bda17SJoel Dahl.It Dv NGM_PRED1_CLR_STATS Pq Ic clrstats 11668161616SGleb SmirnoffThis control message clears statistics for a given hook. 117c60bda17SJoel Dahl.It Dv NGM_PRED1_GETCLR_STATS Pq Ic getclrstats 11868161616SGleb SmirnoffThis control message obtains and clears statistics for a given hook. 11968161616SGleb Smirnoff.El 12068161616SGleb Smirnoff.Sh SHUTDOWN 12168161616SGleb SmirnoffThis node shuts down upon receipt of a 12268161616SGleb Smirnoff.Dv NGM_SHUTDOWN 12368161616SGleb Smirnoffcontrol message, or when hook have been disconnected. 12468161616SGleb Smirnoff.Sh SEE ALSO 12568161616SGleb Smirnoff.Xr netgraph 4 , 12668161616SGleb Smirnoff.Xr ng_ppp 4 , 12768161616SGleb Smirnoff.Xr ngctl 8 12868161616SGleb Smirnoff.Rs 12968161616SGleb Smirnoff.%A D. Rand 13068161616SGleb Smirnoff.%T "PPP Predictor Compression Protocol" 13168161616SGleb Smirnoff.%O RFC 1978 13268161616SGleb Smirnoff.Re 13368161616SGleb Smirnoff.Rs 13468161616SGleb Smirnoff.%A W. Simpson 13568161616SGleb Smirnoff.%T "The Point-to-Point Protocol (PPP)" 13668161616SGleb Smirnoff.%O RFC 1661 13768161616SGleb Smirnoff.Re 13868161616SGleb Smirnoff.Sh AUTHORS 1396c899950SBaptiste Daroussin.An Alexander Motin Aq Mt mav@alkar.net 14068161616SGleb Smirnoff.Sh BUGS 14168161616SGleb SmirnoffDue to nature of netgraph PPP implementation there are possible race conditions 142*25972509SEdward Tomasz Napieralabetween data packet and ResetAck CCP packet in case of packet loss. 143*25972509SEdward Tomasz NapieralaAs result, 14468161616SGleb Smirnoffpacket loss can produce bigger performance degradation than supposed by protocol. 145