|
#define __KERNEL__
#define MODULE
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/config.h>
#include <linux/netfilter_ipv4.h>
#include <net/ip.h>
#include <linux/inet.h>
#define PERMIT_PORT 80//只允许访问TCP的80端口
static unsigned int input(unsigned int hooknum, struct sk_buff **pskb,
const struct net_device *in, const struct net_device *out,
int (*okfn) (struct sk_buff *))
{
return NF_ACCEPT;
}
static struct nf_hook_ops filter;
//={{NULL,NULL},input,PF_INET,NF_IP_PRE_ROUTING,NF_IP_PRI_FILTER-1};
int init_module (void)
{
printk("Load Module \n");
// nf_register_hook(&filter);
return 0;
}
void cleanup_module (void)
{
printk ("UnLoad Module\n");
//nf_unregister_hook(&filter);
return;
}
MODULE_LICENSE("GPL");
编译错误如下:
gcc -I /usr/src/linux-2.4/include/ -c test1.c
test1.c:21: storage size of `filter' isn't known
网上GOOGLE了很久,找到了类似问题但都没解决,请高手指教
不过有的机子上能编译通过,但有的不行,我的机子也不行
我查了下nf_hook_ops这个结构我定义的完全正确,不知道有没人遇到过类似问题 |
|