免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: springwind426
打印 上一主题 下一主题

[网络管理] 发布一个速度匹配的内核模块(hashspeed) [复制链接]

论坛徽章:
0
71 [报告]
发表于 2008-04-03 16:22 |只看该作者
哪位大哥有在2.6.24.4 iptables1.4下编译通过....

楼主GG说把proc_net 都换成 init_net.proc_net 试
试了也不行的...

GG帮忙看看

论坛徽章:
0
72 [报告]
发表于 2008-04-07 23:53 |只看该作者
......编译好几个内核..
我还是在linux-2.6.23 iptables-1.4.0  gcc-4.1.2-14.el5下编译通过...

楼主说的2.6.24内核要把proc_net 全换成init.proc_net
这个是替换哪个文件的proc_net.

论坛徽章:
0
73 [报告]
发表于 2008-04-08 00:34 |只看该作者
楼主老大.linux2.6.23 iptables-1.4下可以译出来..
模块已加载成功后我用
[root@EEE ~]# iptables -m hashspeed -h
iptables v1.4.0: Couldn't load match `hashspeed'null)

Try `iptables -h' or 'iptables --help' for more information.
怎么会这样呢?????

*******************
然后我把iptables换成1.3.8模块加块正常..使用hashspeed也正常...

哪位在iptables1.4.0下译成功能正常使用的...帮帮哇.....
在此先谢各位大哥大姐了... :wink:

论坛徽章:
0
74 [报告]
发表于 2008-04-08 10:18 |只看该作者
原帖由 wwlovezz 于 2008-4-8 00:34 发表
楼主老大.linux2.6.23 iptables-1.4下可以译出来..
模块已加载成功后我用
[root@EEE ~]# iptables -m hashspeed -h
iptables v1.4.0: Couldn't load match `hashspeed'null)

Try `iptables -h' or 'ipt ...



在编译的时候,你是否成功编译了libipt_hashspeed.so,还有,有没有把libipt_hashspeed.so复制到iptables的lib目录下?

论坛徽章:
0
75 [报告]
发表于 2008-04-08 13:15 |只看该作者
谢谢
我现在在linux2.6.24.4 iptables.1.4下顺利译过``正常运行。
嘿嘿。。。在此谢谢楼主及其他GG

论坛徽章:
2
巨蟹座
日期:2014-03-09 21:37:25射手座
日期:2014-04-16 16:23:03
76 [报告]
发表于 2009-08-25 17:39 |只看该作者
好文章,翻出来晒晒!

论坛徽章:
1
平安夜徽章
日期:2015-12-26 00:06:30
77 [报告]
发表于 2009-08-26 16:35 |只看该作者
报错了

[root@firewall hashspeed-0.1]# export KERNEL_DIR=/usr/src/linux-2.6.18.i686
[root@firewall hashspeed-0.1]# export IPTABLES_DIR=/usr/src/iptables-1.3.8/
[root@firewall hashspeed-0.1]# export KERNEL_DIR=/usr/src/linux-2.6.18.i686/
[root@firewall hashspeed-0.1]# export KERNEL_SRC=/usr/src/linux-2.6.18.i686/
[root@firewall hashspeed-0.1]# export IPTABLES_SRC=/usr/src/iptables-1.3.8/
[root@firewall hashspeed-0.1]# make
make -C /usr/src/linux-2.6.18.i686/ M=/home/hashspeed-0.1 modules
make[1]: Entering directory `/usr/src/linux-2.6.18.i686'

  WARNING: Symbol version dump /usr/src/linux-2.6.18.i686/Module.symvers
           is missing; modules will have no dependencies and modversions.

  CC [M]  /home/hashspeed-0.1/ipt_hashspeed.o
/home/hashspeed-0.1/ipt_hashspeed.c: In function ‘hash_dst’:
/home/hashspeed-0.1/ipt_hashspeed.c:114: 警告:传递实参 1(属于 ‘jhash2’)丢弃了指针目标类型的限定
/home/hashspeed-0.1/ipt_hashspeed.c: In function ‘hashspeed_match’:
/home/hashspeed-0.1/ipt_hashspeed.c:403: 警告:初始化丢弃了指针目标类型的限定
  Building modules, stage 2.
  MODPOST
  CC      /home/hashspeed-0.1/ipt_hashspeed.mod.o
  LD [M]  /home/hashspeed-0.1/ipt_hashspeed.ko
