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.\" 334cf49a43SJulian Elischer.\" Author: Archie Cobbs <archie@whistle.com> 344cf49a43SJulian Elischer.\" 354cf49a43SJulian Elischer.\" $FreeBSD$ 364cf49a43SJulian Elischer.\" $Whistle: ng_ppp.8,v 1.3 1999/01/25 23:46:27 archie Exp $ 374cf49a43SJulian Elischer.\" 384cf49a43SJulian Elischer.Dd January 19, 1999 394cf49a43SJulian Elischer.Dt NG_PPP 8 4010c2a9dbSArchie Cobbs.Os FreeBSD 414cf49a43SJulian Elischer.Sh NAME 424cf49a43SJulian Elischer.Nm ng_ppp 4310c2a9dbSArchie Cobbs.Nd PPP protocol netgraph node type 444cf49a43SJulian Elischer.Sh SYNOPSIS 454cf49a43SJulian Elischer.Fd #include <netgraph/ng_ppp.h> 464cf49a43SJulian Elischer.Sh DESCRIPTION 474cf49a43SJulian ElischerThe 484cf49a43SJulian Elischer.Nm ppp 4910c2a9dbSArchie Cobbsnode type performs multiplexing for the PPP protocol. It handles 5010c2a9dbSArchie Cobbsonly packets that contain data, and forwards protocol negotiation 5110c2a9dbSArchie Cobbsand control packets to a separate controlling entity (e.g., a 5210c2a9dbSArchie Cobbsuser-land daemon). This approach combines the fast dispatch of 5310c2a9dbSArchie Cobbskernel implementations with the configuration flexibility of a 5410c2a9dbSArchie Cobbsuser-land implementations. The PPP node type supports multi-link 5510c2a9dbSArchie CobbsPPP, Van Jacobsen compression, PPP compression, and PPP encryption. 5610c2a9dbSArchie CobbsA single PPP node corresponds to one PPP multi-link bundle. 5710c2a9dbSArchie Cobbs.Sh ENABLING FUNCTIONALITY 5810c2a9dbSArchie CobbsIn general, the PPP node enables a specific link or functionality when 5910c2a9dbSArchie Cobbs(a) a 6010c2a9dbSArchie Cobbs.Dv NGM_PPP_SET_CONFIG 6110c2a9dbSArchie Cobbsmessage has been received which enables it, and 6210c2a9dbSArchie Cobbs(b) the corresponding hook(s) are connected. 6310c2a9dbSArchie CobbsThis allows the controlling entity to use either method (a) or (b) 6410c2a9dbSArchie Cobbs(or both) to control the node's behavior. 6510c2a9dbSArchie Cobbs.Sh LINK HOOKS 6610c2a9dbSArchie CobbsDuring normal operation, the individual PPP links are connected to hooks 6710c2a9dbSArchie Cobbs.Dv link0 , 6810c2a9dbSArchie Cobbs.Dv link1 , 6910c2a9dbSArchie Cobbsetc. Up to 7010c2a9dbSArchie Cobbs.Dv NG_PPP_MAX_LINKS 7110c2a9dbSArchie Cobbslinks are supported. 7210c2a9dbSArchie CobbsThese device-independent hooks transmit and receive full PPP 7310c2a9dbSArchie Cobbsframes, which include the PPP protocol field, but no address, control 7410c2a9dbSArchie Cobbsor checksum fields. 7510c2a9dbSArchie CobbsOn outgoing frames, when protocol compression 7610c2a9dbSArchie Cobbshas been enabled and the protocol number is suitable for compression, 7710c2a9dbSArchie Cobbsthe protocol field will be compressed (i.e., sent as one byte 7810c2a9dbSArchie Cobbsinstead of two). Either compressed or uncompressed protocol fields 7910c2a9dbSArchie Cobbsare accepted on incoming frames. 804cf49a43SJulian Elischer.Pp 8110c2a9dbSArchie CobbsSince all negotiation is handled outside the PPP node, the links 8210c2a9dbSArchie Cobbsshould not be connected and enabled until the corresponding link 8310c2a9dbSArchie Cobbshas reached the network phase (i.e., LCP negotiation and authentication 8410c2a9dbSArchie Cobbshave completed successfully) and the PPP node has been informed of 8510c2a9dbSArchie Cobbsthe link parameters via the 8610c2a9dbSArchie Cobbs.Dv NGM_PPP_LINK_CONFIG 8710c2a9dbSArchie Cobbsmessage. 8810c2a9dbSArchie Cobbs.Sh COMPRESSION AND ENCRYPTION 894cf49a43SJulian Elischer.Pp 9010c2a9dbSArchie CobbsCompression is supported via two hooks, 9110c2a9dbSArchie Cobbs.Dv compress 9210c2a9dbSArchie Cobbsand 9310c2a9dbSArchie Cobbs.Dv decompress . 9410c2a9dbSArchie CobbsWhen enabled and connected, the PPP node writes outgoing frames on the 9510c2a9dbSArchie Cobbs.Dv comp 9610c2a9dbSArchie Cobbshook and expects to receive back the compressed frame on the same hook. 9710c2a9dbSArchie CobbsSimilarly, the 9810c2a9dbSArchie Cobbs.Dv decompress 9910c2a9dbSArchie Cobbshook is used to uncompress incoming frames when decompression is 1007f9d26bdSMike Pritchardnegotiated (compression and decompression are independently negotiable). 10110c2a9dbSArchie CobbsThe type of node attached to these hooks should correspond 10210c2a9dbSArchie Cobbsto the type of compression negotiated, e.g., Deflate, Predictor-1, etc. 10310c2a9dbSArchie Cobbs.Pp 10410c2a9dbSArchie CobbsEncryption works exactly analogously via the 10510c2a9dbSArchie Cobbs.Dv encrypt 10610c2a9dbSArchie Cobbsand 10710c2a9dbSArchie Cobbs.Dv decrypt 10810c2a9dbSArchie Cobbsnodes. Data is always compressed before being encrypted, 10910c2a9dbSArchie Cobbsand decrypted before being decompressed. 11010c2a9dbSArchie Cobbs.Pp 11110c2a9dbSArchie CobbsOnly bundle-level compression and encryption is directly supported; 11210c2a9dbSArchie Cobbslink-level compression and encryption can be handled transparently 11310c2a9dbSArchie Cobbsby downstream nodes. 11410c2a9dbSArchie Cobbs.Sh VAN JACOBSEN COMPRESSION 11510c2a9dbSArchie CobbsWhen all of the 11610c2a9dbSArchie Cobbs.Dv vjc_ip , 11710c2a9dbSArchie Cobbs.Dv vjc_vjcomp , 11810c2a9dbSArchie Cobbs.Dv vjc_vjuncomp , 11910c2a9dbSArchie Cobbsand 12010c2a9dbSArchie Cobbs.Dv vjc_vjip 12110c2a9dbSArchie Cobbshooks are connected, and the corresponding configuration flag is 12210c2a9dbSArchie Cobbsenabled, Van Jacobsen compression and/or decompression will become active. 12310c2a9dbSArchie CobbsNormally these hooks connect to the corresponding hooks of a single 12410c2a9dbSArchie Cobbs.Xr ng_vjc 8 12510c2a9dbSArchie Cobbsnode. The PPP node is compatible with the ``pass through'' modes of the 12610c2a9dbSArchie Cobbs.Xr ng_vjc 8 12710c2a9dbSArchie Cobbsnode type. 12810c2a9dbSArchie Cobbs.Sh BYPASS HOOK 12910c2a9dbSArchie CobbsWhen a frame is received on a link with an unsupported protocol, 13010c2a9dbSArchie Cobbsor a protocol which is disabled or for which the corresponding hook 13110c2a9dbSArchie Cobbsis unconnected, the PPP node forwards the frame out the 1324cf49a43SJulian Elischer.Dv bypass 13310c2a9dbSArchie Cobbshook, prepended with a four byte prefix. This first two bytes of 13410c2a9dbSArchie Cobbsthe prefix indicate the link number on which the frame was received 13510c2a9dbSArchie Cobbs(in network order). 13610c2a9dbSArchie CobbsFor such frames received over the bundle (i.e., encapsulated in the 13710c2a9dbSArchie Cobbsmulti-link protocol), the special link number 13810c2a9dbSArchie Cobbs.Dv NG_PPP_BUNDLE_LINKNUM 13910c2a9dbSArchie Cobbsis used. After the two byte link number is the two byte PPP protocol number 14010c2a9dbSArchie Cobbs(also in network order). 14110c2a9dbSArchie CobbsThe PPP protocol number is two bytes long even if the original frame 14210c2a9dbSArchie Cobbswas protocol compressed. 1434cf49a43SJulian Elischer.Pp 14410c2a9dbSArchie CobbsConversely, any data written to the 1454cf49a43SJulian Elischer.Dv bypass 14610c2a9dbSArchie Cobbshook is assumed to be in this same format. The four byte header is 14710c2a9dbSArchie Cobbsstripped off, the PPP protocol number is prepended (possibly compressed), 14810c2a9dbSArchie Cobbsand the frame is delivered over the desired link. 14910c2a9dbSArchie CobbsIf the link number is 15010c2a9dbSArchie Cobbs.Dv NG_PPP_BUNDLE_LINKNUM 15110c2a9dbSArchie Cobbsthe frame will be delivered over the multi-link bundle; or, if multi-link 15210c2a9dbSArchie Cobbsis disabled, over the (single) PPP link. 15310c2a9dbSArchie Cobbs.Pp 15410c2a9dbSArchie CobbsTypically when the controlling entity receives a packet on the bypass 15510c2a9dbSArchie Cobbshook it responds either by dropping the frame (if it's not ready for 15610c2a9dbSArchie Cobbsthe protocol) or with an LCP protocol reject (if it doesn't recognize 15710c2a9dbSArchie Cobbsor expect the protocol). 15810c2a9dbSArchie Cobbs.Sh MULTILINK OPERATION 15910c2a9dbSArchie CobbsTo enable multi-link PPP, the corresponding configuration flag must be set 16010c2a9dbSArchie Cobbsand at least one link connected. The PPP node will not allow more than 16110c2a9dbSArchie Cobbsone link to be connected if multi-link is not enabled, nor will it allow 16210c2a9dbSArchie Cobbscertain multi-link settings to be changed while multi-link operation is 16310c2a9dbSArchie Cobbsactive (e.g., short sequence number header format). 16410c2a9dbSArchie Cobbs.Pp 16510c2a9dbSArchie CobbsBecause packets are sent as fragments across multiple individual links, 16610c2a9dbSArchie Cobbsit is important that when a link goes down the PPP node is notified 16710c2a9dbSArchie Cobbsimmediately, either by disconnecting the corresponding hook or disabling 16810c2a9dbSArchie Cobbsthe link via the 16910c2a9dbSArchie Cobbs.Dv NGM_PPP_SET_CONFIG 17010c2a9dbSArchie Cobbscontrol message. 17110c2a9dbSArchie Cobbs.Pp 17210c2a9dbSArchie CobbsEach link has configuration parameters for latency (specified in 1737f9d26bdSMike Pritchardmilliseconds) and bandwidth (specified in tens of bytes per second). 17410c2a9dbSArchie CobbsThe PPP node can be configured for 17510c2a9dbSArchie Cobbs.Em round-robin 17610c2a9dbSArchie Cobbsor 17710c2a9dbSArchie Cobbs.Em optimized 17810c2a9dbSArchie Cobbspacket delivery. 17910c2a9dbSArchie Cobbs.Pp 18010c2a9dbSArchie CobbsWhen configured for round-robin delivery, the latency and bandwidth 18110c2a9dbSArchie Cobbsvalues are ignored and the PPP node simply sends each frame as a 18210c2a9dbSArchie Cobbssingle fragment, alternating frames across all the links in the 18310c2a9dbSArchie Cobbsbundle. This scheme has the advantage that even if one link fails 18410c2a9dbSArchie Cobbssilently, some packets will still get through. It has the disadvantage 18510c2a9dbSArchie Cobbsof sub-optimal overall bundle latency, which is important for 18610c2a9dbSArchie Cobbsinteractive response time, and sub-optimal overall bundle bandwidth 18710c2a9dbSArchie Cobbswhen links with different bandwidths exist in the same bundle. 18810c2a9dbSArchie Cobbs.Pp 18910c2a9dbSArchie CobbsWhen configured for optimal delivery, the PPP node distributes the 19010c2a9dbSArchie Cobbspacket across the links in a way that minimizes the time it takes 19110c2a9dbSArchie Cobbsfor the completed packet to be received by the far end. This 1927f9d26bdSMike Pritchardinvolves taking into account each link's latency, bandwidth, and 19310c2a9dbSArchie Cobbscurrent queue length. Therefore these numbers should be 19410c2a9dbSArchie Cobbsconfigured as accurately as possible. The algorithm does require 19510c2a9dbSArchie Cobbssome computation, so may not be appropriate for very slow machines 19610c2a9dbSArchie Cobbsand/or very fast links. 19710c2a9dbSArchie Cobbs.Pp 19810c2a9dbSArchie CobbsAs a special case, if all links have identical latency and bandwidth, 19910c2a9dbSArchie Cobbsthen the above algorithm is disabled (because it is unnecessary) 20010c2a9dbSArchie Cobbsand the PPP node simply fragments frames into equal sized portions 20110c2a9dbSArchie Cobbsacross all of the links. 2024cf49a43SJulian Elischer.Sh HOOKS 2034cf49a43SJulian ElischerThis node type supports the following hooks: 2044cf49a43SJulian Elischer.Pp 20510c2a9dbSArchie Cobbs.Bl -tag -compact -width vjc_vjuncomp 20610c2a9dbSArchie Cobbs.It Dv link<N> 20710c2a9dbSArchie CobbsIndividual PPP link number 20810c2a9dbSArchie Cobbs.Dv <N> 20910c2a9dbSArchie Cobbs.It Dv compress 21010c2a9dbSArchie CobbsConnection to compression engine 21110c2a9dbSArchie Cobbs.It Dv decompress 21210c2a9dbSArchie CobbsConnection to decompression engine 21310c2a9dbSArchie Cobbs.It Dv encrypt 21410c2a9dbSArchie CobbsConnection to encryption engine 21510c2a9dbSArchie Cobbs.It Dv decrypt 21610c2a9dbSArchie CobbsConnection to decryption engine 21710c2a9dbSArchie Cobbs.It Dv vjc_ip 21810c2a9dbSArchie CobbsConnection to 21910c2a9dbSArchie Cobbs.Xr ng_vjc 8 22010c2a9dbSArchie Cobbs.Dv ip 22110c2a9dbSArchie Cobbshook 22210c2a9dbSArchie Cobbs.It Dv vjc_vjcomp 22310c2a9dbSArchie CobbsConnection to 22410c2a9dbSArchie Cobbs.Xr ng_vjc 8 22510c2a9dbSArchie Cobbs.Dv vjcomp 22610c2a9dbSArchie Cobbshook 22710c2a9dbSArchie Cobbs.It Dv vjc_vjuncomp 22810c2a9dbSArchie CobbsConnection to 22910c2a9dbSArchie Cobbs.Xr ng_vjc 8 23010c2a9dbSArchie Cobbs.Dv vjuncomp 23110c2a9dbSArchie Cobbshook 23210c2a9dbSArchie Cobbs.It Dv vjc_vjip 23310c2a9dbSArchie CobbsConnection to 23410c2a9dbSArchie Cobbs.Xr ng_vjc 8 23510c2a9dbSArchie Cobbs.Dv vjip 23610c2a9dbSArchie Cobbshook 23710c2a9dbSArchie Cobbs.It Dv inet 23810c2a9dbSArchie CobbsIP packet data 23910c2a9dbSArchie Cobbs.It Dv atalk 24010c2a9dbSArchie CobbsAppleTalk packet data 24110c2a9dbSArchie Cobbs.It Dv ipx 24210c2a9dbSArchie CobbsIPX packet data 2434cf49a43SJulian Elischer.It Dv bypass 24410c2a9dbSArchie CobbsBypass hook; frames have a four byte header consisting of 24510c2a9dbSArchie Cobbsa link number and a PPP protocol number. 2464cf49a43SJulian Elischer.El 2474cf49a43SJulian Elischer.Pp 2484cf49a43SJulian Elischer.Sh CONTROL MESSAGES 2494cf49a43SJulian ElischerThis node type supports the generic control messages, plus the following: 2504cf49a43SJulian Elischer.Bl -tag -width foo 25110c2a9dbSArchie Cobbs.It Dv NGM_PPP_SET_CONFIG 25210c2a9dbSArchie CobbsThis command configures all aspects of the node. This includes enabling 25310c2a9dbSArchie Cobbsmulti-link PPP, encryption, compression, Van Jacobsen compression, and IP, 25410c2a9dbSArchie CobbsAppleTalk, and IPX packet delivery. It includes per-link configuration, 25510c2a9dbSArchie Cobbsincluding enabling the link, setting latency and bandwidth parameters, 25610c2a9dbSArchie Cobbsand enabling protocol field compression. Note that no link or functionality 25710c2a9dbSArchie Cobbsis active until the corresponding hook is also connected. 25810c2a9dbSArchie CobbsThis command takes a 25910c2a9dbSArchie Cobbs.Dv "struct ng_ppp_node_config" 26010c2a9dbSArchie Cobbsas an argument. 26110c2a9dbSArchie Cobbs.It Dv NGM_PPP_GET_CONFIG 26210c2a9dbSArchie CobbsReturns the current configuration as a 26310c2a9dbSArchie Cobbs.Dv "struct ng_ppp_node_config" . 26410c2a9dbSArchie Cobbs.It Dv NGM_PPP_GET_LINK_STATS 26510c2a9dbSArchie CobbsThis command takes a two byte link number as an argument and returns a 26610c2a9dbSArchie Cobbs.Dv "struct ng_ppp_link_stat" 26710c2a9dbSArchie Cobbscontaining statistics for the corresponding link. Here 26810c2a9dbSArchie Cobbs.Dv NG_PPP_BUNDLE_LINKNUM 26910c2a9dbSArchie Cobbsis a valid link number corresponding to the multi-link bundle. 27010c2a9dbSArchie Cobbs.It Dv NGM_PPP_CLR_LINK_STATS 27110c2a9dbSArchie CobbsThis command takes a two byte link number as an argument and 27210c2a9dbSArchie Cobbsclears the statistics for that link. If 27310c2a9dbSArchie Cobbs.Dv NG_PPP_BUNDLE_LINKNUM 27410c2a9dbSArchie Cobbsis given, 27510c2a9dbSArchie Cobbs.Em all 27610c2a9dbSArchie Cobbsstatistics are cleared. 27710c2a9dbSArchie Cobbs.El 27810c2a9dbSArchie Cobbs.Pp 27910c2a9dbSArchie CobbsThis node type also accepts the control messages accepted by the 28010c2a9dbSArchie Cobbs.Xr ng_vjc 8 28110c2a9dbSArchie Cobbsnode type. When received, these messages are simply forwarded to 28210c2a9dbSArchie Cobbsthe adjacent 28310c2a9dbSArchie Cobbs.Xr ng_vjc 8 28410c2a9dbSArchie Cobbsnode, if any. 2854cf49a43SJulian Elischer.Sh SHUTDOWN 2864cf49a43SJulian ElischerThis node shuts down upon receipt of a 2874cf49a43SJulian Elischer.Dv NGM_SHUTDOWN 2884cf49a43SJulian Elischercontrol message, or when all hooks have been disconnected. 2894cf49a43SJulian Elischer.Sh SEE ALSO 2904cf49a43SJulian Elischer.Xr netgraph 4 , 2914cf49a43SJulian Elischer.Xr ng_async 8 , 29210c2a9dbSArchie Cobbs.Xr ng_iface 8 , 2934cf49a43SJulian Elischer.Xr ng_vjc 8 , 2944cf49a43SJulian Elischer.Xr ngctl 8 . 2954cf49a43SJulian Elischer.Rs 2964cf49a43SJulian Elischer.%A W. Simpson 2974cf49a43SJulian Elischer.%T "The Point-to-Point Protocol (PPP)" 2984cf49a43SJulian Elischer.%O RFC 1661 2994cf49a43SJulian Elischer.Re 30010c2a9dbSArchie Cobbs.Rs 30110c2a9dbSArchie Cobbs.%A K. Sklower 30210c2a9dbSArchie Cobbs.%A B. Lloyd 30310c2a9dbSArchie Cobbs.%A G. McGregor 30410c2a9dbSArchie Cobbs.%A D. Carr 30510c2a9dbSArchie Cobbs.%A T. Coradetti 30610c2a9dbSArchie Cobbs.%T "The PPP Multilink Protocol (MP)" 30710c2a9dbSArchie Cobbs.%O RFC 1990 30810c2a9dbSArchie Cobbs.Re 3094cf49a43SJulian Elischer.Sh AUTHOR 3104cf49a43SJulian ElischerArchie Cobbs <archie@whistle.com> 311