Point to Point Protocol

References:
rfc (something around 1600)
Documentation/networking/ppp_generic.txt

The support of the Point-to-Point Protocol (ppp) in the kernel consists essentially of four obejcts,


The ppp unit contains a ppp_file, various locks, "flags", "stats", and a pointer to the list of "channels" attached to this unit. It has also a pointer to a net_device ("dev"). The ppp_file can be of two "kind"s: PPP_INTERFACE or PPP_CHANNEL. It has a transmit ("xq") and a receive ("rq") queue. The ppp unit does not point directly to a list of ppp_channels but to a list of channels. The channels are organized in a global list (headed by "all_channels", and with link "list") and in lists of channels per unit (link "clist"). The channel struct has a pointer to the ppp_file, ("file"), one to the "ppp" unit, and one to the ppp_channel ("chan"). The ppp_channel has a pointer to the channel ("ppp") and contains the ppp_channel_ops. These are just two operations,

The net_device contains several data ("hard_header_len", "mtu", "addr_len", "tx_queue_len", "type", "flags"), and the network functions ppp_start_xmit(), ppp_net_stats(), ppp_net_ioctl().

PPP functions

The ppp core is implemented in the file drivers/net/ppp_generic.c

file operations


network functions


input functions


channel functions


interface functions


PPP channels

The first sample channel in the kernel is ppp_asynctty.c which implements a ppp channel over a dedicated line controlled by a terminal (tty) set with a ppp line discipline.
asyncppp

Exercise

[TO DO] Although the ppp already has a traffic loop back facility, write a loopback ppp channel. See ppp_asynctty and ppp_synctty for examples.




PPP line discipline

References:

There are two ppp line disciplines, ppp_asynctty and ppp_synctty, implemented in the files ppp_asynctty.c and ppp_synctty.c, respectively. The two files are very similar, and many of the function are actually equal. Both define a data structure, asyncppp and syncppp, respectively which contains a pointer to the tty, pointers for the packets (socket buffers), state and flags fields, stats, and so on. The line disciplines are named ppp for the async, and pppsync for the sync.



PPP async/sync functions

The "XXXtty_open()" function is called when the tty is put into the ppp line discipline.

line discipline operations


PPP channel functions


I/O functions


Marco Corvi - 2003