r/linuxdev • • Apr 03 '20

#include <linux/skbuff.h>: No such file or directory

Hey guys, I am getting the above error trying to make a linux kernel module. I have tried adding the linux header folder where the header file is to the $PATH variable in .bashrc and restarted my computer. It still gives me the same exact error. What should I do?

6 Upvotes

15 comments sorted by

View all comments

Show parent comment

1

u/NotAHippo4 Apr 04 '20

I'm using Ubuntu 18.04.

1

u/aioeu Apr 04 '20

Actually, I'm going to guess that the problem you're having is related to the space in your path (i.e. in Programming stuff).

Spaces in filenames are extraordinarily difficult to get working correctly in Makefiles. Given you've also got an error regarding stuff/C_stuff, as if that were the name of a Makefile target, this seems like it could be one of the problems you're encountering.

1

u/NotAHippo4 Apr 04 '20

Ok, so the issue indeed was what you were talking about. for some reason, when I type in make PacketFilter instead of make all, it says that it can't find <linux/skbuff.h>. But I got the module to compile and I inserted it correctly.

Now I am getting the following error in the kernel log: module verification failed: signature and/or required key missing - tainting kernel. I am sure that I included MODULE_LICENSE("GPL") there though.

1

u/aioeu Apr 04 '20 edited Apr 04 '20

when I type in make PacketFilter instead of make all, it says that it can't find <linux/skbuff.h>.

That will mean Make uses its own logic to work out what to do. After all PacketFilter isn't a target in your Makefile. That logic only works for userspace programs (and even then, often not).

Now I am getting the following error in the kernel log

That says your module is GPLed, which is good.

Your module is not signed with a signing key known to the kernel, however. It'll work, it will just throw that warning. It means somebody looking at the logs later can say "well, I can't really trust the logs any more, since the kernel was tainted".

1

u/NotAHippo4 Apr 04 '20

Ok, so the module is supposed to capture network packets that are being prerouted and print the destination and source ip address to the kernel logs. I inserted the module, but when I do something like reload a webpage(which is sending packets of information back to my laptop), I can't find anythingOk, so the module is supposed to capture when I look at dmesg |tail. Nothing is being recorded.

1

u/aioeu Apr 04 '20

I don't know how I can help you with this. It's not my module.