I think you are not compiling your kernel module with proper header files. Rather than giving the kernel include path you are either giving user include path or not at all giving any include path at compilation time. on 2.4 kernel, compile with "-I/usr/src/<kernel source dir>/include" option If you are doing it on 2.6 kernel, read the following link: http://www.tldp.org/LDP/lkmpg/2.6/html/x204.htm GD On 4/15/05, rajat swarup <rajats@xxxxxxxxx> wrote: > Hi, > I was writing a hook for netfilter. How should I insert the hook into > the kernel? > Could someone tell me how to compile the hook files. When I compile I > get this error: > ------------------- > In file included from /usr/include/linux/module.h:10, > from ipt_test.c:4: > /usr/include/linux/config.h:5:2: #error Incorrectly using glibc > headers for a kernel module > ipt_test.c:6:26: linux/skbuff.h: No such file or directory > In file included from ipt_test.c:7: > /usr/include/linux/ip.h:97: error: syntax error before "uint8_t" > /usr/include/linux/ip.h:104: error: syntax error before "tot_len" > /usr/include/linux/ip.h:105: error: syntax error before "id" > /usr/include/linux/ip.h:106: error: syntax error before "frag_off" > /usr/include/linux/ip.h:107: error: syntax error before "ttl" > /usr/include/linux/ip.h:108: error: syntax error before "protocol" > /usr/include/linux/ip.h:109: error: syntax error before "check" > /usr/include/linux/ip.h:110: error: syntax error before "saddr" > /usr/include/linux/ip.h:111: error: syntax error before "daddr" > In file included from ipt_test.c:9: > /usr/include/linux/netfilter_ipv4.h:53: error: `INT_MIN' undeclared > here (not in a function) > /usr/include/linux/netfilter_ipv4.h:53: error: enumerator value for > `NF_IP_PRI_FIRST' not integer constant > /usr/include/linux/netfilter_ipv4.h:59: error: `INT_MAX' undeclared > here (not in a function) > /usr/include/linux/netfilter_ipv4.h:59: error: enumerator value for > `NF_IP_PRI_LAST' not integer constant > ipt_test.c:22: warning: "struct net_device" declared inside parameter list > ipt_test.c:22: warning: its scope is only this definition or > declaration, which is probably not what you want > ipt_test.c:22: warning: "struct sk_buff" declared inside parameter list > ipt_test.c: In function `hook_func': > ipt_test.c:26: error: dereferencing pointer to incomplete type > ipt_test.c: In function `init_module': > ipt_test.c:40: error: invalid use of undefined type `struct nf_hook_ops' > ipt_test.c:42: error: invalid use of undefined type `struct nf_hook_ops' > ipt_test.c:43: error: invalid use of undefined type `struct nf_hook_ops' > ipt_test.c:43: error: `PF_INET' undeclared (first use in this function) > ipt_test.c:43: error: (Each undeclared identifier is reported only once > ipt_test.c:43: error: for each function it appears in.) > ipt_test.c:44: error: invalid use of undefined type `struct nf_hook_ops' > ipt_test.c: At top level: > ipt_test.c:12: error: storage size of `nfho' isn't known > ------------------------ > Thanks, > Rajat. > > -- > Kernelnewbies: Help each other learn about the Linux kernel. > Archive: http://mail.nl.linux.org/kernelnewbies/ > FAQ: http://kernelnewbies.org/faq/ > > -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/