Recently, I tried to familiarize myself with the Linux Networking drivers and device drivers (both with similar O'Reilly book titles) and the ultimate goal of UDP offloading. I have already implemented UDP on NIC, but now the hard part ...
Instead of asking for help for this larger purpose, I was hoping that someone could clarify for me the specific fragment that I found, which is part of LKM, which registers the new protocol (OTP), which acts as a filter between the device driver and network stack.
http://www.phrack.org/archives/55/p55_0x0c_Building%20Into%20The%20Linux%20Network%20Layer_by_lifeline%20&%20kossak.txt
(Note: this Phrack article contains three different modules, the code for OTP is at the bottom of the page)
In the init function of his example, he has:
otp_proto.type = htons(ETH_P_ALL); otp_proto.func = otp_func; dev_add_pack(&otp_proto);
which (if I understand correctly) should register otp_proto as a packet sniffer and put it in the ptype_all data structure. My question is about dev_add_pack.
In this case, the protocol registered as a filter will always be located at this level between L2 and the device driver? Or, for example, can I do this filtering between the application and transport layers (analyze socket parameters) using the same process?
I apologize if this is confusing - I have some problems wrapping my head around the bigger picture when it comes to modules that change the functionality of the kernel stack.
thanks
module linux-kernel networking protocols
Andrew G
source share