for a project we want to modify all data that is moving across the network stack. This should ideally be protocol independent and should blend seamlessly into the "normal" networking stack.
Basically every bit of data has to be routed over our device first, before passing it on to the rest of the network stack. In this picture the device should be somewhere in/between the second and third layer.
My first idea was to modify the code in socket.c (this image shows the usual kernel flow for network data) to write the data to our device first before proceeding with the normal operation, but it would be better to have this functionality loadable (with a kernel module for example) so the user can turn it of if he wants to.
So my question is: is there any way I can write a kernel module to insert into the network stack to get and modify incoming and outgoing data?
Thanks a lot in advance!