1.\" $OpenBSD: sppp.4,v 1.28 2023/03/23 12:43:38 stsp Exp $ 2.\" 3.\" Copyright (c) 1997 Joerg Wunsch 4.\" 5.\" All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR 17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26.\" 27.\" 28.Dd $Mdocdate: March 23 2023 $ 29.Dt SPPP 4 30.Os 31.Sh NAME 32.Nm sppp 33.Nd PPP and Link Control Protocol 34.Sh SYNOPSIS 35.Cd "pseudo-device sppp" Op Ar count 36.Sh DESCRIPTION 37The 38.Nm 39network layer implements the state machine and Link Control 40Protocol (LCP) of the 41Point-to-Point Protocol (PPP) 42as described in RFC 1661. 43Note that this layer does not provide network interfaces of its own, it is 44rather intended to be layered on 45top of drivers providing a point-to-point connection that 46wish to run a PPP stack over it. 47The corresponding network interfaces have to be provided by these hardware 48drivers. 49.Pp 50The 51.Nm 52layer provides three basic modes of operation. 53The default mode, with no special flags set, is to create the 54PPP connection (administrative 55.Em Open 56event to the LCP layer) as soon as the interface is taken up with the 57.Xr ifconfig 8 58command. 59Taking the interface down again will terminate the LCP layer 60and thus all other layers on top. 61The link will also terminate itself as soon as no Network Control Protocol 62(NCP) is open anymore, indicating that the lower layers are no longer needed. 63.Pp 64Setting the link-level flag 65.Cm link0 66with 67.Xr ifconfig 8 68will cause the respective network interface to go into 69.Em passive 70mode. 71This means the administrative 72.Em Open 73event to the LCP layer will be delayed until after the lower layers 74signal an 75.Em Up 76event (rise of 77.Dq carrier ) . 78This can be used by the lower layers to support 79a dial-in connection where the physical layer isn't available 80immediately at startup, but only after some external event arrives. 81Receipt of a 82.Em Down 83event from the lower layer will not take the interface completely down 84in this case. 85.Pp 86Finally, setting the flag 87.Cm link1 88will cause the interface to operate in 89.Em dial-on-demand 90mode. 91This is also only useful if the lower layers support the notion 92of a carrier (like with an ISDN line). 93Upon configuring the respective interface, it will delay the administrative 94.Em Open 95event to the LCP layer until either an outbound network packet 96arrives, or until the lower layers signal an 97.Em Up 98event, indicating an inbound connection. 99As with passive mode, receipt of a 100.Em Down 101event (loss of carrier) will not automatically take the interface down, 102thus it remains available for further connections. 103.Pp 104The 105.Nm 106layer supports the 107.Em debug 108interface flag, which can be set with 109.Xr ifconfig 8 . 110If this flag is set, the various control protocol packets being 111exchanged as well as the option negotiation between both ends of the 112link will be logged at level 113.Dv LOG_DEBUG . 114This can be helpful to examine configuration problems during the first 115attempts to set up a new configuration. 116Without this flag being set, only the major phase transitions will be 117logged at level 118.Dv LOG_INFO . 119.Pp 120It is possible to leave the local interface IP address open for 121negotiation by setting it to 0.0.0.0. 122This requires that the remote peer can correctly supply a value for it 123based on the identity of the caller, or on the remote address supplied 124by this side. 125Due to the way the IPCP option negotiation works, this address is 126supplied late during the negotiation, which could cause the remote peer 127to make false assumptions. 128.Pp 129In a similar spirit the remote address can be set to a magical value in 130the range 0.0.0.1 to 0.0.0.255, which means that we don't care what 131address the remote side will use, as long as it is not 0.0.0.0. 132This is useful if your ISP has several dial-in servers. 133You can of course 134.Ic route add 135something or other 0.0.0.1 136and it will do exactly what you would want it to. 137.Pp 138Once a connection is established, 139the device will send out a nameserver proposal, 140which 141.Xr resolvd 8 142can act on. 143If during IPCP negotiation no DNS server options were exchanged, 144the nameserver proposal will be empty. 145.Pp 146The PAP and CHAP authentication protocols, as described in RFCs 1334 147and 1994, respectively, are also implemented. 148Their parameters are controlled by the 149.Xr ifconfig 8 150utility. 151.Sh EXAMPLES 152Display the settings for pppoe0. 153The interface is currently in the 154.Em establish 155phase and tries to connect to the remote peer; 156other possible PPP phases are 157.Em dead , 158.Em authenticate , 159.Em network , 160or 161.Em terminate . 162Both ends of the connection use the CHAP protocol, the local client 163tells the remote peer the system name 164.Ql uriah , 165and the peer is expected to authenticate by the name 166.Ql ifb-gw . 167Once the initial CHAP handshake has been successful, no further CHAP 168challenges will be transmitted. 169There are supposedly some known CHAP secrets for both ends of the link 170which are not displayed. 171.Bd -literal -offset indent 172$ ifconfig pppoe0 173pppoe0: flags=8851<UP,POINTOPOINT,RUNNING,SIMPLEX,MULTICAST> mtu 1492 174 dev: em0 state: PADI sent 175 sid: 0x0 PADI retries: 0 PADR retries: 0 176 sppp: phase establish authproto chap authname "uriah" \e 177 peerproto chap peername "ifb-gw" norechallenge 178 groups: pppoe 179 inet 0.0.0.0 --> 0.0.0.1 netmask 0xffffffff 180.Ed 181.Pp 182A possible call to 183.Xr ifconfig 8 184that could have been used to bring the interface into the state shown 185by the previous example: 186.Bd -literal -offset indent 187# ifconfig em0 up 188# ifconfig pppoe0 0.0.0.0 0.0.0.1 netmask 0xffffffff \e 189 pppoedev em0 \e 190 authproto chap authname uriah authkey "some secret" \e 191 peerproto chap peername "ifb-gw" peerkey "another" \e 192 peerflag norechallenge \e 193 up 194.Ed 195.Sh DIAGNOSTICS 196.Bl -diag 197.It <ifname><ifnum>: <proto> illegal <event> in state <statename> 198An event happened that should not happen for the current state 199the respective control protocol is in. 200See RFC 1661 for a description of the state automaton. 201.It <ifname><ifnum>: loopback 202The state automaton detected a line loopback (that is, it was talking 203with itself). 204The interface will be temporarily disabled. 205.It <ifname><ifnum>: up 206The LCP layer is running again, after a line loopback had previously 207been detected. 208.It <ifname><ifnum>: down 209The keepalive facility detected the line being unresponsive. 210Keepalive must be explicitly requested by the lower layers in order to 211take place. 212.El 213.Sh SEE ALSO 214.Xr inet 4 , 215.Xr pppoe 4 , 216.Xr ifconfig 8 217.Sh STANDARDS 218.Rs 219.%A G. McGregor 220.%D May 1992 221.%R RFC 1332 222.%T The PPP Internet Protocol Control Protocol (IPCP) 223.Re 224.Pp 225.Rs 226.%A B. Lloyd 227.%A W. Simpson 228.%D October 1992 229.%R RFC 1334 230.%T PPP Authentication Protocols 231.Re 232.Pp 233.Rs 234.%A W. Simpson 235.%D July 1994 236.%R RFC 1661 237.%T The Point-to-Point Protocol (PPP) 238.Re 239.Pp 240.Rs 241.%A S. Cobb 242.%D December 1995 243.%R RFC 1877 244.%T PPP Internet Protocol Control Protocol Extensions for Name Server Addresses 245.Re 246.Pp 247.Rs 248.%A W. Simpson 249.%D August 1996 250.%R RFC 1994 251.%T PPP Challenge Handshake Authentication Protocol (CHAP) 252.Re 253.Pp 254.Rs 255.%A S. Varada 256.%A D. Haskins 257.%A E. Allen 258.%D September 2007 259.%R RFC 5072 260.%T IP Version 6 over PPP 261.Re 262.Sh AUTHORS 263.An -nosplit 264The original implementation of 265.Nm 266was written in 1994 at Cronyx Ltd., Moscow, by 267.An Serge Vakulenko Aq Mt vak@cronyx.ru . 268.An Joerg Wunsch Aq Mt joerg_wunsch@uriah.heep.sax.de 269rewrote a large part in 1997 in order 270to fully implement the state machine as described in RFC 1661, so it 271could also be used for dialup lines. 272He also wrote the initial version of this man page. 273Serge later on wrote a basic implementation for PAP and CHAP, which 274served as the base for the current implementation, done again by 275Joerg Wunsch. 276.Pp 277.An Reyk Floeter 278implemented 279.Nm 280support for 281.Xr ifconfig 8 282in 283.Ox 4.0 284in order to remove the original 285.Ql spppcontrol 286utility, which was previously used to configure and display the 287.Nm 288settings. 289.Sh BUGS 290Many. 291.Pp 292Negotiation loop avoidance is not fully implemented. 293If the negotiation doesn't converge, this can cause an endless loop. 294.Pp 295The various parameters that should be adjustable per RFC 1661 are 296currently hard-coded into the kernel, and should be made accessible 297through 298.Xr ifconfig 8 . 299.Pp 300.Em Passive 301mode has not been tested extensively. 302.Pp 303More NCPs should be implemented, as well as other control protocols 304for authentication and link quality reporting. 305.Pp 306IPCP should support VJ header compression. 307.Pp 308Link-level compression protocols should be supported. 309