免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
1234下一页
最近访问板块 发新帖
查看: 13753 | 回复: 37
打印 上一主题 下一主题

PF_RING安装问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-06-28 00:17 |只看该作者 |倒序浏览
本帖最后由 pkxpp 于 2011-06-28 11:23 编辑

最近在安装PF_RING,但是老是装不上,我是照着一个很详细的帖子做的,下载内核以及补丁,然后编译内核一直不能通过。有个错误是ip_defrag的错误,后面还说一些函数没定义之类的。网上有个帖子最后是换了个版本2.6.18的,但是我换了几个,都还是这个问题。
  这主要是什么原因?
  希望高手帮助解决,或者有什么好的建议。
  多谢了!
【补充】
我是按照网上的步骤(CentOS,Linux内核2.6.18-194.el5):

uname -r 显示2.6.25-14.fc9.i686,修改版本
./mkpatch.sh 下载版本内核
zcat linux-2.6.25-1-686-smp-PF_RING.patch.gz | patch -p0  ,给 linux-2.6.25/ 下的源码打补丁
cd linux-2.6.25
vi Makefile 在这个地方加上一个自定义的后缀(比如-PF_RING):
   EXTRAVERSION = -PF_RING

配置并编译内核!(灰色指令是可选的)
make mrproper        # (不建议)清除以前编译的内核文件。因为是新解压的,保持原始状态就好,不建议用这个

make oldconfig     # 读取当前内核的配置(相当重要,这步能省好多配置工作,而且保证生成的.config能直接使用)
                     # 其间会提示 PF_RING xxxx [N/y/m/?] (NEW) ,注意按y选择把PF_RING给加进去,其他的选择按回车默认即可
                     # 不过注意,如果编译的内核版本较当前的新,会有很多(NEW)标记的提示,此时要是找不到PF_RING,建议先全部回车跳过

make menuconfig    # 如果之前把PF_RING也跳过了,这里可以进去重新选上

以上的准备工作都能够完成,但是在接下来的make这里却出现了错误:
  CC [M]  net/ring/ring_packet.o
net/ring/ring_packet.c:159: error: conflicting types for 'p_defrag'
include/net/ip.h:323: error: previous declaration of 'ip_defrag'was here
net/ring/ring_packet.c: In function 'ring_gather_frags':
net/ring/ring_packet.c:273: warning: implicit declaration of function 'ip_hdr'
net/ring/ring_packet.c:273: warning: passing argument 1 of 'ip_send_check'makes
pointer from integer without a cast
net/ring/ring_packet.c: In function 'ring_proc_init':
net/ring/ring_packet.c:527: error: 'init_net'undeclared (first use in this function)
net/ring/ring_packet.c:527: error: (Each undeclared identifier is reported only once
net/ring/ring_packet.c:527: error: for each function it appears in.)
net/ring/ring_packet.c: In function 'ring_proc_term':
net/ring/ring_packet.c:559: error: 'init_net'undeclared (first use in this function)
net/ring/ring_packet.c: In function 'skb_ring_handler':
net/ring/ring_packet.c:1897: error: 'struct sk_buff'has no member named 'iif'
net/ring/ring_packet.c:1924: warning: implicit declaration of function 'skb_reset_network_header'
net/ring/ring_packet.c:1925: warning: implicit declaration of function 'skb_reset_transport_header'
net/ring/ring_packet.c:1926: warning: implicit declaration of function 'skb_set_network_header'
net/ring/ring_packet.c:1928: warning: assignment makes pointer from integer without a cast
net/ring/ring_packet.c:1984: error: 'struct skb_timeval'has no member named 'tv64'
net/ring/ring_packet.c:1986: error: 'struct skb_timeval'has no member named 'tv64'
net/ring/ring_packet.c: In function 'buffer_ring_handler':
net/ring/ring_packet.c:2105: error: 'struct skb_timeval'has no member named 'tv64'
net/ring/ring_packet.c: At top level:
net/ring/ring_packet.c:2259: warning: 'struct net'declared inside parameter list
net/ring/ring_packet.c:2259: warning: its scope is only this definition or declaration, which is probably not what you want
net/ring/ring_packet.c: In function 'ring_create':
net/ring/ring_packet.c:2280: warning: passing argument 1 of 'sk_alloc'makes integer from pointer without a cast
net/ring/ring_packet.c:2280: warning: passing argument 3 of 'sk_alloc'makes pointer from integer without a cast
net/ring/ring_packet.c:2280: warning: passing argument 4 of 'sk_alloc'makes integer from pointer without a cast
net/ring/ring_packet.c: In function 'ring_bind':
net/ring/ring_packet.c:2612: error: 'init_net'undeclared (first use in this function)
net/ring/ring_packet.c:2613: error: too many arguments to function /__dev_get_by_name'
net/ring/ring_packet.c: In function 'ring_setsockopt':
net/ring/ring_packet.c:3374: error: 'init_net'undeclared (first use in this function)
net/ring/ring_packet.c:3375: error: too many arguments to function 'dev_get_by_name'
net/ring/ring_packet.c:3523: error: too many arguments to function 'dev_get_by_name'
net/ring/ring_packet.c: At top level:
net/ring/ring_packet.c:4073: warning: initialization from incompatible pointer type
make[2]: *** [net/ring/ring_packet.o] Error 1
make[1]: *** [net/ring] Error 2
make: *** [net] Error 2

