Problem in Plugging into Netfilters Hooks
Hi,
I have a written a small module to hook into NF_IP_LOCAL_IN hook .To get the packet I initialize the nf_hook_ops structure and passes to the
`nf_register_hook' and I do the samething for nf_unregister_hook'.
But when I compile following errors are coming.
error: variable 'nf_hook' has initializer but incomplete type.
error: extra brace group at end of initialzer error:(near initialization for 'nf_hook')
here is the code
#define MODULE
#define __KERNEL__
#include<linux/config.h>
#include<linux/module.h>
#include<linux/version.h>
#include<linux/netfilter.h>
#include<linux/netfilter_ipv4.h>
#define fw_priority 2
static unsigned int fw_incoming(unsigned int hook, struct sk_buff **pskb,
const struct net_device *indev, const struct net_device *outdev, int (*okfn) (struct sk_buff *))
{
return FW_ACCEPT;
}static struct nf_hooks_ops nf_hook =
{{NULL,NULL},fw_incoming,PF_INET,NF_IP_LOCAL_IN,
fw_priority};int init_module(void)
{
if(nf_register_hook(&nf_hook) < 0)
{
printk("\n\n\tERROR..Main main jinglala ");
return -1;
}
else
{
printk("\n\n\tSuccessfully registered");
}
return 0;
}void cleanup_module(void)
{
nf_unregister_hook(&nf_hook);
printk("\n\n\tFirewall unregistered");
}If any body knows how to solve this problem ,please guide me.
thanks
babula
Quoted 6 lines · A Babula
I have a written a small module to hook into
NF_IP_LOCAL_INhook .To get the packet I initialize thenf_hook_opsstructure and passes to the
`nf_register_hook' and I do the samething fornf_unregister_hook'.
But when I compile following errors are coming.static struct
nf_hooks_opsnf_hook=
There is an s too many there...
Regards
Henrik