make[1]: Leaving directory `/usr/src/linux-2.6.18.i686'
cc -O2 -Wall -DIPTABLES_VERSION=\"1.3.8\" -I/usr/src/iptables-1.3.8/include -I/usr/src/linux-2.6.18.i686//include -fPIC -c libipt_hashspeed.c
libipt_hashspeed.c:369: 错误:变量 ‘hashspeed’ 有初始值设定但类型不完全
libipt_hashspeed.c:370: 错误:初始值设定项里有未知的字段 ‘next’
libipt_hashspeed.c:370: 警告:结构初始值设定项中有多余元素
libipt_hashspeed.c:370: 警告:(在 ‘hashspeed’ 的初始化附近)
libipt_hashspeed.c:371: 错误:初始值设定项里有未知的字段 ‘name’
libipt_hashspeed.c:371: 警告:结构初始值设定项中有多余元素
libipt_hashspeed.c:371: 警告:(在 ‘hashspeed’ 的初始化附近)
libipt_hashspeed.c:372: 错误:初始值设定项里有未知的字段 ‘family’
libipt_hashspeed.c:372: 警告:结构初始值设定项中有多余元素
libipt_hashspeed.c:372: 警告:(在 ‘hashspeed’ 的初始化附近)
libipt_hashspeed.c:373: 错误:初始值设定项里有未知的字段 ‘version’
libipt_hashspeed.c:373: 警告:结构初始值设定项中有多余元素
libipt_hashspeed.c:373: 警告:(在 ‘hashspeed’ 的初始化附近)
libipt_hashspeed.c:374: 错误:初始值设定项里有未知的字段 ‘size’
libipt_hashspeed.c:374: 警告:结构初始值设定项中有多余元素
libipt_hashspeed.c:374: 警告:(在 ‘hashspeed’ 的初始化附近)
libipt_hashspeed.c:375: 错误:初始值设定项里有未知的字段 ‘userspacesize’
libipt_hashspeed.c:375: 警告:结构初始值设定项中有多余元素
libipt_hashspeed.c:375: 警告:(在 ‘hashspeed’ 的初始化附近)
libipt_hashspeed.c:376: 错误:初始值设定项里有未知的字段 ‘help’
libipt_hashspeed.c:376: 警告:结构初始值设定项中有多余元素
libipt_hashspeed.c:376: 警告:(在 ‘hashspeed’ 的初始化附近)
libipt_hashspeed.c:377: 错误:初始值设定项里有未知的字段 ‘init’
libipt_hashspeed.c:377: 警告:结构初始值设定项中有多余元素
libipt_hashspeed.c:377: 警告:(在 ‘hashspeed’ 的初始化附近)
libipt_hashspeed.c:378: 错误:初始值设定项里有未知的字段 ‘parse’
libipt_hashspeed.c:378: 警告:结构初始值设定项中有多余元素
libipt_hashspeed.c:378: 警告:(在 ‘hashspeed’ 的初始化附近)
libipt_hashspeed.c:379: 错误:初始值设定项里有未知的字段 ‘final_check’
libipt_hashspeed.c:379: 警告:结构初始值设定项中有多余元素
libipt_hashspeed.c:379: 警告:(在 ‘hashspeed’ 的初始化附近)
libipt_hashspeed.c:380: 错误:初始值设定项里有未知的字段 ‘print’
libipt_hashspeed.c:380: 警告:结构初始值设定项中有多余元素
libipt_hashspeed.c:380: 警告:(在 ‘hashspeed’ 的初始化附近)
libipt_hashspeed.c:381: 错误:初始值设定项里有未知的字段 ‘save’
libipt_hashspeed.c:381: 警告:结构初始值设定项中有多余元素
libipt_hashspeed.c:381: 警告:(在 ‘hashspeed’ 的初始化附近)
libipt_hashspeed.c:382: 错误:初始值设定项里有未知的字段 ‘extra_opts’
libipt_hashspeed.c:383: 警告:结构初始值设定项中有多余元素
libipt_hashspeed.c:383: 警告:(在 ‘hashspeed’ 的初始化附近)
libipt_hashspeed.c: In function ‘my_init’:
libipt_hashspeed.c:387: 警告:隐式声明函数 ‘xtables_register_match’
make: *** [libipt_hashspeed.so] 错误 1

论坛徽章:
0
78 [报告]
发表于 2010-02-02 10:27 |只看该作者
本帖最后由 bfz814 于 2010-02-02 10:28 编辑

请问一下 ,这个模块 我打上了 内核是2.6.28.4 iptables是1.4.2 ,但是在执行iptables语句上报出一个问题,请帮忙看一下,指点下!!
问题如下:
[root@localhost ~]# iptables -A FORWARD -i eth1 -p tcp -m hashspeed  --hashspeed-bytes 256K --hashspeed-mode srcip --hashspeed-name slimit -j DROP

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel: Oops: 0000 [#2]

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel: last sysfs file: /sys/class/vc/vcs7/dev

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel: Process iptables (pid: 3274, ti=c75a6000 task=c7538ec0 task.ti   =c75a6000)

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel: Stack:

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  d188d0ab 00000058 c751bd06 d188e2b1 02000004 c751bd06 0600bc9  4 c751bc94

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  c751bc94 d189dd32 00000000 00000000 c75a6c3c ffffffff c751beb c fffffffe

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel: Call Trace:

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<d188d0ab>] xt_check_match+0xab/0x170 [x_tables]

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<d188e2b1>] xt_find_match+0xd1/0xf0 [x_tables]

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<d189dd32>] translate_table+0x602/0x6e0 [ip_tables]

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<d189dfe5>] do_ipt_set_ctl+0x1d5/0x430 [ip_tables]

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<c0356b80>] nf_sockopt+0x110/0x120

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<c0356be1>] nf_setsockopt+0x21/0x30

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<c0367b02>] ip_setsockopt+0x132/0xd40

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<c0356aef>] nf_sockopt+0x7f/0x120

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<c03309d3>] release_sock+0x13/0xa0

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<c0356bb4>] nf_getsockopt+0x24/0x30

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<c0368d1a>] ip_getsockopt+0x60a/0x700

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<c01566ce>] get_page_from_freelist+0x39e/0x460

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<c015796c>] __alloc_pages_internal+0xac/0x470

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<c0167ed6>] anon_vma_prepare+0x26/0xd0

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<c015a528>] lru_cache_add_active_or_unevictable+0x8/0x30

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<c0162ac0>] handle_mm_fault+0x4d0/0x660

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<c0330cf3>] sock_common_setsockopt+0x23/0x30

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<c032e92e>] sys_setsockopt+0x6e/0xc0

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<c03306f0>] sys_socketcall+0x240/0x2c0

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel:  [<c0103121>] sysenter_do_call+0x12/0x21

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel: Code: d8 5b e9 ad 35 8d ee 8d b6 00 00 00 00 8d bc 27 00 00 00 00 83 ec 20 89 6c 24 1c 8b 6c 24 24 89 5c 24 10 89 74 24 14 89 7c 24 18 <8b> 45  30 85 c0 74 22 a8 05 74 1e 8b 45 3c 85 c0 74 17 80 7d 1f

Message from syslogd@localhost at Mon Feb  1 00:08:59 2010 ...
localhost kernel: EIP: [<d1896447>] hashspeed_checkentry+0x17/0x320 [ipt_hashspeed] SS:ESP 0068:c75a6bb4

论坛徽章:
0
79 [报告]
发表于 2011-03-21 21:14 |只看该作者
好东东,就是在新版本中确实编不过啊。:wink:

论坛徽章:
0
80 [报告]
发表于 2011-03-22 12:06 |只看该作者
感谢楼主无私的奉献!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP