Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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