[Click] linuxpatchless

Harald Schiöberg harald at net.t-labs.tu-berlin.de
Wed Nov 25 15:02:34 EST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

this is the promised explanation of the linuxpatchless project. At least
how I remember it, so please share whatever I got wrong.

On the developer day of the syclick symposium, roughly 10 people started
a discussion of how great it would be to run kernel level click without
the need for a kernel patch.
Most of us were driven by the demand to run click on OpenWRT, which is
close to impossible given the current hassle with click's patches and
the speed OpenWRT evolves.

So we looked at what is there and found:

- - a huge mess of syntactic patches, which serve the purpose of allowing
the kernel includes to be used by C++
- - a small functional patch which adds click's hooks to grab packets from
the kernel and to add the polling driver for intel e1000 cards

some folks around Adam started to split those different parts into the
two relevant parts, and afaik have succeeded.

On the syntactic patches:
We agreed that instead of patching the kernel sources in the kernel, we
 would better copy a build time the include/ hierarchy to click's build
dir and patch them there.

Eddie started to pick up on his patch-making perl magic and tries to
write some magic to automatically mangle those into C++ compliance
independently from the kernel version used.

For documentation:
Everthing should be simple almost regular expressions, like the notorious
- - asm ( foo :: bar )
+ asm ( foo : : bar )
One notable exception:
the current click patch changes
- - struct foo {}
+ EMPTY_STRUCT_DECL(foo)
The EMPTY_STRUCT_DECL is one byte long, because empty structs are one
byte in C++ but zero bytes in C. so this actually changes linux's
internal structures. The prosed solution it to redefine that into a
char[0] with is also zero bytes in C++, so we can still interface with
the now unpatched structures of the kernel.

On the functional patches:
We will try to exchange anything in the linuxpatchless directory that
accesses one of click's hooks into something that uses a similar linux
hook instead. Probably only the FromDevice and ToDevice Elements will
have to be updated.
The theory converged on registering click with dev_add_pack() and then
overwriting skb->protocol in the received sk_buffs to prevent other's
from handling the packet as well...
Whoever feels more practical: post your patches ;-)

That's all I remember on that part, a BIG THANK YOU again to the
organizers of syclick who made all that possible in the first place.

- --
Harald Schiöberg
Technische Universität Berlin | T-Laboratories | FG INET
www: http://www.net.t-labs.tu-berlin.de
Phone: +49-(0)30-8353-58476 | Fax: +49-(0)391 534 783 47
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFLDY1ay8wrZ9OvkU0RAniwAJ9slIU/lUypJovGmTYIfMKW5G5hXwCfWCi0
ay61mfOJbRUcXRlXEeg9Xdc=
=Udn3
-----END PGP SIGNATURE-----



More information about the click mailing list