>>>>> "jamal" == jamal <hadi@xxxxxxxxxx> writes:
jamal> -Hard coded for PPPOE -Creating a whole socket family for
jamal> just PPPOE is a bad idea (claim: Could make it for PPPOX
jamal> with type PPPOE, L2TP etc).
What about a generic ´ppp over socket´ paradigm which would eliminate
the need of special protocol families for each ppp carrier?
I´was thinking about it like this:
- Connection is controlled via usual socket system calls (bind(), connect(),
accept(), setsockopt(), ...)
- a special ioctl() allows for attaching a ppp channel to a socket is provided.
After successful completion of that ioctl(), a struct ppp_channel will
have been created. The socket´s protocol stack will pass incoming
data upstream by calling ppp_input() instead of appending
the frame to sk->receive_queue. The ppp_channel_ops´ queue_xmit()
method will pass the frame to the protocol engine´s output method.
I think that for SOCK_PACKET and SOCK_SEQ_PACKET sockets, this could be
implemented rather generically by providing some standard hook functions
for the struct sock callbacks (e.g. ppp_input() might be called from
sk->data_ready()). (However, a certain amount of protocol specific
code will be necessary because different ppp carrier protocols use
different methods to encapsulate ppp frames).
ppp connections would be set up like this:
- pppd creates socket corresponding to ppp carrier, e.g.
PPP over ethernet: s = socket(PF_PACKET,SOCK_PACKET,ETH_P_PPPOE);
PPP over X.25: s = socket(PF_X25,SOCK_SEQ_PACKET,0);
PPP over YOUR_FAVOURITE_CARRIER_PROTOCOL:
s = socket(PF_YOUR_FAVORITE_FAMILY,SOCK[_SEQ]_PACKET,?);
(please forgive me that i don´t know the paramters for
YOUR_FAVOURITE_CARRIER by heart, but the above should extend easily to
things like PPP over ATM, PPP over IRDA or PPP over UDP)
- pppd directly (by means of connect() or accept()) or indirectly
(by means of protocol family specific utility programs) establishes
carrier connection of desired type.
- When carrier connection is established, pppd executes
which attaches the data path of the socket to a ppp channel.
- after that, pppd continues to process the ppp protocol proper.
- pppd might perform further socket connection control triggerd by local
events or remote events. E.g. additional channels might be set up or closed
when MPPP negotiation is indicationg this.