I'm writing a kernel module for OpenWRT that registers a callback to an hook with NetFilter.
This callback needs to receive UDP messages.
Standard sockets cannot be used in this environment because sock_recvmsg causes a Kernel Panic. According to this question the netpoll API should do the trick.
But when I compile my module, this message is showed:
WARNING: "netpoll_send_udp" [/home/user/Desktop/netpoll/my_netpoll.ko] undefined!
probably the reason is that netpoll.c is not compiled with the rest of OpenWrt (the netpoll.c file is present, but there is no netpoll.o).
OpenWRT is compiled for the MIPS architecture, as described here.
Is there any flag or additional way to compile netpoll in OpenWrt?
I searched for the keyword "netpoll" in "make menuconfig" without success.
Recently I also was trying to do things using NetPoll, but after looking in 2 e-books about Kernel Networking, google, wikipedia, forums, git... I just reached the conclusion that NetPoll is just some of the obscure things inside the Linux Kernel. It is NOT documented anywhere (actually I found a slideshow of 5 years ago, but very outdated and the structures and funcions have changed a little since then).
I didn't got into using and testing it because I will try something else, but I dit got my module compiled with NetPoll!
There is a NetPoll CONFIG option, but it is not selectable.
There are two ways of having it compiled:
Say YES to "CONFIG_NETCONSOLE". It depends on CONFIG_NETPOLL, so it will activate NetPoll.
Or you can manually edit the file "drivers/net/Kconfig". There you'll look for the line "config NETPOLL". Change it and make it be only three lines:
config NETPOLL
bool "NetPoll support"
default y
And do the same with NET_POLL_CONTROLLER:
config NET_POLL_CONTROLLER
bool "NetPoll controller support"
default y
And voila :) Now NetPoll will ALWAYS be compiled builtin in your kernel.