论坛徽章:
36
IT运维版块每日发帖之星
日期:2016-04-10 06:20:00IT运维版块每日发帖之星
日期:2016-04-16 06:20:0015-16赛季CBA联赛之广东
日期:2016-04-16 19:59:32IT运维版块每日发帖之星
日期:2016-04-18 06:20:00IT运维版块每日发帖之星
日期:2016-04-19 06:20:00每日论坛发贴之星
日期:2016-04-19 06:20:00IT运维版块每日发帖之星
日期:2016-04-25 06:20:00IT运维版块每日发帖之星
日期:2016-05-06 06:20:00IT运维版块每日发帖之星
日期:2016-05-08 06:20:00IT运维版块每日发帖之星
日期:2016-05-13 06:20:00IT运维版块每日发帖之星
日期:2016-05-28 06:20:00每日论坛发贴之星
日期:2016-05-28 06:20:00
2 [报告]
发表于 2011-06-28 09:27 |只看该作者
回复 1# pkxpp
先把标题的错误改一下。

论坛徽章:
36
IT运维版块每日发帖之星
日期:2016-04-10 06:20:00IT运维版块每日发帖之星
日期:2016-04-16 06:20:0015-16赛季CBA联赛之广东
日期:2016-04-16 19:59:32IT运维版块每日发帖之星
日期:2016-04-18 06:20:00IT运维版块每日发帖之星
日期:2016-04-19 06:20:00每日论坛发贴之星
日期:2016-04-19 06:20:00IT运维版块每日发帖之星
日期:2016-04-25 06:20:00IT运维版块每日发帖之星
日期:2016-05-06 06:20:00IT运维版块每日发帖之星
日期:2016-05-08 06:20:00IT运维版块每日发帖之星
日期:2016-05-13 06:20:00IT运维版块每日发帖之星
日期:2016-05-28 06:20:00每日论坛发贴之星
日期:2016-05-28 06:20:00
3 [报告]
发表于 2011-06-28 09:28 |只看该作者
回复 1# pkxpp
你用了什么版本的内核?
建议直接下载 PF_RING 的源码编译就可以了。
编译中出现错误的话,大多可能是内核版本兼容的问题。按照提示的错误,找一下你使用的内核版本和这个模块调用的接口是否一致。

论坛徽章:
0
4 [报告]
发表于 2011-06-28 10:45 |只看该作者
回复 3# Godbach

我是按照网上的步骤(CentOS,Linux内核2.6.18-194.el5):

uname -r 显示2.6.25-14.fc9.i686,修改版本
./mkpatch.sh 下载版本内核
zcat linux-2.6.25-1-686-smp-PF_RING.patch.gz | patch -p0  ,给 linux-2.6.25/ 下的源码打补丁
cd linux-2.6.25
vi Makefile 在这个地方加上一个自定义的后缀(比如-PF_RING):
   EXTRAVERSION = -PF_RING

配置并编译内核!(灰色指令是可选的)
make mrproper        # (不建议)清除以前编译的内核文件。因为是新解压的,保持原始状态就好,不建议用这个

make oldconfig     # 读取当前内核的配置(相当重要,这步能省好多配置工作,而且保证生成的.config能直接使用)
                     # 其间会提示 PF_RING xxxx [N/y/m/?] (NEW) ,注意按y选择把PF_RING给加进去,其他的选择按回车默认即可
                     # 不过注意,如果编译的内核版本较当前的新,会有很多(NEW)标记的提示,此时要是找不到PF_RING,建议先全部回车跳过

make menuconfig    # 如果之前把PF_RING也跳过了,这里可以进去重新选上

以上的准备工作都能够完成,但是在接下来的make这里却出现了错误:
  CC [M]  net/ring/ring_packet.o
net/ring/ring_packet.c:159: error: conflicting types for 鈥榠p_defrag鈥?include/net/ip.h:334: error: previous declaration of 鈥榠p_defrag鈥?was here
net/ring/ring_packet.c: In function 鈥榬ing_proc_init鈥?
net/ring/ring_packet.c:527: error: 鈥榠nit_net鈥?undeclared (first use in this function)
net/ring/ring_packet.c:527: error: (Each undeclared identifier is reported only once
net/ring/ring_packet.c:527: error: for each function it appears in.)
net/ring/ring_packet.c: In function 鈥榬ing_proc_term鈥?
net/ring/ring_packet.c:559: error: 鈥榠nit_net鈥?undeclared (first use in this function)
net/ring/ring_packet.c: At top level:
net/ring/ring_packet.c:2259: warning: 鈥榮truct net鈥?declared inside parameter list
net/ring/ring_packet.c:2259: warning: its scope is only this definition or declaration, which is probably not what you want
net/ring/ring_packet.c: In function 鈥榬ing_create鈥?
net/ring/ring_packet.c:2280: warning: passing argument 1 of 鈥榮k_alloc鈥?makes integer from pointer without a cast
net/ring/ring_packet.c:2280: warning: passing argument 3 of 鈥榮k_alloc鈥?makes pointer from integer without a cast
net/ring/ring_packet.c:2280: warning: passing argument 4 of 鈥榮k_alloc鈥?makes integer from pointer without a cast
net/ring/ring_packet.c: In function 鈥榬ing_bind鈥?
net/ring/ring_packet.c:2612: error: 鈥榠nit_net鈥?undeclared (first use in this function)
net/ring/ring_packet.c:2613: error: too many arguments to function 鈥榑_dev_get_by_name鈥?net/ring/ring_packet.c: In function 鈥榬ing_setsockopt鈥?
net/ring/ring_packet.c:3374: error: 鈥榠nit_net鈥?undeclared (first use in this function)
net/ring/ring_packet.c:3375: error: too many arguments to function 鈥榙ev_get_by_name鈥?net/ring/ring_packet.c:3523: error: too many arguments to function 鈥榙ev_get_by_name鈥?net/ring/ring_packet.c: At top level:
net/ring/ring_packet.c:4073: warning: initialization from incompatible pointer type
make[2]: *** [net/ring/ring_packet.o] 閿欒? 1
make[1]: *** [net/ring] 閿欒? 2
make: *** [net] 閿欒? 2

论坛徽章:
0
5 [报告]
发表于 2011-06-28 10:47 |只看该作者
回复 2# Godbach


    哦,多谢

论坛徽章:
36
IT运维版块每日发帖之星
日期:2016-04-10 06:20:00IT运维版块每日发帖之星
日期:2016-04-16 06:20:0015-16赛季CBA联赛之广东
日期:2016-04-16 19:59:32IT运维版块每日发帖之星
日期:2016-04-18 06:20:00IT运维版块每日发帖之星
日期:2016-04-19 06:20:00每日论坛发贴之星
日期:2016-04-19 06:20:00IT运维版块每日发帖之星
日期:2016-04-25 06:20:00IT运维版块每日发帖之星
日期:2016-05-06 06:20:00IT运维版块每日发帖之星
日期:2016-05-08 06:20:00IT运维版块每日发帖之星
日期:2016-05-13 06:20:00IT运维版块每日发帖之星
日期:2016-05-28 06:20:00每日论坛发贴之星
日期:2016-05-28 06:20:00
6 [报告]
发表于 2011-06-28 11:32 |只看该作者
回复 5# pkxpp

我个人的习惯,一般搞个开发机的话,去 kernel.org 上下载个标准内核,然后在上面做开发,比如编译内核模块之类的。

发行版的内核都做过很多改动

论坛徽章:
0
7 [报告]
发表于 2011-06-28 12:30 |只看该作者
下载下来直接就可以make了,官方网页上就有文档,只要两三句指令即可。最多改一下内核源码的路径。如果这样还是报错,可能是LZ的内核太低或太高,pf_ring支持不了。

论坛徽章:
0
8 [报告]
发表于 2011-06-28 12:31 |只看该作者
回复 6# Godbach


mkpatch.sh就是去www.kernel.org下载干净内核的啊。

论坛徽章:
0
9 [报告]
发表于 2011-06-28 13:01 |只看该作者
回复 7# 独孤九贱


    九贱大哥,你好。
   我在网上看到,说4.x版本的不用加补丁之类的。我理解是,下下来之后在kernel中编译,然后加到内核(•sudo insmod ./pf_ring.ko
)中去就可以了,我这样理解对不对。
   网上那些帖子,是说下载干净内核之后,打上补丁,然后编译内核,以后使用这个内核。

论坛徽章:
36
IT运维版块每日发帖之星
日期:2016-04-10 06:20:00IT运维版块每日发帖之星
日期:2016-04-16 06:20:0015-16赛季CBA联赛之广东
日期:2016-04-16 19:59:32IT运维版块每日发帖之星
日期:2016-04-18 06:20:00IT运维版块每日发帖之星
日期:2016-04-19 06:20:00每日论坛发贴之星
日期:2016-04-19 06:20:00IT运维版块每日发帖之星
日期:2016-04-25 06:20:00IT运维版块每日发帖之星
日期:2016-05-06 06:20:00IT运维版块每日发帖之星
日期:2016-05-08 06:20:00IT运维版块每日发帖之星
日期:2016-05-13 06:20:00IT运维版块每日发帖之星
日期:2016-05-28 06:20:00每日论坛发贴之星
日期:2016-05-28 06:20:00
10 [报告]
发表于 2011-06-28 13:23 |只看该作者
PF_RING 以独立模块运行就成了,没有必要打 patch 到内核
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP