1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun======================================== 4*4882a593SmuzhiyunPPP Generic Driver and Channel Interface 5*4882a593Smuzhiyun======================================== 6*4882a593Smuzhiyun 7*4882a593Smuzhiyun Paul Mackerras 8*4882a593Smuzhiyun paulus@samba.org 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun 7 Feb 2002 11*4882a593Smuzhiyun 12*4882a593SmuzhiyunThe generic PPP driver in linux-2.4 provides an implementation of the 13*4882a593Smuzhiyunfunctionality which is of use in any PPP implementation, including: 14*4882a593Smuzhiyun 15*4882a593Smuzhiyun* the network interface unit (ppp0 etc.) 16*4882a593Smuzhiyun* the interface to the networking code 17*4882a593Smuzhiyun* PPP multilink: splitting datagrams between multiple links, and 18*4882a593Smuzhiyun ordering and combining received fragments 19*4882a593Smuzhiyun* the interface to pppd, via a /dev/ppp character device 20*4882a593Smuzhiyun* packet compression and decompression 21*4882a593Smuzhiyun* TCP/IP header compression and decompression 22*4882a593Smuzhiyun* detecting network traffic for demand dialling and for idle timeouts 23*4882a593Smuzhiyun* simple packet filtering 24*4882a593Smuzhiyun 25*4882a593SmuzhiyunFor sending and receiving PPP frames, the generic PPP driver calls on 26*4882a593Smuzhiyunthe services of PPP ``channels``. A PPP channel encapsulates a 27*4882a593Smuzhiyunmechanism for transporting PPP frames from one machine to another. A 28*4882a593SmuzhiyunPPP channel implementation can be arbitrarily complex internally but 29*4882a593Smuzhiyunhas a very simple interface with the generic PPP code: it merely has 30*4882a593Smuzhiyunto be able to send PPP frames, receive PPP frames, and optionally 31*4882a593Smuzhiyunhandle ioctl requests. Currently there are PPP channel 32*4882a593Smuzhiyunimplementations for asynchronous serial ports, synchronous serial 33*4882a593Smuzhiyunports, and for PPP over ethernet. 34*4882a593Smuzhiyun 35*4882a593SmuzhiyunThis architecture makes it possible to implement PPP multilink in a 36*4882a593Smuzhiyunnatural and straightforward way, by allowing more than one channel to 37*4882a593Smuzhiyunbe linked to each ppp network interface unit. The generic layer is 38*4882a593Smuzhiyunresponsible for splitting datagrams on transmit and recombining them 39*4882a593Smuzhiyunon receive. 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun 42*4882a593SmuzhiyunPPP channel API 43*4882a593Smuzhiyun--------------- 44*4882a593Smuzhiyun 45*4882a593SmuzhiyunSee include/linux/ppp_channel.h for the declaration of the types and 46*4882a593Smuzhiyunfunctions used to communicate between the generic PPP layer and PPP 47*4882a593Smuzhiyunchannels. 48*4882a593Smuzhiyun 49*4882a593SmuzhiyunEach channel has to provide two functions to the generic PPP layer, 50*4882a593Smuzhiyunvia the ppp_channel.ops pointer: 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun* start_xmit() is called by the generic layer when it has a frame to 53*4882a593Smuzhiyun send. The channel has the option of rejecting the frame for 54*4882a593Smuzhiyun flow-control reasons. In this case, start_xmit() should return 0 55*4882a593Smuzhiyun and the channel should call the ppp_output_wakeup() function at a 56*4882a593Smuzhiyun later time when it can accept frames again, and the generic layer 57*4882a593Smuzhiyun will then attempt to retransmit the rejected frame(s). If the frame 58*4882a593Smuzhiyun is accepted, the start_xmit() function should return 1. 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun* ioctl() provides an interface which can be used by a user-space 61*4882a593Smuzhiyun program to control aspects of the channel's behaviour. This 62*4882a593Smuzhiyun procedure will be called when a user-space program does an ioctl 63*4882a593Smuzhiyun system call on an instance of /dev/ppp which is bound to the 64*4882a593Smuzhiyun channel. (Usually it would only be pppd which would do this.) 65*4882a593Smuzhiyun 66*4882a593SmuzhiyunThe generic PPP layer provides seven functions to channels: 67*4882a593Smuzhiyun 68*4882a593Smuzhiyun* ppp_register_channel() is called when a channel has been created, to 69*4882a593Smuzhiyun notify the PPP generic layer of its presence. For example, setting 70*4882a593Smuzhiyun a serial port to the PPPDISC line discipline causes the ppp_async 71*4882a593Smuzhiyun channel code to call this function. 72*4882a593Smuzhiyun 73*4882a593Smuzhiyun* ppp_unregister_channel() is called when a channel is to be 74*4882a593Smuzhiyun destroyed. For example, the ppp_async channel code calls this when 75*4882a593Smuzhiyun a hangup is detected on the serial port. 76*4882a593Smuzhiyun 77*4882a593Smuzhiyun* ppp_output_wakeup() is called by a channel when it has previously 78*4882a593Smuzhiyun rejected a call to its start_xmit function, and can now accept more 79*4882a593Smuzhiyun packets. 80*4882a593Smuzhiyun 81*4882a593Smuzhiyun* ppp_input() is called by a channel when it has received a complete 82*4882a593Smuzhiyun PPP frame. 83*4882a593Smuzhiyun 84*4882a593Smuzhiyun* ppp_input_error() is called by a channel when it has detected that a 85*4882a593Smuzhiyun frame has been lost or dropped (for example, because of a FCS (frame 86*4882a593Smuzhiyun check sequence) error). 87*4882a593Smuzhiyun 88*4882a593Smuzhiyun* ppp_channel_index() returns the channel index assigned by the PPP 89*4882a593Smuzhiyun generic layer to this channel. The channel should provide some way 90*4882a593Smuzhiyun (e.g. an ioctl) to transmit this back to user-space, as user-space 91*4882a593Smuzhiyun will need it to attach an instance of /dev/ppp to this channel. 92*4882a593Smuzhiyun 93*4882a593Smuzhiyun* ppp_unit_number() returns the unit number of the ppp network 94*4882a593Smuzhiyun interface to which this channel is connected, or -1 if the channel 95*4882a593Smuzhiyun is not connected. 96*4882a593Smuzhiyun 97*4882a593SmuzhiyunConnecting a channel to the ppp generic layer is initiated from the 98*4882a593Smuzhiyunchannel code, rather than from the generic layer. The channel is 99*4882a593Smuzhiyunexpected to have some way for a user-level process to control it 100*4882a593Smuzhiyunindependently of the ppp generic layer. For example, with the 101*4882a593Smuzhiyunppp_async channel, this is provided by the file descriptor to the 102*4882a593Smuzhiyunserial port. 103*4882a593Smuzhiyun 104*4882a593SmuzhiyunGenerally a user-level process will initialize the underlying 105*4882a593Smuzhiyuncommunications medium and prepare it to do PPP. For example, with an 106*4882a593Smuzhiyunasync tty, this can involve setting the tty speed and modes, issuing 107*4882a593Smuzhiyunmodem commands, and then going through some sort of dialog with the 108*4882a593Smuzhiyunremote system to invoke PPP service there. We refer to this process 109*4882a593Smuzhiyunas ``discovery``. Then the user-level process tells the medium to 110*4882a593Smuzhiyunbecome a PPP channel and register itself with the generic PPP layer. 111*4882a593SmuzhiyunThe channel then has to report the channel number assigned to it back 112*4882a593Smuzhiyunto the user-level process. From that point, the PPP negotiation code 113*4882a593Smuzhiyunin the PPP daemon (pppd) can take over and perform the PPP 114*4882a593Smuzhiyunnegotiation, accessing the channel through the /dev/ppp interface. 115*4882a593Smuzhiyun 116*4882a593SmuzhiyunAt the interface to the PPP generic layer, PPP frames are stored in 117*4882a593Smuzhiyunskbuff structures and start with the two-byte PPP protocol number. 118*4882a593SmuzhiyunThe frame does *not* include the 0xff ``address`` byte or the 0x03 119*4882a593Smuzhiyun``control`` byte that are optionally used in async PPP. Nor is there 120*4882a593Smuzhiyunany escaping of control characters, nor are there any FCS or framing 121*4882a593Smuzhiyuncharacters included. That is all the responsibility of the channel 122*4882a593Smuzhiyuncode, if it is needed for the particular medium. That is, the skbuffs 123*4882a593Smuzhiyunpresented to the start_xmit() function contain only the 2-byte 124*4882a593Smuzhiyunprotocol number and the data, and the skbuffs presented to ppp_input() 125*4882a593Smuzhiyunmust be in the same format. 126*4882a593Smuzhiyun 127*4882a593SmuzhiyunThe channel must provide an instance of a ppp_channel struct to 128*4882a593Smuzhiyunrepresent the channel. The channel is free to use the ``private`` field 129*4882a593Smuzhiyunhowever it wishes. The channel should initialize the ``mtu`` and 130*4882a593Smuzhiyun``hdrlen`` fields before calling ppp_register_channel() and not change 131*4882a593Smuzhiyunthem until after ppp_unregister_channel() returns. The ``mtu`` field 132*4882a593Smuzhiyunrepresents the maximum size of the data part of the PPP frames, that 133*4882a593Smuzhiyunis, it does not include the 2-byte protocol number. 134*4882a593Smuzhiyun 135*4882a593SmuzhiyunIf the channel needs some headroom in the skbuffs presented to it for 136*4882a593Smuzhiyuntransmission (i.e., some space free in the skbuff data area before the 137*4882a593Smuzhiyunstart of the PPP frame), it should set the ``hdrlen`` field of the 138*4882a593Smuzhiyunppp_channel struct to the amount of headroom required. The generic 139*4882a593SmuzhiyunPPP layer will attempt to provide that much headroom but the channel 140*4882a593Smuzhiyunshould still check if there is sufficient headroom and copy the skbuff 141*4882a593Smuzhiyunif there isn't. 142*4882a593Smuzhiyun 143*4882a593SmuzhiyunOn the input side, channels should ideally provide at least 2 bytes of 144*4882a593Smuzhiyunheadroom in the skbuffs presented to ppp_input(). The generic PPP 145*4882a593Smuzhiyuncode does not require this but will be more efficient if this is done. 146*4882a593Smuzhiyun 147*4882a593Smuzhiyun 148*4882a593SmuzhiyunBuffering and flow control 149*4882a593Smuzhiyun-------------------------- 150*4882a593Smuzhiyun 151*4882a593SmuzhiyunThe generic PPP layer has been designed to minimize the amount of data 152*4882a593Smuzhiyunthat it buffers in the transmit direction. It maintains a queue of 153*4882a593Smuzhiyuntransmit packets for the PPP unit (network interface device) plus a 154*4882a593Smuzhiyunqueue of transmit packets for each attached channel. Normally the 155*4882a593Smuzhiyuntransmit queue for the unit will contain at most one packet; the 156*4882a593Smuzhiyunexceptions are when pppd sends packets by writing to /dev/ppp, and 157*4882a593Smuzhiyunwhen the core networking code calls the generic layer's start_xmit() 158*4882a593Smuzhiyunfunction with the queue stopped, i.e. when the generic layer has 159*4882a593Smuzhiyuncalled netif_stop_queue(), which only happens on a transmit timeout. 160*4882a593SmuzhiyunThe start_xmit function always accepts and queues the packet which it 161*4882a593Smuzhiyunis asked to transmit. 162*4882a593Smuzhiyun 163*4882a593SmuzhiyunTransmit packets are dequeued from the PPP unit transmit queue and 164*4882a593Smuzhiyunthen subjected to TCP/IP header compression and packet compression 165*4882a593Smuzhiyun(Deflate or BSD-Compress compression), as appropriate. After this 166*4882a593Smuzhiyunpoint the packets can no longer be reordered, as the decompression 167*4882a593Smuzhiyunalgorithms rely on receiving compressed packets in the same order that 168*4882a593Smuzhiyunthey were generated. 169*4882a593Smuzhiyun 170*4882a593SmuzhiyunIf multilink is not in use, this packet is then passed to the attached 171*4882a593Smuzhiyunchannel's start_xmit() function. If the channel refuses to take 172*4882a593Smuzhiyunthe packet, the generic layer saves it for later transmission. The 173*4882a593Smuzhiyungeneric layer will call the channel's start_xmit() function again 174*4882a593Smuzhiyunwhen the channel calls ppp_output_wakeup() or when the core 175*4882a593Smuzhiyunnetworking code calls the generic layer's start_xmit() function 176*4882a593Smuzhiyunagain. The generic layer contains no timeout and retransmission 177*4882a593Smuzhiyunlogic; it relies on the core networking code for that. 178*4882a593Smuzhiyun 179*4882a593SmuzhiyunIf multilink is in use, the generic layer divides the packet into one 180*4882a593Smuzhiyunor more fragments and puts a multilink header on each fragment. It 181*4882a593Smuzhiyundecides how many fragments to use based on the length of the packet 182*4882a593Smuzhiyunand the number of channels which are potentially able to accept a 183*4882a593Smuzhiyunfragment at the moment. A channel is potentially able to accept a 184*4882a593Smuzhiyunfragment if it doesn't have any fragments currently queued up for it 185*4882a593Smuzhiyunto transmit. The channel may still refuse a fragment; in this case 186*4882a593Smuzhiyunthe fragment is queued up for the channel to transmit later. This 187*4882a593Smuzhiyunscheme has the effect that more fragments are given to higher- 188*4882a593Smuzhiyunbandwidth channels. It also means that under light load, the generic 189*4882a593Smuzhiyunlayer will tend to fragment large packets across all the channels, 190*4882a593Smuzhiyunthus reducing latency, while under heavy load, packets will tend to be 191*4882a593Smuzhiyuntransmitted as single fragments, thus reducing the overhead of 192*4882a593Smuzhiyunfragmentation. 193*4882a593Smuzhiyun 194*4882a593Smuzhiyun 195*4882a593SmuzhiyunSMP safety 196*4882a593Smuzhiyun---------- 197*4882a593Smuzhiyun 198*4882a593SmuzhiyunThe PPP generic layer has been designed to be SMP-safe. Locks are 199*4882a593Smuzhiyunused around accesses to the internal data structures where necessary 200*4882a593Smuzhiyunto ensure their integrity. As part of this, the generic layer 201*4882a593Smuzhiyunrequires that the channels adhere to certain requirements and in turn 202*4882a593Smuzhiyunprovides certain guarantees to the channels. Essentially the channels 203*4882a593Smuzhiyunare required to provide the appropriate locking on the ppp_channel 204*4882a593Smuzhiyunstructures that form the basis of the communication between the 205*4882a593Smuzhiyunchannel and the generic layer. This is because the channel provides 206*4882a593Smuzhiyunthe storage for the ppp_channel structure, and so the channel is 207*4882a593Smuzhiyunrequired to provide the guarantee that this storage exists and is 208*4882a593Smuzhiyunvalid at the appropriate times. 209*4882a593Smuzhiyun 210*4882a593SmuzhiyunThe generic layer requires these guarantees from the channel: 211*4882a593Smuzhiyun 212*4882a593Smuzhiyun* The ppp_channel object must exist from the time that 213*4882a593Smuzhiyun ppp_register_channel() is called until after the call to 214*4882a593Smuzhiyun ppp_unregister_channel() returns. 215*4882a593Smuzhiyun 216*4882a593Smuzhiyun* No thread may be in a call to any of ppp_input(), ppp_input_error(), 217*4882a593Smuzhiyun ppp_output_wakeup(), ppp_channel_index() or ppp_unit_number() for a 218*4882a593Smuzhiyun channel at the time that ppp_unregister_channel() is called for that 219*4882a593Smuzhiyun channel. 220*4882a593Smuzhiyun 221*4882a593Smuzhiyun* ppp_register_channel() and ppp_unregister_channel() must be called 222*4882a593Smuzhiyun from process context, not interrupt or softirq/BH context. 223*4882a593Smuzhiyun 224*4882a593Smuzhiyun* The remaining generic layer functions may be called at softirq/BH 225*4882a593Smuzhiyun level but must not be called from a hardware interrupt handler. 226*4882a593Smuzhiyun 227*4882a593Smuzhiyun* The generic layer may call the channel start_xmit() function at 228*4882a593Smuzhiyun softirq/BH level but will not call it at interrupt level. Thus the 229*4882a593Smuzhiyun start_xmit() function may not block. 230*4882a593Smuzhiyun 231*4882a593Smuzhiyun* The generic layer will only call the channel ioctl() function in 232*4882a593Smuzhiyun process context. 233*4882a593Smuzhiyun 234*4882a593SmuzhiyunThe generic layer provides these guarantees to the channels: 235*4882a593Smuzhiyun 236*4882a593Smuzhiyun* The generic layer will not call the start_xmit() function for a 237*4882a593Smuzhiyun channel while any thread is already executing in that function for 238*4882a593Smuzhiyun that channel. 239*4882a593Smuzhiyun 240*4882a593Smuzhiyun* The generic layer will not call the ioctl() function for a channel 241*4882a593Smuzhiyun while any thread is already executing in that function for that 242*4882a593Smuzhiyun channel. 243*4882a593Smuzhiyun 244*4882a593Smuzhiyun* By the time a call to ppp_unregister_channel() returns, no thread 245*4882a593Smuzhiyun will be executing in a call from the generic layer to that channel's 246*4882a593Smuzhiyun start_xmit() or ioctl() function, and the generic layer will not 247*4882a593Smuzhiyun call either of those functions subsequently. 248*4882a593Smuzhiyun 249*4882a593Smuzhiyun 250*4882a593SmuzhiyunInterface to pppd 251*4882a593Smuzhiyun----------------- 252*4882a593Smuzhiyun 253*4882a593SmuzhiyunThe PPP generic layer exports a character device interface called 254*4882a593Smuzhiyun/dev/ppp. This is used by pppd to control PPP interface units and 255*4882a593Smuzhiyunchannels. Although there is only one /dev/ppp, each open instance of 256*4882a593Smuzhiyun/dev/ppp acts independently and can be attached either to a PPP unit 257*4882a593Smuzhiyunor a PPP channel. This is achieved using the file->private_data field 258*4882a593Smuzhiyunto point to a separate object for each open instance of /dev/ppp. In 259*4882a593Smuzhiyunthis way an effect similar to Solaris' clone open is obtained, 260*4882a593Smuzhiyunallowing us to control an arbitrary number of PPP interfaces and 261*4882a593Smuzhiyunchannels without having to fill up /dev with hundreds of device names. 262*4882a593Smuzhiyun 263*4882a593SmuzhiyunWhen /dev/ppp is opened, a new instance is created which is initially 264*4882a593Smuzhiyununattached. Using an ioctl call, it can then be attached to an 265*4882a593Smuzhiyunexisting unit, attached to a newly-created unit, or attached to an 266*4882a593Smuzhiyunexisting channel. An instance attached to a unit can be used to send 267*4882a593Smuzhiyunand receive PPP control frames, using the read() and write() system 268*4882a593Smuzhiyuncalls, along with poll() if necessary. Similarly, an instance 269*4882a593Smuzhiyunattached to a channel can be used to send and receive PPP frames on 270*4882a593Smuzhiyunthat channel. 271*4882a593Smuzhiyun 272*4882a593SmuzhiyunIn multilink terms, the unit represents the bundle, while the channels 273*4882a593Smuzhiyunrepresent the individual physical links. Thus, a PPP frame sent by a 274*4882a593Smuzhiyunwrite to the unit (i.e., to an instance of /dev/ppp attached to the 275*4882a593Smuzhiyununit) will be subject to bundle-level compression and to fragmentation 276*4882a593Smuzhiyunacross the individual links (if multilink is in use). In contrast, a 277*4882a593SmuzhiyunPPP frame sent by a write to the channel will be sent as-is on that 278*4882a593Smuzhiyunchannel, without any multilink header. 279*4882a593Smuzhiyun 280*4882a593SmuzhiyunA channel is not initially attached to any unit. In this state it can 281*4882a593Smuzhiyunbe used for PPP negotiation but not for the transfer of data packets. 282*4882a593SmuzhiyunIt can then be connected to a PPP unit with an ioctl call, which 283*4882a593Smuzhiyunmakes it available to send and receive data packets for that unit. 284*4882a593Smuzhiyun 285*4882a593SmuzhiyunThe ioctl calls which are available on an instance of /dev/ppp depend 286*4882a593Smuzhiyunon whether it is unattached, attached to a PPP interface, or attached 287*4882a593Smuzhiyunto a PPP channel. The ioctl calls which are available on an 288*4882a593Smuzhiyununattached instance are: 289*4882a593Smuzhiyun 290*4882a593Smuzhiyun* PPPIOCNEWUNIT creates a new PPP interface and makes this /dev/ppp 291*4882a593Smuzhiyun instance the "owner" of the interface. The argument should point to 292*4882a593Smuzhiyun an int which is the desired unit number if >= 0, or -1 to assign the 293*4882a593Smuzhiyun lowest unused unit number. Being the owner of the interface means 294*4882a593Smuzhiyun that the interface will be shut down if this instance of /dev/ppp is 295*4882a593Smuzhiyun closed. 296*4882a593Smuzhiyun 297*4882a593Smuzhiyun* PPPIOCATTACH attaches this instance to an existing PPP interface. 298*4882a593Smuzhiyun The argument should point to an int containing the unit number. 299*4882a593Smuzhiyun This does not make this instance the owner of the PPP interface. 300*4882a593Smuzhiyun 301*4882a593Smuzhiyun* PPPIOCATTCHAN attaches this instance to an existing PPP channel. 302*4882a593Smuzhiyun The argument should point to an int containing the channel number. 303*4882a593Smuzhiyun 304*4882a593SmuzhiyunThe ioctl calls available on an instance of /dev/ppp attached to a 305*4882a593Smuzhiyunchannel are: 306*4882a593Smuzhiyun 307*4882a593Smuzhiyun* PPPIOCCONNECT connects this channel to a PPP interface. The 308*4882a593Smuzhiyun argument should point to an int containing the interface unit 309*4882a593Smuzhiyun number. It will return an EINVAL error if the channel is already 310*4882a593Smuzhiyun connected to an interface, or ENXIO if the requested interface does 311*4882a593Smuzhiyun not exist. 312*4882a593Smuzhiyun 313*4882a593Smuzhiyun* PPPIOCDISCONN disconnects this channel from the PPP interface that 314*4882a593Smuzhiyun it is connected to. It will return an EINVAL error if the channel 315*4882a593Smuzhiyun is not connected to an interface. 316*4882a593Smuzhiyun 317*4882a593Smuzhiyun* All other ioctl commands are passed to the channel ioctl() function. 318*4882a593Smuzhiyun 319*4882a593SmuzhiyunThe ioctl calls that are available on an instance that is attached to 320*4882a593Smuzhiyunan interface unit are: 321*4882a593Smuzhiyun 322*4882a593Smuzhiyun* PPPIOCSMRU sets the MRU (maximum receive unit) for the interface. 323*4882a593Smuzhiyun The argument should point to an int containing the new MRU value. 324*4882a593Smuzhiyun 325*4882a593Smuzhiyun* PPPIOCSFLAGS sets flags which control the operation of the 326*4882a593Smuzhiyun interface. The argument should be a pointer to an int containing 327*4882a593Smuzhiyun the new flags value. The bits in the flags value that can be set 328*4882a593Smuzhiyun are: 329*4882a593Smuzhiyun 330*4882a593Smuzhiyun ================ ======================================== 331*4882a593Smuzhiyun SC_COMP_TCP enable transmit TCP header compression 332*4882a593Smuzhiyun SC_NO_TCP_CCID disable connection-id compression for 333*4882a593Smuzhiyun TCP header compression 334*4882a593Smuzhiyun SC_REJ_COMP_TCP disable receive TCP header decompression 335*4882a593Smuzhiyun SC_CCP_OPEN Compression Control Protocol (CCP) is 336*4882a593Smuzhiyun open, so inspect CCP packets 337*4882a593Smuzhiyun SC_CCP_UP CCP is up, may (de)compress packets 338*4882a593Smuzhiyun SC_LOOP_TRAFFIC send IP traffic to pppd 339*4882a593Smuzhiyun SC_MULTILINK enable PPP multilink fragmentation on 340*4882a593Smuzhiyun transmitted packets 341*4882a593Smuzhiyun SC_MP_SHORTSEQ expect short multilink sequence 342*4882a593Smuzhiyun numbers on received multilink fragments 343*4882a593Smuzhiyun SC_MP_XSHORTSEQ transmit short multilink sequence nos. 344*4882a593Smuzhiyun ================ ======================================== 345*4882a593Smuzhiyun 346*4882a593Smuzhiyun The values of these flags are defined in <linux/ppp-ioctl.h>. Note 347*4882a593Smuzhiyun that the values of the SC_MULTILINK, SC_MP_SHORTSEQ and 348*4882a593Smuzhiyun SC_MP_XSHORTSEQ bits are ignored if the CONFIG_PPP_MULTILINK option 349*4882a593Smuzhiyun is not selected. 350*4882a593Smuzhiyun 351*4882a593Smuzhiyun* PPPIOCGFLAGS returns the value of the status/control flags for the 352*4882a593Smuzhiyun interface unit. The argument should point to an int where the ioctl 353*4882a593Smuzhiyun will store the flags value. As well as the values listed above for 354*4882a593Smuzhiyun PPPIOCSFLAGS, the following bits may be set in the returned value: 355*4882a593Smuzhiyun 356*4882a593Smuzhiyun ================ ========================================= 357*4882a593Smuzhiyun SC_COMP_RUN CCP compressor is running 358*4882a593Smuzhiyun SC_DECOMP_RUN CCP decompressor is running 359*4882a593Smuzhiyun SC_DC_ERROR CCP decompressor detected non-fatal error 360*4882a593Smuzhiyun SC_DC_FERROR CCP decompressor detected fatal error 361*4882a593Smuzhiyun ================ ========================================= 362*4882a593Smuzhiyun 363*4882a593Smuzhiyun* PPPIOCSCOMPRESS sets the parameters for packet compression or 364*4882a593Smuzhiyun decompression. The argument should point to a ppp_option_data 365*4882a593Smuzhiyun structure (defined in <linux/ppp-ioctl.h>), which contains a 366*4882a593Smuzhiyun pointer/length pair which should describe a block of memory 367*4882a593Smuzhiyun containing a CCP option specifying a compression method and its 368*4882a593Smuzhiyun parameters. The ppp_option_data struct also contains a ``transmit`` 369*4882a593Smuzhiyun field. If this is 0, the ioctl will affect the receive path, 370*4882a593Smuzhiyun otherwise the transmit path. 371*4882a593Smuzhiyun 372*4882a593Smuzhiyun* PPPIOCGUNIT returns, in the int pointed to by the argument, the unit 373*4882a593Smuzhiyun number of this interface unit. 374*4882a593Smuzhiyun 375*4882a593Smuzhiyun* PPPIOCSDEBUG sets the debug flags for the interface to the value in 376*4882a593Smuzhiyun the int pointed to by the argument. Only the least significant bit 377*4882a593Smuzhiyun is used; if this is 1 the generic layer will print some debug 378*4882a593Smuzhiyun messages during its operation. This is only intended for debugging 379*4882a593Smuzhiyun the generic PPP layer code; it is generally not helpful for working 380*4882a593Smuzhiyun out why a PPP connection is failing. 381*4882a593Smuzhiyun 382*4882a593Smuzhiyun* PPPIOCGDEBUG returns the debug flags for the interface in the int 383*4882a593Smuzhiyun pointed to by the argument. 384*4882a593Smuzhiyun 385*4882a593Smuzhiyun* PPPIOCGIDLE returns the time, in seconds, since the last data 386*4882a593Smuzhiyun packets were sent and received. The argument should point to a 387*4882a593Smuzhiyun ppp_idle structure (defined in <linux/ppp_defs.h>). If the 388*4882a593Smuzhiyun CONFIG_PPP_FILTER option is enabled, the set of packets which reset 389*4882a593Smuzhiyun the transmit and receive idle timers is restricted to those which 390*4882a593Smuzhiyun pass the ``active`` packet filter. 391*4882a593Smuzhiyun Two versions of this command exist, to deal with user space 392*4882a593Smuzhiyun expecting times as either 32-bit or 64-bit time_t seconds. 393*4882a593Smuzhiyun 394*4882a593Smuzhiyun* PPPIOCSMAXCID sets the maximum connection-ID parameter (and thus the 395*4882a593Smuzhiyun number of connection slots) for the TCP header compressor and 396*4882a593Smuzhiyun decompressor. The lower 16 bits of the int pointed to by the 397*4882a593Smuzhiyun argument specify the maximum connection-ID for the compressor. If 398*4882a593Smuzhiyun the upper 16 bits of that int are non-zero, they specify the maximum 399*4882a593Smuzhiyun connection-ID for the decompressor, otherwise the decompressor's 400*4882a593Smuzhiyun maximum connection-ID is set to 15. 401*4882a593Smuzhiyun 402*4882a593Smuzhiyun* PPPIOCSNPMODE sets the network-protocol mode for a given network 403*4882a593Smuzhiyun protocol. The argument should point to an npioctl struct (defined 404*4882a593Smuzhiyun in <linux/ppp-ioctl.h>). The ``protocol`` field gives the PPP protocol 405*4882a593Smuzhiyun number for the protocol to be affected, and the ``mode`` field 406*4882a593Smuzhiyun specifies what to do with packets for that protocol: 407*4882a593Smuzhiyun 408*4882a593Smuzhiyun ============= ============================================== 409*4882a593Smuzhiyun NPMODE_PASS normal operation, transmit and receive packets 410*4882a593Smuzhiyun NPMODE_DROP silently drop packets for this protocol 411*4882a593Smuzhiyun NPMODE_ERROR drop packets and return an error on transmit 412*4882a593Smuzhiyun NPMODE_QUEUE queue up packets for transmit, drop received 413*4882a593Smuzhiyun packets 414*4882a593Smuzhiyun ============= ============================================== 415*4882a593Smuzhiyun 416*4882a593Smuzhiyun At present NPMODE_ERROR and NPMODE_QUEUE have the same effect as 417*4882a593Smuzhiyun NPMODE_DROP. 418*4882a593Smuzhiyun 419*4882a593Smuzhiyun* PPPIOCGNPMODE returns the network-protocol mode for a given 420*4882a593Smuzhiyun protocol. The argument should point to an npioctl struct with the 421*4882a593Smuzhiyun ``protocol`` field set to the PPP protocol number for the protocol of 422*4882a593Smuzhiyun interest. On return the ``mode`` field will be set to the network- 423*4882a593Smuzhiyun protocol mode for that protocol. 424*4882a593Smuzhiyun 425*4882a593Smuzhiyun* PPPIOCSPASS and PPPIOCSACTIVE set the ``pass`` and ``active`` packet 426*4882a593Smuzhiyun filters. These ioctls are only available if the CONFIG_PPP_FILTER 427*4882a593Smuzhiyun option is selected. The argument should point to a sock_fprog 428*4882a593Smuzhiyun structure (defined in <linux/filter.h>) containing the compiled BPF 429*4882a593Smuzhiyun instructions for the filter. Packets are dropped if they fail the 430*4882a593Smuzhiyun ``pass`` filter; otherwise, if they fail the ``active`` filter they are 431*4882a593Smuzhiyun passed but they do not reset the transmit or receive idle timer. 432*4882a593Smuzhiyun 433*4882a593Smuzhiyun* PPPIOCSMRRU enables or disables multilink processing for received 434*4882a593Smuzhiyun packets and sets the multilink MRRU (maximum reconstructed receive 435*4882a593Smuzhiyun unit). The argument should point to an int containing the new MRRU 436*4882a593Smuzhiyun value. If the MRRU value is 0, processing of received multilink 437*4882a593Smuzhiyun fragments is disabled. This ioctl is only available if the 438*4882a593Smuzhiyun CONFIG_PPP_MULTILINK option is selected. 439*4882a593Smuzhiyun 440*4882a593SmuzhiyunLast modified: 7-feb-2002 441