[LCP]Netfilter hook programming

anu suthakaran anu_suthakaran at hotmail.com
Tue Dec 23 22:30:59 UTC 2003


Hi !

  We were trying to use netfilter on the pre-routing hook which jus simply 
drops the packet at the hook.............but somehow our netfilter file does 
not have all the declarations .  The contents of our 
/usr/include/linux.netfilter.h are :

ifndef __LINUX_NETFILTER_H
#define __LINUX_NETFILTER_H

/* Responses from hook functions. */
#define NF_DROP 0
#define NF_ACCEPT 1
#define NF_STOLEN 2
#define NF_QUEUE 3
#define NF_REPEAT 4
#define NF_MAX_VERDICT NF_REPEAT

/* Generic cache responses from hook functions. */
#define NFC_ALTERED 0x8000
#define NFC_UNKNOWN 0x4000

#endif /*__linux_netfilter_h*/

  The hook_func structure and its dependent structures are not 
defined......so we got the following error on compiling the program :

[root at project-15 root]# gcc guhu1.c
guhu1.c:7:32:  linux/module.h : No such file or directory
guhu1.c:8:32:  linux/kernel.h : No such file or directory
guhu1.c:9:35:  linux/netfilter.h : No such file or directory
guhu1.c:10:40:  linux/netfilter_ipv4.h : No such file or directory
guhu1.c:20: warning: `struct net_device' declared inside parameter list
guhu1.c:20: warning: its scope is only this definition or declaration, which 
is probably not what you want
guhu1.c:20: warning: `struct sk_buff' declared inside parameter list
guhu1.c: In function `hook_func':
guhu1.c:22: `NF_DROP' undeclared (first use in this function)
guhu1.c:22: (Each undeclared identifier is reported only once
guhu1.c:22: for each function it appears in.)
guhu1.c: In function `init_module':
guhu1.c:29: invalid use of undefined type `struct nf_hook_ops'
guhu1.c:30: invalid use of undefined type `struct nf_hook_ops'
guhu1.c:30: `NF_IP_PRE_ROUTING' undeclared (first use in this function)
guhu1.c:31: invalid use of undefined type `struct nf_hook_ops'
guhu1.c:31: `PF_INET' undeclared (first use in this function)
guhu1.c:32: invalid use of undefined type `struct nf_hook_ops'
guhu1.c:32: `NF_IP_PRI_FIRST' undeclared (first use in this function)
guhu1.c: At top level:
guhu1.c:13: storage size of `nfho' isn't known
[root at project-15 root]#


         What must we do..........pl help.
                                                                             
           Anu Suthakaran

_________________________________________________________________
Free transactions in any ATM across India. 
http://server1.msn.co.in/msnleads/suvidha/dec03.asp?type=hottag Click here.




More information about the linuxCprogramming mailing list