PPP(4) BSD Programmer's Manual PPP(4)NAME
ppp - Point-to-Point Protocol (PPP)
SYNOPSIS
#include <sys/types.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <net/pppioctl.h>
options PPPDESCRIPTION
The Point-to-Point Protocol (PPP) provides a method for transmitting
datagrams over serial point-to-point links. The current implementation
supports dedicated synchronous and asynchronous circuits as well as dial-
up telephone links.
The kernel configuration option PPP should be defined to include the rel-
evant code in the kernel.
PROTOCOL OPTIONS
There are a number of configurable PPP options which may be set or exam-
ined with interface request ioctl(2) calls. Before loading or examina-
tion of the options the ifreq structure should be initialized as:
struct ifreq ifr;
struct ppp_ioctl *pio = ifr_pppioctl(&ifr);
...
strncpy(ifr.ifr_name, interface_name, sizeof ifr.ifr_name);
ioctl(socket, PPPIOCGSTATE, &ifr);
The ppp_ioctl structure is defined as:
struct ppp_ioctl {
u_short ppp_control;
u_short ppp_flags;
u_short ppp_mtu;
u_short ppp_idletime;
u_long ppp_txcmap;
u_long ppp_rxcmap;
};
The ppp_control field controls the usage of the rest of the fields. The
available values, which are ORed together are:
PPP_CLRF Clear the flag bits specified in ppp_flags. See the defini-
tion of the values for ppp_flags below.
PPP_ADDF Or in the flag bits specified in ppp_flags.
PPP_SETF Set the flags to exactly that set in ppp_flags. PPP_SETF
takes precedence over PPP_CLRF and PPP_ADDF.
PPP_CLRTX Clear the bits in the transmit character map specified in
ppp_txcmap. Each bit in this map represents one of the 32
control characters with the low order bit corresponds to the
null character and the high order bit corresponds to code
037 (US). If set, the corresponding control character will
not be sent on asynchronous lines, an escape sequence will
be used to represent the character in this case.
PPP_ADDTX Or in the bits in the transmit character map specified in
ppp_txcmap.
PPP_SETTX Set the transmit character map to ppp_txcmap. PPP_SETTX
takes precedence over PPP_CLRTX and PPP_ADDTX.
PPP_CLRRX Clear the bits in the receive character map specified in
ppp_txcmap. Similar to the transmit character map, this map
determines the control characters that should not be trans-
mitted by the remote side.
PPP_ADDRX Or in the bits in the receive character map specified in
ppp_txcmap.
PPP_SETRX Set the receive character map to ppp_txcmap. PPP_SETRX
takes precedence over PPP_CLRRX and PPP_ADDRX.
PPP_SETMTU Set the maximum number of bytes the that may be transmitted
in a single packet to the value of ppp_mtu.
PPP_SETIDLE Set the idle timer to the value of ppp_idletime. If no out-
going data packets are processed within the specified number
of seconds the connection will be dropped.
PPP_FLUSHQ Toss all packets on the output queues.
PPP_FLUSHDQ Toss all packets on the deferred queue.
PPP_PROCDQ Process the packets on the deferred queue.
PPP_SLCINIT Initialize the VJC compression table.
The following values may be ORed together in the ppp_flags field:
PPP_PFC Protocol field compression. This option eliminates an ex-
tra byte in the PPP packet header which can be useful on
slow links but can cause computing overhead on fast syn-
chronous links.
PPP_ACFC Address and control fields compression. This option re-
duces the size of the PPP packet header by two bytes, which
can be useful on slow links but can cause computing over-
head on fast synchronous links.
PPP_TCPC Van Jacobson's TCP header compression. This option enables
the compression of TCP headers by eliminating the redundant
information in the headers of consecutive TCP packets, re-
ducing the protocol overhead by up to 100 bytes per packet
which may be really critical for performance of interactive
telnet(1) or rlogin(1) sessions. However, VJ TCP compres-
sion requires keeping state information about every TCP
session on both ends (up to 16 simultaneous sessions) and
is not really useful on fast links connecting large net-
works. The TCP compression does not affect UDP and ICMP
packets.
PPP_FTEL Priority queuing. This flag enables high-priority queueing
of ``interactive'' TCP packets (with source or destination
ports assigned to services like telnet or the control con-
nection of ftp(1)), effectively giving them precedence
over all other IP packets. This can reduce response time
on links with mixed file transfer and interactive traffic.
PPP_IPOKAY Allow IP packets to be received on this interface.
PPP_IPREJECT Reject any IP packets received on this interface.
PPP_RUNNING Mark this interface as running.
The default flags on asynchronous links are PPP_PFC, PPP_ACFC, PPP_TCPC
and PPP_FTEL; on synchronous links, the default is PPP_FTEL.
PROTOCOL CONTROL OPERATIONS
The following ioctl(2) requests are supported:
PPPIOCGSTATE Get the current ppp state associated with this interface.
PPPIOCSSTATE Set the ppp state associated with this interface.
PPPIOCWAIT Wait on the interface until an outgoing data packet will be
deferred or dropped because the link-level protocol and/or
physical link are not active. This operation is useful for
servicing dial-on-demand PPP links. Packets dropped be-
cause the interface is administratively down (i.e. the in-
terface flag IFF_UP is not asserted) will not interrupt the
waiting.
These additional ioctl(2) requests are specific to the PPP Multilink Pro-
tocol. The layout of the structures used with these calls are:
/* Endpoint Discriminator and Authentication information */
struct ppp_ed {
u_char ed[20]; /* The Endpoint Discriminator */
short ed_type; /* Endpoint Discriminator type */
u_short ed_len; /* Length of discriminator */
};
struct ppp_auth {
u_char auth_name[64]; /* Authentication name */
u_short auth_len;
};
struct ifpppreq {
char ifrp_name[IFNAMSIZ]; /* if name, e.g. "ppp0" */
union {
struct ppp_ioctl ifrpu_ioctl;
struct {
struct ppp_ed ifrps_ed;
struct ppp_auth ifrps_auth;
} ifrpu_ifrps;
char ifrpu_pif[IFNAMSIZ]; /* pif name, e.g. "pif0" */
u_long ifrpu_mrru;
} ifrp_ifrpu;
#define ifrp_ioctl ifrp_ifrpu.ifrpu_ioctl
#define ifrp_ed ifrp_ifrpu.ifrpu_ifrps.ifrps_ed
#define ifrp_auth ifrp_ifrpu.ifrpu_ifrps.ifrps_auth
#define ifrp_pif ifrp_ifrpu.ifrpu_pif
#define ifrp_mrru ifrp_ifrpu.ifrpu_mrru
};
PPPIOCGID Get the Endpoint Discriminator and Authentication name as-
sociated with "ifrp_name".
PPPIOCSID Set the Endpoint Discriminator and Authentication name for
"ifrp_name". This associates the IF with a Parallel Inter-
face (PIF), and turns on the Multilink Protocol. If there
isn't an existing PIF with the same discriminator and au-
thentication information, one will be allocated. The PIF
that the IF is assigned to is returned in "ifrp_pif".
PPPIOCFID Given the Endpoint Discriminator and Authentication name,
find the associated PIF and return its name in "ifrp_pif".
PPPIOCCID Clear the Endpoint Discriminator and Authentication name.
PPPIOCGPIF Get the Parallel Interface name associated with the inter-
face, and return it in "ifrp_pif".
PPPIOCGMRRU Get the Maximum Receive Reconstructed Unit.
PPPIOCSMRRU Set the Maximum Receive Reconstructed Unit.
Since synchronous interfaces support more than one link-level protocol,
PPP must be selected before the above ioctl requests can be used. To se-
lect PPP on synchronous interfaces the linktype ppp parameter to ifcon-
fig(8) should be used.
SEE ALSOioctl(2), socket(2), appp(4), intro(4), p2p(4), ifconfig(8), ppp(8)
W. Simpson, The Point-to-Point Protocol (PPP) for the Transmission of
Multi-protocol Datagrams over Point-to-Point Links, RFC 1331, May 1992.
G. McGregor, The PPP Internet Protocol Control Protocol (IPCP), RFC 1332,
May 1992.
K. Sklower, B. Lloyd, G. McGregor, D. Carr, T. Coradetti, The PPP Multi-
link Protocol (MP), RFC 1990, August 1996.
BUGS
Currently only the IP transport level is supported; future releases may
be extended to include OSI and Xerox NS.
BSD/OS August 15, 1996 4