I figured I'd get around to it, so now I have. Firstly, note that compiling your module with gcc 3.3.2 and your kernel with 2.95 leads to many strange and wonderful effects. The basic structure is the server holding one UDP socket and each session is represented by a PPPoX socket which is connect()ed to the UDP socket. This has been tested and data has flowed back and forth. Note that as long as the socket hasn't been bound to a PPP device, you can just read/write as a normal socket, so you don't even have to run PPP over it if you don't want. Also, the code is not really specific to UDP either. Basically, I need help with a few small things: 1. While this module provides socket setup/shutdown, encapsulation and decapsulation, what other features are necessary for it to be useful? 2. Locking. I've put in all the obvious locking that I could see other modules doing but I really have no idea if it's enough. 3. Packet transfer. Currently the module hooks into the UDP sockets data_ready() hook and then scans the received packet list for the skb to process. This is tedious at best and error prone/race condition at worst. Unfortunatly I couldn't get any of the other hooks to work. UDP has some code in there to handle encapsulations but it's impossible for a module to hook into. A small tweak to udp_encap_rcv() to call a function pointer would be enough to simplify the transfer process. Note: while data has been tranferred back and forth between the session sockets, I have not yet got PPP to use them because pppd requires the FD to be a character device. My test system does not have a new pppd yet but I've written an (lightly tested) pppd plugin whose sole purpose in life is to tell pppd to use the PPPoX socket directly. There are a bunch of test programs in the tests/ subdir if you want to see it in action. Currently all tested under UML and the module unloads properly afterwards. A file in made in /proc to track all current sessions. It looks something like: ========================== sock * :l_sock *:userdata Address a1011840:a0378600:a0378600 00000000:1702 Y MAGIC OK sock * :session*:userdata Address :Port SAddrT:S -> DAddrT:S S a1011c00:a037ea20:a037ea20 7F000001:1701 0003/0004 -> 0001/0002 1 Y MAGIC OK a1011480:a0378400:a0378400 00000000:1701 Y MAGIC OK sock * :session*:userdata Address :Port SAddrT:S -> DAddrT:S S a10110c0:a037e9e0:a037e9e0 7F000001:1702 0001/0002 -> 0003/0004 1 Y MAGIC OK ========================== It needs a bit of polish and there's still a lot of debug code in the in general, but it does work. The only changed required in the kernel in some small bits added to if_pppox.h (included). The rest is entirely self contained. See README for more details. If anyone would like to try it out, the code is at: http://svana.org/kleptog/kl2tp/kl2tp-0.1.tar.gz Have a nice day. I'll be back to answer questions in the morning. -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > "All that is needed for the forces of evil to triumph is for enough good > men to do nothing." - Edmond Burke > "The penalty good people pay for not being interested in politics is to be > governed by people worse than themselves." - Plato
Attachment:
pgp00119.pgp
Description: PGP signature