1

I am writing a sniffing tool and I want to use the radio tap parser (radiotap.c) whose prototypes are available in net/cfg80211.h

I included the header but when compiling I get the error that there is no such file or directory.

Now I downloaded several linux-headers (like linux-headers-4.4.0-1-common) and used make headers_install but the header file is still not found when compiling since it wasnt copied into any of the directories that are specified as include paths. Do I have to do this manually?

Another thing that I tried was to add the path to the my make file with -I (right into the /usr/src/linux-headers-xyz/include directory). But then I got the error that other header files were missing (the ones that were included by cfg80211.h) so I thought that wasnt the right way to go since I would have to include many more header files by hand.

Were am I going wrong? I've been googling for quite a while now and to me it seems that using "make headers_install" should do the trick - it doesnt for me.

  • Your sniffing tool is a user-mode utility, correct (not part of the kernel)? – Peter L. Mar 14 '17 at 21:52
  • That is correct. – night_sky42 Mar 15 '17 at 20:11
  • `make headers_install` is the correct way to sanitize kernel headers for use by user code. Not sure why some of the header structures are not made available, perhaps they are only meant to be used from within the kernel. You definitely should not be trying to include all of the dependent kernel headers by hand. In the past, I have duplicated only the required structs in my own user headers. There has to be a better way. – Peter L. Mar 15 '17 at 21:23
  • Yes, I figured it out - or more like - I did not use the cfg80211.h. Instead I used the radiotap-library and copied the src files (radiotap.c/h, parse.c etc) into my project. Thanks for the help! – night_sky42 Apr 04 '17 at 19:49

0 Answers0