问一个sk_buff的问题
firewall.c
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>
#include <linux/skbuff.h>
#if LINUX_VERSION_CODE>=KERNEL_VERSION(2,4,9)
MODULE_LICENSE("GPL");
MODULE_AUTHOR("XXX@hotmail.com");
#endif
static struct nf_hook_ops nfho;
static unsigned char* drop_ip="\x7f\x00\x00\x01";
unsigned int hook_func(unsigned int hooknum,
struct sk_buff** skb,
const struct net_device* in,
const struct net_device* out,
int(*okfn)(struct sk_buff*))
{
struct sk_buff* sb=*skb;
if (sb->nh.iph->saddr==*(unsigned int*)drop_ip)
{
return NF_DROP;
}
else
{
return NF_ACCEPT;
}
}
int init_module()
{
nfho.hook=hook_func;
nfho.hooknum=NF_IP_PRE_ROUTING;
nfho.pf=PF_INET;
nfho.priority=NF_IP_PRI_FIRST;
nf_register_hook(&nfho);
return 0;
}
void cleanup_module()
{
nf_unregister_hook(&nfho);
}
makefile:
CC=gcc
MODFLAGS := -Wall -DMODULE -D__KERNEL__ -DLINUX -I/usr/src/linux-2.4.20-8/include/
firewall.o:firewall.c
$(CC) $(MODFLAGS) -c firewall.c -o firewall.o
insmod firewall.o
我make的时候,它说if (sb->nh.iph->saddr==*(unsigned int*)drop_ip)这行 dereferencing pointer to incomplete type.
请问应该怎么改?