netfilter钩子函数模块编程错误

4310阅读 0评论2013-07-01 zsszss0000
分类:LINUX

这两天 学习netfilter钩子函数编程。
按照网上的教程进行 结果总是出错!
自己的编写的内核模块内购挂载,但是ping 自己的主机就会崩溃!
于是仔细查了一下原因 !
终于知道,内核中的钩子函数原型发生了改变
由 typedef unsigned int nf_hookfn(unsigned int hooknum,
                               struct sk_buff **skb,
                               const struct net_device *in,
                               const struct net_device *out,
                               int (*okfn)(struct sk_buff *));
变为
typedef unsigned int nf_hookfn(unsigned int hooknum,
                               struct sk_buff *skb,
                               const struct net_device *in,
                               const struct net_device *out,
                               int (*okfn)(struct sk_buff *));
而我是在linux-3.8的内核上进行学习的,而网上很多教程根据linux2.6.24之前的数据结构来编写的
这真是太坑爹了!

上一篇:netfilter整体架构解析初步
下一篇:ubuntu 12.04 安装wireshark