Skip to contentSkip to conversation

Problems Compiling userspace NF_QUEUE handler

DISCUSSION Joe Clark 1 participant 1 message Sep 13, 2004

lore
Share & tools
lore

Joe Clark

author
#0 lore raw

Hi there. I'm trying to compile a userspace app that will receive and later reinject packets from a kernel space module (NF_QUEUE). The kernel module seems to compile okay, but when I try to compile and link the userspace app, I get implicit declarations and undefined references. The kernel source tree (and the kernel I'm running) *should* have the netfilter stuff configured (CONFIG_NETFILTER=y in .config).

Here are the errors from make:
gcc -Wall -I/root/linux-2.4.22-jec/include delay.c -o jdelay delay.c: In function `process_packet':
delay.c:185: warning: implicit declaration of function nf_reinject' delay.c: In function main':
delay.c:250: warning: implicit declaration of function nf_register_queue_handler' /root/tmp/cc2fwl5V.o(.text+0x21f): In function process_packet':
: undefined reference to nf_reinject' /root/tmp/cc2fwl5V.o(.text+0x25d): In function process_packet':
: undefined reference to nf_reinject' /root/tmp/cc2fwl5V.o(.text+0x3e5): In function main':
: undefined reference to `nf_register_queue_handler'
collect2: ld returned 1 exit status
make: *** [jdelay] Error 1

I think I need to define __KERNEL__ to get this to work (even though it's not really in the kernel...) but then I get a ton of parse errors and identifiers redefined between my kernel source and /usr/include/ files. Is there a "smart" way to do this or is it all kinda hacky?

Any ideas on what I'm doing wrong? Thanks.
-- Joe Clark