当前位置: 技术问答>linux和unix
添加一个内核模块产生的错误问题
来源: 互联网 发布时间:2016-04-26
本文导语: 偶Linux内核是2.6的,在netfilter下添加了一个模块,用于url过滤。注册的函数代码如下: static struct nf_hook_ops nf_ip_urlfilter_hooks_ops = { .hook = nf_ip_urlfilter_hookfn, .owner = THIS_MODULE, .pf ...
偶Linux内核是2.6的,在netfilter下添加了一个模块,用于url过滤。注册的函数代码如下:
static struct nf_hook_ops nf_ip_urlfilter_hooks_ops = {
.hook = nf_ip_urlfilter_hookfn,
.owner = THIS_MODULE,
.pf = PF_INET,
.hooknum = NF_IP_FORWARD,
.priority = NF_IP_PRI_CONNTRACK - 1,
};
static struct nf_sockopt_ops nf_ip_urlfilter_sockopt_ops = {
.pf = PF_INET,
.set_optmin = IPT_SO_SET_MAX + 30,
.set_optmax = IPT_SO_SET_MAX + 35,
.set = nf_ip_urlfilter_set,
.get_optmin = IPT_SO_GET_MAX + 30,
.get_optmax = IPT_SO_GET_MAX + 35,
.get = NULL,
};
static int __init ip_urlfilter_init( void )
{
int i_ret = -1;
p_list_head = NULL;
i_url_list_mode = -1;
i_ret = nf_register_hook( &nf_ip_urlfilter_hooks_ops );
if( i_ret