Chinaunix

标题: IPP2P模块修改版,最新0.99.16 [打印本页]

作者: ShadowStar    时间: 2007-11-16 20:42
标题: IPP2P模块修改版,最新0.99.16
由于原版的ipp2p模块停留在0.8.2版,本人根据工作需要对ipp2p模块进行了修改和升级。

1。修正部分BT和电驴的过滤特征码
2。添加PPLive/PPStream/UUSee/QQLive/沸点网络电视/POCO/QVOD的过滤特征码,添加选项--pp,集合在--ipp2p选项中
3。添加Vagaa的过滤代码在--edk中,集合在--ipp2p选项中
4。添加迅雷/QQ超级旋风/百度下吧的过滤特征码,添加选项--xunlei,未集合在--ipp2p选项中

特别说明:本模块过滤迅雷仅仅是过滤了多点下载(查找候选资源),迅雷还是可以使用原始资源进行单点下载的。如果连单点下载都屏蔽的话,所有的下载软件就都不能用了!
目前迅雷的查询是发送到80端口,并具有http报头,所以如果有代理服务器的话,请做相应处理。


关于误报的问题:
由于7层协议并没有公开的标准遵行,我也仅仅是按照数据流的分析来定义关键字和结构,并且我的测试条件有限,所以无法保证100%无误。
望大家谅解,并谨慎使用。
如果有发现影响了其他正常的通信数据,请回帖告知,谢!


  1. 0.99.16版
  2. 过滤特征码没有变化,没有修正mysql的问题。
  3. 添加nf_conntrack支持,仅匹配每条连接的前15个数据包,提高过滤速度。
  4. 没有深度测试,欢迎小白鼠。
  5. 注意:需要在配置内核时选中“CONFIG_NF_CONNTRACK_MARK”
复制代码

  1. 0.99.15版***建议使用***
  2. 目前发现于Mysql的协议冲突,因我现在没有环境调试,所以有mysql使用需求的用户请把ipt_ipp2p.c中search_pp函数中/* message UUSee */到/* QQLive */之间的行都注释掉。
  3. 或者使用最下面的文件覆盖模块目录下的源文件
复制代码

  1. 0.99.14版
  2. ChangeLog

  3. 应88djy朋友要求,添加QVOD过滤,集成在--pp选项中。
复制代码

  1. 0.99.13版
  2. ChangeLog

  3. 修正对于跑跑卡丁车的误匹配。
  4. 增强对于VAGAA的过滤
复制代码

  1. 0.99.12版
  2. ChangeLog

  3. 增加Vagaa的过滤,POCO的过滤
复制代码

  1. 0.99.11版
  2. ChangeLog

  3. 增加对于百度下吧和沸点网络电视的过滤。
复制代码

  1. 0.99.10版
  2. ChangeLog

  3. 修订PPStream/PPLive/QQLive/UUSee的过滤代码,增加对新版本的支持。
  4. 减少误报。
复制代码

  1. 0.99.9版
  2. ChangeLog

  3. 修改了迅雷的过滤代码。
  4. 应该可以对老版本的迅雷有效了,我实在是找不到那么老的迅雷来测试了,大家用用看吧~~
  5. 另外,添加了一个byte的判断,过滤更严格~~
复制代码

  1. 0.99.8版
  2. ChangeLog

  3. 无任何功能改变。

  4. 仅仅是统一了代码风格,对代码进行了整理和清理。
  5. 还没有发现重写代码的必要。
复制代码

  1. 0.99.7版
  2. ChangeLog

  3. 添加对于新版迅雷5.7.5.421的支持
复制代码

  1. 0.99.6-r2版
  2. ChangeLog

  3. 增加对于PPStream“我的网络受到运营商限制”的过滤
复制代码

  1. 0.99.6-r1版
  2. ChangeLog

  3. 添加对于某些老版迅雷的过滤代码
复制代码

:wink: 我自己测试时用的是最新版:wink:

  1. 0.99.6版
  2. ChangeLog

  3. 增加对于QQ超级旋风的过滤,添加在--xunlei选项中。(使用--xunlei选项同时针对迅雷和QQ超级旋风)
复制代码

  1. 0.99.5版
  2. ChangeLog

  3. 增加对于迅雷的过滤,包括web迅雷。
复制代码


  1. IPP2P v0.99.6-r1 options:
  2. --ipp2p        Grab all known p2p packets
  3. --edk          [TCP&UDP]       All known eDonkey/eMule/Overnet packets
  4. --dc           [TCP]           All known Direct Connect packets
  5. --kazaa        [TCP&UDP]       All known KaZaA packets
  6. --gnu          [TCP&UDP]       All known Gnutella packets
  7. --bit          [TCP&UDP]       All known BitTorrent packets
  8. --apple        [TCP]           All known AppleJuice packets
  9. --winmx        [TCP]           All known WinMX
  10. --soul         [TCP]           All known SoulSeek
  11. --ares         [TCP]           All known Ares
  12. --pp           [TCP&UDP]       All known PPLive/PPStream/UUSee/QQLive packets
  13. --xunlei       [TCP]           All known xunlei/QQCyclone packets
  14. EXPERIMENTAL protocols (please send feedback to: [email]ipp2p@ipp2p.org[/email]) :
  15. --mute         [TCP]           All known Mute packets
  16. --waste        [TCP]           All known Waste packets
  17. --xdcc         [TCP]           All known XDCC packets (only xdcc login)

  18. DEBUG SUPPPORT, use only if you know why
  19. --debug                Generate kernel debug output, THIS WILL SLOW DOWN THE FILTER

  20. Note that the follwing options will have the same meaning:
  21. '--ipp2p' is equal to '--edk --dc --kazaa --gnu --bit --apple --winmx --soul --ares --pp'
复制代码


编译说明
1.解压缩.tar.gz文件后,进入源码目录。
2.修改Makefile文件,主要是其中的KERNEL_SRC和IPTABLES_SRC,使他们指向具体的内核源代码目录和iptables的源代码目录。(内核必须要设置正确,因为通常编译的内核都不会打开“Module versioning support”选项;但是iptables的目录不是必须的,只要iptables.h文件在系统的include目录(通常是/usr/include)中就可以)
3.如果提示编译libipt_ipp2p.so有错误,请将Makefile中的“$(CC) -shared -o libipt_ipp2p.so libipt_ipp2p.o”修改为“ld -shared -o libipt_ipp2p.so libipt_ipp2p.o”。(1.3.5版的iptables使用ld没问题;但是1.3.8版的使用ld就不行了,只能使用gcc)
4.将编译好的libipt_ipp2p.so复制到iptables的模块目录下(通常为/lib/iptables);将ipt_ipp2p.ko复制到内核的netfilter目录下(通常为/lib/modules/内核名称/kernel/net/ipv4/netfilter)
5.运行depmod -a,更新内核模块的依赖关系。
6.停止iptables服务,rmmod ipt_ipp2p,启动iptables服务。

[ 本帖最后由 ShadowStar 于 2008-3-5 22:26 编辑 ]

ipp2p-0.99.5.tar.gz

19.42 KB, 下载次数: 1143

ipp2p-0.99.4.tar.gz

19.25 KB, 下载次数: 2146

ipp2p-0.99.6.tar.gz

19.49 KB, 下载次数: 406

ipp2p-0.99.6-r1.tar.gz

19.5 KB, 下载次数: 349

ipp2p-0.99.6-r2.tar.gz

19.58 KB, 下载次数: 344

ipp2p-0.99.7.tar.gz

19.59 KB, 下载次数: 424

ipp2p-0.99.8.tar.gz

19.1 KB, 下载次数: 342

ipp2p-0.99.9.tar.gz

19.11 KB, 下载次数: 338

ipp2p-0.99.10.tar.gz

19.11 KB, 下载次数: 2058

ipp2p-0.99.11.tar.gz

19.33 KB, 下载次数: 386

ipp2p-0.99.12.tar.gz

19.63 KB, 下载次数: 445

ipp2p-0.99.13.tar.gz

19.73 KB, 下载次数: 659

ipp2p-0.99.14.tar.gz

19.85 KB, 下载次数: 557

ipp2p-0.99.15.tar.gz

19.78 KB, 下载次数: 1672

ipt_ipp2p.c.gz

7.57 KB, 下载次数: 715

ipp2p-0.99.16.tar.gz

20.32 KB, 下载次数: 3371


作者: ShadowStar    时间: 2007-11-16 20:52
标题: 关于emule的问题
emule在升级到0.48a后,无法被ipp2p模块过滤的原因。

初步怀疑是由于emule加密了tcp的握手信息,导致无法通过特征码过滤。

目前还没有太好的解决办法。

我正在看emule的src,但是很慢,因为我不会C++,边看边学。

如果确实是由于加密了Client——Client的握手信息,那么只能通过在ipp2p模块中进行解密,然后再进行特征过滤,但是在流量较大的网络上,性能肯定会严重下降,延迟也会加大,反而会影响整个网络的状况(因为防火墙无法判断数据包是不是emule的,所以要对所有的流经数据包进行解密)。

目前看来很麻烦,不好处理。

如果有朋友有好的思路,或是知道emule的信息,可以回帖或短消息告知,不胜感谢。
作者: cexoyq    时间: 2007-11-17 01:14
感谢楼主!
对LINUX版本有要求吗?
作者: fuleru    时间: 2007-11-17 10:29
好的,再顶一下吧,这段时间刚好想重新编译下内核和iptables。
迅雷是个大问题。


看你的意思0.99.4版比较好些?

[ 本帖最后由 fuleru 于 2007-12-5 09:47 编辑 ]
作者: ShadowStar    时间: 2007-11-17 10:46
0.99.4版不支持迅雷。
作者: 5639863    时间: 2007-11-17 18:28
楼主,偶太佩服你了,我准备测试一下。真好。
作者: 5639863    时间: 2007-11-17 18:49
我刚刚升到0.99.5然后用迅雷下载电影的截图。

xunlei.JPG (26.46 KB, 下载次数: 318)

xunlei.JPG

作者: ShadowStar    时间: 2007-11-17 20:50
迅雷的filter并没有加入到--ipp2p选项中

使用-m ipp2p --xunlei来启用
作者: 5639863    时间: 2007-11-17 23:00
原来如此,这是我加上以后的效果:
root@proxy5 /]# iptables -vnL FORWARD
Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target     prot opt in     out     source               destination
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           ipp2p v0.99.5 --xunlei     <=====这是刚刚加上的,用迅雷下载后,居然没有数被DROP
393K  213M ACCEPT     all  --  *      *       172.16.15.253        0.0.0.0/0
67237 3499K DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 3076,3077
52485 2467K DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           ctstate INVALID
5132K  340M DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           #conn/32 > 50
1714K  191M DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           ipp2p v0.99.5 --ipp2p  <====这句是0.99.4运行半个月的结果

我哪儿有写错吗?

xunlei.JPG (24.82 KB, 下载次数: 262)

xunlei.JPG

作者: ShadowStar    时间: 2007-11-18 03:50
你的iptables中同时存在0.99.4的和0.99.5的两个版本?

建议你先暂停iptables,然后rmmod ipt_ipp2p模块,再启动iptables。
这样确保系统加载的是新的0.99.5的模块,可以通过tail /var/log/message看到。

如果你已经这样做了,请贴出iptables-save的输出。

[ 本帖最后由 ShadowStar 于 2007-11-18 03:51 编辑 ]
作者: fuleru    时间: 2007-11-18 08:58
编译成功。谢谢

dmesg | grep IPP
IPP2P v0.99.5 loading

iptables -A FORWARD -p udp -m time --timestart 08:00 --timestop 20:00 --days Mon,Tue,Wed,Thu,Fri,Sat -m ipp2p --xunlei -j DROP
iptables -A FORWARD -p tcp -m time --timestart 08:00 --timestop 20:00 --days Mon,Tue,Wed,Thu,Fri,Sat -m ipp2p --xunlei -j DROP

周一上班的时候再测试!

[ 本帖最后由 fuleru 于 2007-11-18 09:01 编辑 ]
作者: fuleru    时间: 2007-11-18 09:04
另外一个帖子也放在一起:
http://linux.chinaunix.net/bbs/v ... p;extra=&page=1

方便查找
作者: qishking    时间: 2007-11-18 09:39
迅雷也要被限制
作者: fuleru    时间: 2007-11-18 11:52
原帖由 qishking 于 2007-11-18 09:39 发表
迅雷也要被限制



呵呵,没有办法啊,上班时间一般要限制的。现在很多人都是不自觉的了。。。

[ 本帖最后由 fuleru 于 2007-11-19 07:23 编辑 ]
作者: 5639863    时间: 2007-11-18 16:19
原帖由 ShadowStar 于 2007-11-18 03:50 发表
你的iptables中同时存在0.99.4的和0.99.5的两个版本?

建议你先暂停iptables,然后rmmod ipt_ipp2p模块,再启动iptables。
这样确保系统加载的是新的0.99.5的模块,可以通过tail /var/log/message看到。

...


看来还得重新LOAD一下才可以,我等了十多分钟吧,居然没有一点数据都没有下载下来,不错,我会继续关注。
作者: ShadowStar    时间: 2007-11-18 17:25
原帖由 5639863 于 2007-11-18 16:19 发表


看来还得重新LOAD一下才可以,我等了十多分钟吧,居然没有一点数据都没有下载下来,不错,我会继续关注。


不应该一点数据都没有下载啊。

这个屏蔽的不是迅雷的全部下载,仅仅是屏蔽了迅雷从其他候选资源进行的p2sp下载,原始资源还是可以下载的。

在迅雷的任务信息应该能看到“搜索候选资源发生错误,稍后重试搜索”的字样。
作者: wsgtrsys    时间: 2007-11-18 18:35
好贴。
不过好象官方没有出0.99.5?
作者: ShadowStar    时间: 2007-11-18 20:16
官方到0.8.2就不更新了。

这个是我自己修改的。
作者: 5639863    时间: 2007-11-18 21:21
看这个图片,没有出现你说的那个搜索候选资源失败的提示
[root@proxy5 ~]# iptables -vnL FORWARD
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target     prot opt   in     out     source               destination
    0     0 DROP             all  --      *      *       0.0.0.0/0            0.0.0.0/0           ipp2p v0.99.5 --xunlei
  978 40207 DROP       all  --      *      *       0.0.0.0/0            0.0.0.0/0           ctstate INVALID
6486  402K DROP       tcp  --     *      *       0.0.0.0/0            0.0.0.0/0           #conn/32 > 5
2939  279K DROP       all  --      *      *       0.0.0.0/0            0.0.0.0/0           ipp2p v0.99.5 --ipp2p

xunlei.jpg (52.26 KB, 下载次数: 123)

xunlei.jpg

作者: ShadowStar    时间: 2007-11-18 22:16
原帖由 5639863 于 2007-11-18 21:21 发表
看这个图片,没有出现你说的那个搜索候选资源失败的提示
[root@proxy5 ~]# iptables -vnL FORWARD
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target     prot opt   in     out     so ...


麻烦您抓一下包给我看看,只要抓到“搜索到x个候选资源”字样显示就可以。
作者: fuleru    时间: 2007-11-19 11:55
不错,我试了下,发现可以禁止。。

我用的迅雷的版本比较旧些。。。
作者: ShadowStar    时间: 2007-11-19 12:12
我测试用的是最新的迅雷,5.7.4的。
作者: luojm_24680    时间: 2007-11-19 13:34
安装ipp2p-0.99.3,执行make时出现:make: Nothing to be done for `all'.
[root@sushe ipp2p-0.99.3]# make
make: Nothing to be done for `all'.
怎么解决?
还有:在-ipp2p-0.99.3说明文档里的一句话:modify the Makefile (change "IUSER = -I/usr/src/iptables/include" to wherever iptables.h is located)是什么意思,我应该修改哪个目录下的哪个文件,怎么修改?在此先谢过!
iptables是iptables1.3.8,源码在/usr/src/iptables-1.3.8目录下
ipp2p-0.99.3源码在/usr/src/ipp2p-0.99.3下
kernel是2.6.19.7,使用的是rhel5
作者: kevin.tan    时间: 2007-11-19 13:47
export IPTABLES_SRC="$your_iptables_patch" KERNEL_SRC="$your_kernel_patch"

就好了
作者: 5639863    时间: 2007-11-19 13:54
原帖由 ShadowStar 于 2007-11-18 22:16 发表


麻烦您抓一下包给我看看,只要抓到“搜索到x个候选资源”字样显示就可以。



不会抓包啊,用什么工具?SNIFFER还是ethereal?
忘说了,我这儿是IPTABLES+SQUID透明代理
作者: ShadowStar    时间: 2007-11-19 14:41
原帖由 5639863 于 2007-11-19 13:54 发表



不会抓包啊,用什么工具?SNIFFER还是ethereal?
忘说了,我这儿是IPTABLES+SQUID透明代理


把你的iptables-save的输出贴出来,我看看。
作者: fuleru    时间: 2007-11-19 14:43
楼主用的内核的版本是多少?iptables 版本呢?

我一直用的内核就是2.6.15.4 iptables是1.3.6的。

近来想重新编译下,l7也已经很旧的了。。
作者: ShadowStar    时间: 2007-11-19 14:58
应该和内核版本、iptables版本没什么关系,只要在makefile指定好就OK。

我这边使用的是2.6.22的内核,1.3.8的iptables。
作者: ShadowStar    时间: 2007-11-19 15:11
原帖由 5639863 于 2007-11-19 13:54 发表



不会抓包啊,用什么工具?SNIFFER还是ethereal?
忘说了,我这儿是IPTABLES+SQUID透明代理


我大概猜到为什么你那边还是能搜索到候选资源了。
1。你的透明代理是将发送到80端口的数据包转发到本地的SQUID代理服务器,然后再由SQUID代理发送到对方服务器。
2。迅雷搜索候选资源使用的http协议、80端口,ipp2p中的匹配也是对这个http数据的过滤。
3。由于通过SQUID后的数据并没有经过FORWARD链,而是经过了本地的INPUT和OUTPUT链,所以你添加在FORWARD链的--xunlei选项没有起作用。

建议你添加--xunlei规则到INPUT或OUTPUT链试验一下。
作者: luojm_24680    时间: 2007-11-19 16:13
我这样指定的:
# export KERNEL_DIR=/usr/src/linux-2.6.19
# export IPTABLES_DIR=/usr/src/iptables-1.3.8

对楼上说的
export IPTABLES_SRC="$your_iptables_patch" KERNEL_SRC="$your_kernel_patch",所谓的your_iptables_patch是iptables-p2p-0.3.0a,your_kernel_patch是netfilter-layer7-v2.14吗,不知我理解的对不对


请圣骑士帮忙:只要在makefile指定,怎么指定呀,我的ipp2p-0.99.3目录下的Makefile内容如下:
[root@sushe src]# ls ipp2p-0.99.3/README
ipp2p-0.99.3/README
[root@sushe src]# more ipp2p-0.99.3/README
IPP2P, an extension to iptables to identify P2P traffic written by Eicke Friedri
ch.
This software is under development but it seems to run pretty stable. Use at you
r own risk!


Installation Instructions:
--------------------------
-modify the Makefile (change "IUSER = -I/usr/src/iptables/include" to wherever i
ptables.h is located)
-type "make"
-copy libipt_ipp2p.so to the iptables lib dir (/usr/lib/iptables/)
-insmod ipt_ipp2p.o / ipt_ipp2p.ko or copy to your kernel modules dir and do a "
depmod -a"
-create your rules


Versions:
---------
Currently IPP2P is tested to be working together with:
-Linux-Kernels 2.6: 2.6.3, 2.6.4, 2.6.6, 2.6.17
-Linux-Kernels 2.4: 2.4.18, 2.4.19, 2.4.20, 2.4.21, 2.4.22, 2.4.23, 2.4.26
-iptables (from netfilter.org) 1.2.7a, 1.2.8, 1.2.9, 1.2.11, 1.3.0, 1.3.1
[root@sushe src]# more ipp2p-0.99.3/Makefile
ifneq ($(KERNELRELEASE),)
obj-m := ipt_ipp2p.o

else
#KERNEL_SRC = /usr/src/linux
KERNEL_SRC ?= $(firstword $(wildcard /lib/modules/$(shell uname -r)/build /usr/s
rc/linux))
ifeq ($(KERNEL_SRC),)
$(error You need to define KERNEL_SRC)
endif

ifneq ($wildcard $(KERNEL_SRC)/include/linux/modversions.h),)
MODVERSIONS = -DMODVERSIONS
endif

_KVER = $(strip $(shell cat $(KERNEL_SRC)/Makefile | grep -e '^VERSION' | cut -d
"=" -f2))
_KPL = $(strip $(shell cat $(KERNEL_SRC)/Makefile | grep -e '^PATCHLEVEL' | cut
-d"=" -f2))
_KSUB = $(strip $(shell cat $(KERNEL_SRC)/Makefile | grep -e '^SUBLEVEL' | cut -
d"=" -f2))
KERNEL_SERIES=$(_KVER).$(_KPL)

ifeq ($(KERNEL_SERIES), 2.6)
        TARGET=ipt_ipp2p.ko
else
        TARGET=ipt_ipp2p.o
endif

SED = sed
IPTABLES_BIN = iptables
ifndef $(IPTABLES_SRC)
IPTVER = \
        $(shell $(IPTABLES_BIN) --version | $(SED) -e 's/^iptables v//')
IPTABLES_SRC = $(wildcard /usr/src/iptables-$(IPTVER))
#IPTABLES_SRC = /var/tmp/portage/net-firewall/iptables-1.3.8-r1/work/iptables-1.
3.8
endif

ifeq ($(IPTABLES_SRC),)
$(warning You need to install iptables sources and maybe set IPTABLES_SRC)
endif

IPTABLES_INCLUDE = -I$(IPTABLES_SRC)/include

ifneq ($(IPTVER),)
        IPTABLES_VERSION = $(IPTVER)
else
        IPTABLES_VERSION = $(shell cat $(IPTABLES_SRC)/Makefile | grep -e '^IPTA
BLES_VERSION:=' | cut -d"=" -f2)
endif

IPTABLES_OPTION = -DIPTABLES_VERSION=\"$(IPTABLES_VERSION)\"

#CC = /usr/bin/x86_64-pc-linux-gnu-gcc-4.1.2
CC = gcc
CFLAGS = -O3 -Wall



all: modules libipt_ipp2p.so

modules: $(TARGET)

ipt_ipp2p.o: ipt_ipp2p.h ipt_ipp2p.c
        $(CC) $(CFLAGS) -I$(KERNEL_SRC)/include -c ipt_ipp2p.c -D__KERNEL__ -DMO
DULE $(MODVERSIONS)

ipt_ipp2p.ko: ipt_ipp2p.h ipt_ipp2p.c
        $(MAKE) -C $(KERNEL_SRC) M=$(PWD) modules


libipt_ipp2p.so: libipt_ipp2p.c ipt_ipp2p.h
        $(CC) $(CFLAGS) $(IPTABLES_OPTION) $(IPTABLES_INCLUDE) -fPIC -c libipt_i
pp2p.c
        $(CC) -shared -o libipt_ipp2p.so libipt_ipp2p.o

clean:
        -rm -f *.o *.so *.ko .*.cmd *.mod.c
endif
[root@sushe src]#

对上面热情帮忙的老兄谢谢了
作者: luojm_24680    时间: 2007-11-19 16:23
export IPTABLES_SRC="$your_iptables_patch" KERNEL_SRC="$your_kernel_patch",所谓的your_iptables_patch是iptables-p2p-0.3.0a,your_kernel_patch是netfilter-layer7-v2.14吗,不知我理解的对不对

我这种理解好像不对,这样指定出现:
cat: netfilter-layer7-v2.14,/Makefile: No such file or directory
cat: netfilter-layer7-v2.14,/Makefile: No such file or directory
make: Nothing to be done for `all'.

指定成ipp2p-0.99.3也不对
指定成下面:
# export KERNEL_DIR=/usr/src/linux-2.6.19
# export IPTABLES_DIR=/usr/src/iptables-1.3.8
现在也无法只出现:
make: Nothing to be done for `all'.

出现的也是:
cat: /usr/src/linux-2.6.19,/Makefile: No such file or directory
cat: /usr/src/linux-2.6.19,/Makefile: No such file or directory
make: Nothing to be done for `all'.

这可怎么办呀,请做过教给我详细的步骤,谢谢啦
作者: dzb_01    时间: 2007-11-19 19:29
KERNEL_DIR  IPTABLES_DIR
KERNEL_SRC IPTABLES_SRC
跟DIR、SRC有关吗??
作者: ShadowStar    时间: 2007-11-19 19:56
应该没什么关系,指的都是源代码的path
作者: luojm_24680    时间: 2007-11-19 20:05
看到ShadowStar圣骑士,说只要在makefile指定好就OK。我还是不会在makefile中指定,请
ShadowStar 圣骑士帮助我,请给出详细步骤,谢谢!我的IPP2P-0.99.3目录下的Makefile内容如下:

[root@sushe ipp2p-0.99.3]# more Makefile
ifneq ($(KERNELRELEASE),)
obj-m := ipt_ipp2p.o

else
#KERNEL_SRC = /usr/src/linux
KERNEL_SRC ?= $(firstword $(wildcard /lib/modules/$(shell uname -r)/build /usr/s
rc/linux))
ifeq ($(KERNEL_SRC),)
$(error You need to define KERNEL_SRC)
endif

ifneq ($wildcard $(KERNEL_SRC)/include/linux/modversions.h),)
MODVERSIONS = -DMODVERSIONS
endif

_KVER = $(strip $(shell cat $(KERNEL_SRC)/Makefile | grep -e '^VERSION' | cut -d
"=" -f2))
_KPL = $(strip $(shell cat $(KERNEL_SRC)/Makefile | grep -e '^PATCHLEVEL' | cut
-d"=" -f2))
_KSUB = $(strip $(shell cat $(KERNEL_SRC)/Makefile | grep -e '^SUBLEVEL' | cut -
d"=" -f2))
KERNEL_SERIES=$(_KVER).$(_KPL)

ifeq ($(KERNEL_SERIES), 2.6)
        TARGET=ipt_ipp2p.ko
else
        TARGET=ipt_ipp2p.o
endif

SED = sed
IPTABLES_BIN = iptables
ifndef $(IPTABLES_SRC)
IPTVER = \
        $(shell $(IPTABLES_BIN) --version | $(SED) -e 's/^iptables v//')
IPTABLES_SRC = $(wildcard /usr/src/iptables-$(IPTVER))
#IPTABLES_SRC = /var/tmp/portage/net-firewall/iptables-1.3.8-r1/work/iptables-1.
3.8
endif

ifeq ($(IPTABLES_SRC),)
$(warning You need to install iptables sources and maybe set IPTABLES_SRC)
endif

IPTABLES_INCLUDE = -I$(IPTABLES_SRC)/include

ifneq ($(IPTVER),)
        IPTABLES_VERSION = $(IPTVER)
else
        IPTABLES_VERSION = $(shell cat $(IPTABLES_SRC)/Makefile | grep -e '^IPTA
BLES_VERSION:=' | cut -d"=" -f2)
endif

IPTABLES_OPTION = -DIPTABLES_VERSION=\"$(IPTABLES_VERSION)\"

#CC = /usr/bin/x86_64-pc-linux-gnu-gcc-4.1.2
CC = gcc
CFLAGS = -O3 -Wall



all: modules libipt_ipp2p.so

modules: $(TARGET)

ipt_ipp2p.o: ipt_ipp2p.h ipt_ipp2p.c
        $(CC) $(CFLAGS) -I$(KERNEL_SRC)/include -c ipt_ipp2p.c -D__KERNEL__ -DMO
DULE $(MODVERSIONS)

ipt_ipp2p.ko: ipt_ipp2p.h ipt_ipp2p.c
        $(MAKE) -C $(KERNEL_SRC) M=$(PWD) modules


libipt_ipp2p.so: libipt_ipp2p.c ipt_ipp2p.h
        $(CC) $(CFLAGS) $(IPTABLES_OPTION) $(IPTABLES_INCLUDE) -fPIC -c libipt_i
pp2p.c
        $(CC) -shared -o libipt_ipp2p.so libipt_ipp2p.o

clean:
        -rm -f *.o *.so *.ko .*.cmd *.mod.c
endif
[root@sushe ipp2p-0.99.3]#


我以前都是按照一些文章做的,当环境有变化就不会解决了,请ShadowStar 圣骑士帮我解决这个问题,盼望您好久了,谢谢!
作者: ShadowStar    时间: 2007-11-19 21:18
你的内核的源代码目录在哪?
还有iptables的源代码目录?
作者: luojm_24680    时间: 2007-11-19 22:01
iptables是iptables1.3.8,源码在/usr/src/iptables-1.3.8目录下
kernel源码在/usr/src/linux-2.6.19
作者: luojm_24680    时间: 2007-11-19 22:04
iptables是iptables1.3.8,源码在/usr/src/iptables-1.3.8目录下
kernel源码在/usr/src/linux-2.6.19

谢谢,圣骑士
作者: 5639863    时间: 2007-11-19 22:08
原帖由 ShadowStar 于 2007-11-19 14:41 发表


把你的iptables-save的输出贴出来,我看看。

-A INPUT -m ipp2p --xunlei -j DROP
-A INPUT -i eth0 -j eth0_in
-A INPUT -i eth1 -j eth1_in
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -j Drop
-A INPUT -j LOG --log-prefix "Shorewall:INPUTROP:" --log-level 6
-A INPUT -j DROP
-A FORWARD -s 91.14.47.0/255.255.255.0 -d 211.144.205.17 -p tcp -j ACCEPT
-A FORWARD -s 91.14.47.0/255.255.255.0 -j DROP
-A FORWARD -m ipp2p --xunlei -j DROP
-A FORWARD -m conntrack --ctstate INVALID -j DROP
-A FORWARD -p tcp -m connlimit --connlimit-above 5 --connlimit-mask 32 -j DROP
-A FORWARD -m ipp2p --ipp2p -j DROP
-A FORWARD -p udp -m udp --dport 8000 -j ACCEPT
-A FORWARD -p udp -m udp --sport 8000 -j ACCEPT
-A FORWARD -p udp -m udp --dport 53 -j ACCEPT
-A FORWARD -p udp -m udp --sport 53 -j ACCEPT
-A FORWARD -s 172.16.15.0/255.255.255.0 -p udp -m udp --dport 53 -j ACCEPT
-A FORWARD -s 172.16.14.0/255.255.255.0 -p udp -m udp --dport 53 -j ACCEPT
-A FORWARD -s 172.16.4.0/255.255.255.0 -p udp -m udp --dport 53 -j ACCEPT
-A FORWARD -p udp -m udp --dport 1024:65535 -j DROP
-A FORWARD -s 172.16.15.0/255.255.255.0 -p tcp -m multiport --dports 21,22,25,53,80,110,443,8000,8080 -j ACCEPT
-A FORWARD -s 172.16.14.0/255.255.255.0 -p tcp -m multiport --dports 21,22,25,53,80,110,443,8000,8080 -j ACCEPT
-A FORWARD -s 172.16.4.0/255.255.255.0 -p tcp -m multiport --dports 21,22,25,53,80,110,443,8000,8080 -j ACCEPT
-A FORWARD -s 172.16.15.0/255.255.255.0 -j DROP
-A FORWARD -s 172.16.14.0/255.255.255.0 -j DROP
-A FORWARD -s 172.16.4.0/255.255.255.0 -j DROP
-A FORWARD -i eth0 -j eth0_fwd
-A FORWARD -i eth1 -j eth1_fwd
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -j Drop
-A FORWARD -j LOG --log-prefix "Shorewall:FORWARDROP:" --log-level 6
-A FORWARD -j DROP
-A OUTPUT -m ipp2p --xunlei -j DROP
-A OUTPUT -o eth0 -j eth0_out
-A OUTPUT -o eth1 -j eth1_out
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -j Drop
-A OUTPUT -j LOG --log-prefix "Shorewall:OUTPUTROP:" --log-level 6
-A OUTPUT -j DROP
-A Drop -p tcp -m tcp --dport 113 -j reject
-A Drop -j dropBcast
-A Drop -p icmp -m icmp --icmp-type 3/4 -j ACCEPT
-A Drop -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A Drop -j dropInvalid
-A Drop -p udp -m multiport --dports 135,445 -j DROP
-A Drop -p udp -m udp --dport 137:139 -j DROP
-A Drop -p udp -m udp --sport 137 --dport 1024:65535 -j DROP
-A Drop -p tcp -m multiport --dports 135,139,445 -j DROP
-A Drop -p udp -m udp --dport 1900 -j DROP
-A Drop -p tcp -j dropNotSyn
-A Drop -p udp -m udp --sport 53 -j DROP
-A Reject -p tcp -m tcp --dport 113 -j reject
-A Reject -j dropBcast
-A Reject -p icmp -m icmp --icmp-type 3/4 -j ACCEPT
-A Reject -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A Reject -j dropInvalid
-A Reject -p udp -m multiport --dports 135,445 -j reject
-A Reject -p udp -m udp --dport 137:139 -j reject
-A Reject -p udp -m udp --sport 137 --dport 1024:65535 -j reject
-A Reject -p tcp -m multiport --dports 135,139,445 -j reject
-A Reject -p udp -m udp --dport 1900 -j DROP
-A Reject -p tcp -j dropNotSyn
-A Reject -p udp -m udp --sport 53 -j DROP
-A dropBcast -m addrtype --dst-type BROADCAST -j DROP
-A dropBcast -d 224.0.0.0/240.0.0.0 -j DROP
-A dropInvalid -m state --state INVALID -j DROP
-A dropNotSyn -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -j DROP
-A eth0_fwd -m state --state INVALID,NEW -j dynamic
-A eth0_fwd -o eth1 -j lan2wan
-A eth0_in -m state --state INVALID,NEW -j dynamic
-A eth0_in -j lan2fw
-A eth0_out -j fw2lan
-A eth1_fwd -m state --state INVALID,NEW -j dynamic
-A eth1_fwd -o eth0 -j wan2lan
-A eth1_in -m state --state INVALID,NEW -j dynamic
-A eth1_in -j wan2fw
-A eth1_out -j fw2wan
-A fw2lan -m state --state RELATED,ESTABLISHED -j ACCEPT
-A fw2lan -j ACCEPT
-A fw2wan -m state --state RELATED,ESTABLISHED -j ACCEPT
-A fw2wan -j ACCEPT
-A lan2fw -m state --state RELATED,ESTABLISHED -j ACCEPT
-A lan2fw -j ACCEPT
-A lan2wan -m state --state RELATED,ESTABLISHED -j ACCEPT
-A lan2wan -j ACCEPT
-A logdrop -j DROP
-A logreject -j reject
-A reject -m addrtype --src-type BROADCAST -j DROP
-A reject -s 224.0.0.0/240.0.0.0 -j DROP
-A reject -p tcp -j REJECT --reject-with tcp-reset
-A reject -p udp -j REJECT --reject-with icmp-port-unreachable
-A reject -p icmp -j REJECT --reject-with icmp-host-unreachable
-A reject -j REJECT --reject-with icmp-host-prohibited
-A smurfs -s 0.0.0.0 -j RETURN
-A smurfs -m addrtype --src-type BROADCAST -j LOG --log-prefix "Shorewall:smurfsROP:" --log-level 6
-A smurfs -m addrtype --src-type BROADCAST -j DROP
-A smurfs -s 224.0.0.0/240.0.0.0 -j LOG --log-prefix "Shorewall:smurfsROP:" --log-level 6
-A smurfs -s 224.0.0.0/240.0.0.0 -j DROP
-A wan2fw -m state --state RELATED,ESTABLISHED -j ACCEPT
-A wan2fw -j Drop
-A wan2fw -j DROP
-A wan2lan -m state --state RELATED,ESTABLISHED -j ACCEPT
-A wan2lan -j ACCEPT
作者: ShadowStar    时间: 2007-11-20 01:47
原帖由 luojm_24680 于 2007-11-19 22:01 发表
iptables是iptables1.3.8,源码在/usr/src/iptables-1.3.8目录下
kernel源码在/usr/src/linux-2.6.19

那你就修改Makefile中的KERNEL_SRC = /usr/src/linux-2.6.19,IPTABLES_SRC = /usr/src/iptables-1.3.8
作者: ShadowStar    时间: 2007-11-20 01:55
原帖由 5639863 于 2007-11-19 22:08 发表

-A INPUT -m ipp2p --xunlei -j DROP
-A INPUT -i eth0 -j eth0_in
-A INPUT -i eth1 -j eth1_in
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -j Drop ...


没有帖全吧?
你不是说“iptables+squid的透明代理么?”

另外请看一下我29楼的回复,看看对不对。
作者: platinum    时间: 2007-11-20 08:22
迅雷虽然走 TCP/80,但其不具有 HTTP 头,所以不应被 squid 处理
但由于 iptables 针对 TCP/80 做了透明代理,使 TCP/80 产生了跳转,而 squid 又不会对 TCP/80 做处理,因此这种情况下迅雷是不会工作在 TCP/80 的,若迅雷没有受到影响而工作正常,那么言外之意迅雷一定使用了其他协议(TCP/UDP)或端口
作者: luojm_24680    时间: 2007-11-20 09:46
谢谢,圣骑士,按照您前面说的方法:make ipp2p-0.99.5成功!非常感谢!
作者: mytool2002    时间: 2007-11-20 11:34
标题: 回复 #1 ShadowStar 的帖子
楼主,那两个软件包是你自己的原创吗?
作者: ShadowStar    时间: 2007-11-20 12:36
原帖由 platinum 于 2007-11-20 08:22 发表
迅雷虽然走 TCP/80,但其不具有 HTTP 头,所以不应被 squid 处理
但由于 iptables 针对 TCP/80 做了透明代理,使 TCP/80 产生了跳转,而 squid 又不会对 TCP/80 做处理,因此这种情况下迅雷是不会工作在 TCP/8 ...


迅雷查询候选资源的数据包具有HTTP头,是POST Method的。
如果没有HTTP包头,SQUID不做处理的话,5639863那边就不会成功获得XX个候选资源了。

具体的数据包,白金兄可以看一下附件。

x2.pcap.gz

13.83 KB, 下载次数: 164


作者: ShadowStar    时间: 2007-11-20 12:37
原帖由 mytool2002 于 2007-11-20 11:34 发表
楼主,那两个软件包是你自己的原创吗?


谈不上原创,我只是在原始ipp2p-0.8.2模块的基础上进行了一些修改、添加了一些软件的特征识别。
作者: platinum    时间: 2007-11-20 12:56
原帖由 ShadowStar 于 2007-11-20 12:36 发表


迅雷查询候选资源的数据包具有HTTP头,是POST Method的。
如果没有HTTP包头,SQUID不做处理的话,5639863那边就不会成功获得XX个候选资源了。

具体的数据包,白金兄可以看一下附件。

看了一下,还真不太好办,其获取资源的方式是标准 HTTP 方式,棘手……
也真难为 ShadowStar 兄了
作者: 5639863    时间: 2007-11-20 18:08
原帖由 ShadowStar 于 2007-11-19 15:11 发表


我大概猜到为什么你那边还是能搜索到候选资源了。
1。你的透明代理是将发送到80端口的数据包转发到本地的SQUID代理服务器,然后再由SQUID代理发送到对方服务器。
2。迅雷搜索候选资源使用的http协议、80端 ...



[root@proxy5 ~]# iptables -vnL INPUT
Chain INPUT (policy DROP 0 packets, 0 bytes)
pkts bytes target     prot opt in     out     source               destination
1516  531K DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           ipp2p v0.99.5 --xunlei
OK,如你所说,我在INPUT链里面做了DROP规则,已经Ok了!今天下班看了一下有被DROP的数据了。

谢谢啊

[ 本帖最后由 5639863 于 2007-11-20 18:11 编辑 ]
作者: zhy0414    时间: 2007-11-21 14:53
我试了一下,跟楼主说的一样,迅雷成了单点下载了,但在我这下的一个文件的速度还是挺快的,怎马能让他根本就连不上?
作者: ShadowStar    时间: 2007-11-21 15:06
单点下载的话,就和IE的“另存为”没什么区别了,速度快只能说明与对方网站的连接速度快。
如果让这个连不上的话,只能是阻止所有的HTTP下载了。



0.99.6版在1楼

[ 本帖最后由 ShadowStar 于 2007-11-21 15:15 编辑 ]
作者: zhy0414    时间: 2007-11-21 20:40
原帖由 ShadowStar 于 2007-11-21 15:06 发表
单点下载的话,就和IE的“另存为”没什么区别了,速度快只能说明与对方网站的连接速度快。
如果让这个连不上的话,只能是阻止所有的HTTP下载了。



0.99.6版在1楼



有道理,就让那一条线先活着,楼主太伟大了,更新的真快,我刚把0.995弄好,0.996就出来了,强烈的支持
作者: fuleru    时间: 2007-11-22 10:20
不错,新的版本又出来了。哈哈,楼主真是强啊。。

对迅雷真的有效果了。

[ 本帖最后由 fuleru 于 2007-11-22 18:30 编辑 ]
作者: skynet    时间: 2007-11-22 16:35
建议说明一下,新版有什么改动。
作者: snow888    时间: 2007-11-22 16:46
好东西,我不得不佩服你啊。
作者: snow888    时间: 2007-11-22 16:48
原帖由 ShadowStar 于 2007-11-16 20:42 发表
主要是由于那个aeon_coming发的帖子太长了,大家看起来麻烦,所以重发一帖。

0.99.6版
ChangeLog

增加对于QQ超级旋风的过滤,添加在--xunlei选项中。(使用--xunlei选项同时针对迅雷和QQ超级旋风)

0 ...



这个咚咚必须要重新编译内核么?

有没有什么不用编译内核的好方法?
作者: 5639863    时间: 2007-11-22 17:08
哈哈,楼主的动作真快,晚上回去试一下,不过我从来不用超级旋风
作者: ShadowStar    时间: 2007-11-22 17:58
原帖由 snow888 于 2007-11-22 16:48 发表



这个咚咚必须要重新编译内核么?

有没有什么不用编译内核的好方法?


不需要重编译内核,只要重编译模块,并更新模块就好了。
作者: ShadowStar    时间: 2007-11-22 17:59
原帖由 skynet 于 2007-11-22 16:35 发表
建议说明一下,新版有什么改动。


察看ChangeLog。
也可以使用iptables的查看帮助
#iptables -m ipp2p --help

作者: snow888    时间: 2007-11-22 18:12
原帖由 ShadowStar 于 2007-11-22 17:58 发表


不需要重编译内核,只要重编译模块,并更新模块就好了。


这个如何编译安装,能详细说明一下么?

最好有一个安装教程什么的。
作者: ShadowStar    时间: 2007-11-22 18:38
原帖由 snow888 于 2007-11-22 18:12 发表


这个如何编译安装,能详细说明一下么?

最好有一个安装教程什么的。


见第一楼
作者: snow888    时间: 2007-11-22 18:54
原帖由 ShadowStar 于 2007-11-22 18:38 发表


见第一楼



那是不是说,我必须将 RHEL5 的源码也安装上去,才能编译安装这个软件包?
作者: ShadowStar    时间: 2007-11-22 19:19
原帖由 snow888 于 2007-11-22 18:54 发表



那是不是说,我必须将 RHEL5 的源码也安装上去,才能编译安装这个软件包?


只要有内核和iptables的源代码就可以
作者: seacon    时间: 2007-11-23 08:33
楼主真是强啊!顶!希望楼主能继续更新下去。
作者: springwind426    时间: 2007-11-23 09:00
gcc --version
gcc (GCC) 4.2.3 20071014 (prerelease) (Debian 4.2.2-3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

linux-2.6.23.8
iptables-1.3.8

编译后,运行不了,出现段错误
作者: zhy0414    时间: 2007-11-23 09:24
原帖由 springwind426 于 2007-11-23 09:00 发表
gcc --version
gcc (GCC) 4.2.3 20071014 (prerelease) (Debian 4.2.2-3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is N ...



1.3.8版的iptables不能直接make,1.3.5的可以
作者: ShadowStar    时间: 2007-11-23 09:24
原帖由 springwind426 于 2007-11-23 09:00 发表
gcc --version
gcc (GCC) 4.2.3 20071014 (prerelease) (Debian 4.2.2-3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is N ...


我这边没有使用gcc-4.2以上编译过
请把详细的信息贴出来,包括make的信息和错误的信息
作者: yanzai    时间: 2007-11-24 15:11
iptables -A FORWARD -p tcp -m ipp2p --xunlei -j DROP
iptables: No chain/target/match by that name


晕,怎么iptables会报这样的呢?
作者: ShadowStar    时间: 2007-11-24 16:52
原帖由 yanzai 于 2007-11-24 15:11 发表
iptables -A FORWARD -p tcp -m ipp2p --xunlei -j DROP
iptables: No chain/target/match by that name


晕,怎么iptables会报这样的呢?


请仔细察看一楼的编译说明
作者: 5639863    时间: 2007-11-24 17:58
原帖由 yanzai 于 2007-11-24 15:11 发表
iptables -A FORWARD -p tcp -m ipp2p --xunlei -j DROP
iptables: No chain/target/match by that name


晕,怎么iptables会报这样的呢?



是不是没有编译内核?
作者: springwind426    时间: 2007-11-25 12:03
原帖由 ShadowStar 于 2007-11-23 09:24 发表


我这边没有使用gcc-4.2以上编译过
请把详细的信息贴出来,包括make的信息和错误的信息



修改Makefile

KERNEL_SRC = ../linux-2.6.23.8
#KERNEL_SRC ?= $(firstword $(wildcard /lib/modules/$(shell uname -r)/build /usr/src/linux))
ifeq ($(KERNEL_SRC),)
$(error You need to define KERNEL_SRC)
endif

ifneq ($wildcard $(KERNEL_SRC)/include/linux/modversions.h),)
MODVERSIONS = -DMODVERSIONS
endif

_KVER = $(strip $(shell cat $(KERNEL_SRC)/Makefile | grep -e '^VERSION' | cut -d"=" -f2))
_KPL = $(strip $(shell cat $(KERNEL_SRC)/Makefile | grep -e '^PATCHLEVEL' | cut -d"=" -f2))
_KSUB = $(strip $(shell cat $(KERNEL_SRC)/Makefile | grep -e '^SUBLEVEL' | cut -d"=" -f2))
KERNEL_SERIES=$(_KVER).$(_KPL)

ifeq ($(KERNEL_SERIES), 2.6)
        TARGET=ipt_ipp2p.ko
else
        TARGET=ipt_ipp2p.o
endif

SED = sed
IPTABLES_BIN = iptables
#ifndef $(IPTABLES_SRC)
#IPTVER = \
#       $(shell $(IPTABLES_BIN) --version | $(SED) -e 's/^iptables v//')
#IPTABLES_SRC = $(wildcard /usr/src/iptables-$(IPTVER))
#IPTABLES_SRC = /var/tmp/portage/net-firewall/iptables-1.3.8-r1/work/iptables-1.3.8
#endif

IPTABLES_SRC = ../iptables-1.3.8-20071014
IPTVER = 1.3.8-20071014


还有,CFLAGS = -Wall  原来是  CFLAGS = -O3 -Wall

make
make -C ../linux-2.6.23.8 M=/usr/local/src/210.47.176.135/ipp2p-0.99.6 modules
make[1]: Entering directory `/usr/local/src/210.47.176.135/linux-2.6.23.8'
  CC [M]  /usr/local/src/210.47.176.135/ipp2p-0.99.6/ipt_ipp2p.o
/usr/local/src/210.47.176.135/ipp2p-0.99.6/ipt_ipp2p.c:960: warning: initialization from incompatible pointer type
/usr/local/src/210.47.176.135/ipp2p-0.99.6/ipt_ipp2p.c:963: warning: initialization from incompatible pointer type
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /usr/local/src/210.47.176.135/ipp2p-0.99.6/ipt_ipp2p.mod.o
  LD [M]  /usr/local/src/210.47.176.135/ipp2p-0.99.6/ipt_ipp2p.ko
make[1]: Leaving directory `/usr/local/src/210.47.176.135/linux-2.6.23.8'
gcc -Wall -DIPTABLES_VERSION=\"1.3.8-20071014\" -I../iptables-1.3.8-20071014/include -fPIC -c libipt_ipp2p.c
libipt_ipp2p.c:417: warning: initialization from incompatible pointer type
libipt_ipp2p.c:418: warning: initialization from incompatible pointer type
libipt_ipp2p.c:420: warning: initialization from incompatible pointer type
libipt_ipp2p.c:421: warning: initialization from incompatible pointer type
gcc -shared -o libipt_ipp2p.so libipt_ipp2p.o

然后,modprobe ipp2p是没有问题的

但是,用 iptables -m ipp2p --ipp2p 就提示 段错误

[ 本帖最后由 springwind426 于 2007-11-25 12:08 编辑 ]
作者: ShadowStar    时间: 2007-11-25 15:52
原帖由 springwind426 于 2007-11-25 12:03 发表



修改Makefile

KERNEL_SRC = ../linux-2.6.23.8
#KERNEL_SRC ?= $(firstword $(wildcard /lib/modules/$(shell uname -r)/build /usr/src/linux))
ifeq ($(KERNEL_SRC),)
$(error You need to defin ...


我这边用gcc-4.1.2编译,没有发现
libipt_ipp2p.c:417: warning: initialization from incompatible pointer type
libipt_ipp2p.c:418: warning: initialization from incompatible pointer type
libipt_ipp2p.c:420: warning: initialization from incompatible pointer type
libipt_ipp2p.c:421: warning: initialization from incompatible pointer type
的信息。

我怀疑是由于gcc新版本对于调用的指针类型不兼用导致的。

但是我这边没有gcc-4.2的环境,没办法了。
作者: fuleru    时间: 2007-11-25 19:46
又出来新的版本了?不错啊,又要新的一轮测试了!
作者: zhy0414    时间: 2007-11-26 13:43
楼主,请问怎样能将drop掉的包再进行分析?就是我想知道是哪个ip地址在使用p2p软件,能够实现吗?
作者: springwind426    时间: 2007-11-26 15:05
终于编译通过了

对源代码进行了修改,现把修改的部分贴上

  1. diff -dru ipp2p-0.99.6-r1/Makefile ipp2p-0.99.6-r1.new/Makefile
  2. --- ipp2p-0.99.6-r1/Makefile    2007-11-23 18:16:57.000000000 +0800
  3. +++ ipp2p-0.99.6-r1.new/Makefile        2007-11-26 13:20:47.000000000 +0800
  4. @@ -2,7 +2,7 @@
  5. obj-m := ipt_ipp2p.o

  6. else
  7. -KERNEL_SRC = /usr/src/linux
  8. +KERNEL_SRC = ../linux-2.6.22.8
  9. #KERNEL_SRC ?= $(firstword $(wildcard /lib/modules/$(shell uname -r)/build /usr/src/linux))
  10. ifeq ($(KERNEL_SRC),)
  11. $(error You need to define KERNEL_SRC)
  12. @@ -28,7 +28,7 @@
  13. ifndef $(IPTABLES_SRC)
  14. IPTVER = \
  15.         $(shell $(IPTABLES_BIN) --version | $(SED) -e 's/^iptables v//')
  16. -IPTABLES_SRC = $(wildcard /usr/src/iptables-$(IPTVER))
  17. +IPTABLES_SRC = $(wildcard ../iptables-$(IPTVER))
  18. #IPTABLES_SRC = /var/tmp/portage/net-firewall/iptables-1.3.8-r1/work/iptables-1.3.8
  19. endif

  20. @@ -46,7 +46,7 @@

  21. IPTABLES_OPTION = -DIPTABLES_VERSION=\"$(IPTABLES_VERSION)\"
  22. CC = gcc
  23. -CFLAGS = -O3 -Wall
  24. +CFLAGS = -O2 -Wall


  25. all: modules libipt_ipp2p.so
  26. diff -dru ipp2p-0.99.6-r1/libipt_ipp2p.c ipp2p-0.99.6-r1.new/libipt_ipp2p.c
  27. --- ipp2p-0.99.6-r1/libipt_ipp2p.c      2007-11-21 14:19:05.000000000 +0800
  28. +++ ipp2p-0.99.6-r1.new/libipt_ipp2p.c  2007-11-26 14:20:15.000000000 +0800
  29. @@ -67,23 +67,24 @@


  30. static void
  31. -init(struct ipt_entry_match *m, unsigned int *nfcache)
  32. +init(struct ipt_entry_match *m)
  33. {
  34.      struct ipt_p2p_info *info = (struct ipt_p2p_info *)m->data;

  35. -    *nfcache |= NFC_UNKNOWN;
  36. +//    *nfcache |= NFC_UNKNOWN;

  37.      /*init the module with default values*/
  38.      info->cmd = 0;
  39.      info->debug = 0;

  40. +    memset(info, 0, sizeof(struct ipt_p2p_info));
  41. +
  42. }

  43. static int
  44. parse(int c, char **argv, int invert, unsigned int *flags,
  45. -       const struct ipt_entry *entry,
  46. -       unsigned int *nfcache,
  47. +       const void *entry,
  48.         struct ipt_entry_match **match)
  49. {
  50.      struct ipt_p2p_info *info = (struct ipt_p2p_info *)(*match)->data;
  51. @@ -341,7 +342,7 @@


  52. static void
  53. -print(const struct ipt_ip *ip,
  54. +print(const void *ip,
  55.          const struct ipt_entry_match *match,
  56.         int numeric)
  57. {
  58. @@ -375,7 +376,7 @@


  59. static void
  60. -save(const struct ipt_ip *ip, const struct ipt_entry_match *match)
  61. +save(const void *ip, const struct ipt_entry_match *match)
  62. {
  63.      struct ipt_p2p_info *info = (struct ipt_p2p_info *)match->data;

复制代码



配置文件部分的差异可以不考虑,主要是那些函数定义部分的参数,我是参考set模块改写的,现在能够正常编译并运行
作者: getCookieID    时间: 2007-11-26 16:43
标题: 回复 #1 ShadowStar 的帖子
内核:
2.6.22 源码 /usr/src/linux-2.6.22
iptables:
1.3.8 源码 /usr/src/iptables-1.3.8

步骤:
改Makefile
1、KERNEL_SRC= /usr/src/linux-2.6.22
2、IPTABLES_SRC = /usr/src/iptables-1.3.8
3、$(CC) -shared -o libipt_ipp2p.so libipt_ipp2p.o 改为 ld -shared -o libipt_ipp2p.so libipt_ipp2p.o
4、make
5、cp libipt_ipp2p.so /lib/iptables
6、cp ipt_ipp2p.ko /lib/modules/2.6.22/kernel/net/ipv4/netfilter
7、depmod -a
8、service iptables stop
9、rmmod ipt_ipp2p
10、service iptables start

运行iptables -m ipp2p --help
提示
iptables v1.3.8: Couldn't load match `ipp2p'
请问是为什么?需要重启机器么?
作者: ShadowStar    时间: 2007-11-26 17:38
原帖由 zhy0414 于 2007-11-26 13:43 发表
楼主,请问怎样能将drop掉的包再进行分析?就是我想知道是哪个ip地址在使用p2p软件,能够实现吗?


可以在mangle表进行LOG
作者: ShadowStar    时间: 2007-11-26 17:39
原帖由 springwind426 于 2007-11-26 15:05 发表
终于编译通过了

对源代码进行了修改,现把修改的部分贴上

diff -dru ipp2p-0.99.6-r1/Makefile ipp2p-0.99.6-r1.new/Makefile
--- ipp2p-0.99.6-r1/Makefile    2007-11-23 18:16:57.000000000 +0800
+ ...


非常感谢
作者: ShadowStar    时间: 2007-11-26 17:41
原帖由 getCookieID 于 2007-11-26 16:43 发表
内核:
2.6.22 源码 /usr/src/linux-2.6.22
iptables:
1.3.8 源码 /usr/src/iptables-1.3.8

步骤:
改Makefile
1、KERNEL_SRC= /usr/src/linux-2.6.22
2、IPTABLES_SRC = /usr/src/iptables-1.3.8
3 ...


第3步,对于1.3.8版的iptables,不要修改Makefile中的
  1. $(CC) -shared -o libipt_ipp2p.so libipt_ipp2p.o 改为 ld -shared -o libipt_ipp2p.so libipt_ipp2p.o
复制代码

作者: platinum    时间: 2007-11-26 19:53

  1.      /*init the module with default values*/
  2.      info->cmd = 0;
  3.      info->debug = 0;

  4. +    memset(info, 0, sizeof(struct ipt_p2p_info));
  5. +
  6. }
复制代码

这个似乎没有必要
作者: zhy0414    时间: 2007-11-26 21:40
原帖由 ShadowStar 于 2007-11-26 17:38 发表


可以在mangle表进行LOG



mangle表可以给ip包打标记,怎吗能记录下来源地址?
作者: platinum    时间: 2007-11-26 23:55
原帖由 zhy0414 于 2007-11-26 21:40 发表



mangle表可以给ip包打标记,怎吗能记录下来源地址?

可以
# iptables -t mangle -I PREROUTING -p udp --dport 53 -j LOG
# tail -4 /var/log/messages
[quote]
Nov 26 23:54:33 PT_LINUX kernel: IN=HOME OUT= PHYSIN=ath0 MAC=00:14:78:71:0f:23:00:1b:77:37:54:10:08:00 SRC=172.17.39.103 DST=202.106.46.151 LEN=57 TOS=0x00 PREC=0x00 TTL=128 ID=48145 PROTO=UDP SPT=4286 DPT=53 LEN=37
Nov 26 23:54:57 PT_LINUX kernel: IN=HOME OUT= PHYSIN=ath0 MAC=00:14:78:71:0f:23:00:1b:77:37:54:10:08:00 SRC=172.17.39.103 DST=202.106.46.151 LEN=70 TOS=0x00 PREC=0x00 TTL=128 ID=48292 PROTO=UDP SPT=4286 DPT=53 LEN=50
Nov 26 23:55:03 PT_LINUX kernel: IN=HOME OUT= PHYSIN=eth1 MAC=00:14:78:71:0f:23:00:0a:e6:a9:64:a2:08:00 SRC=172.17.39.108 DST=202.106.0.20 LEN=59 TOS=0x00 PREC=0x00 TTL=128 ID=11185 PROTO=UDP SPT=1029 DPT=53 LEN=39
Nov 26 23:55:09 PT_LINUX kernel: IN=HOME OUT= PHYSIN=ath0 MAC=00:14:78:71:0f:23:00:1b:77:37:54:10:08:00 SRC=172.17.39.103 DST=202.106.46.151 LEN=80 TOS=0x00 PREC=0x00 TTL=128 ID=48357 PROTO=UDP SPT=4286 DPT=53 LEN=60

[/quote]
作者: springwind426    时间: 2007-11-27 09:30
原帖由 platinum 于 2007-11-26 19:53 发表

     /*init the module with default values*/
     info->cmd = 0;
     info->debug = 0;

+    memset(info, 0, sizeof(struct ipt_p2p_info));
+
}

这个似乎没有必要



我是依葫芦画瓢的,有没有必要我也不知道  
作者: zhy0414    时间: 2007-11-27 10:50
原帖由 platinum 于 2007-11-26 23:55 发表

可以
[/quote]


多谢指点
作者: fuleru    时间: 2007-11-28 09:23
最新的版本反面对迅雷不起作用了,奇怪。原来用0.95版本是起了作用的。
作者: ShadowStar    时间: 2007-11-28 13:05
原帖由 fuleru 于 2007-11-28 09:23 发表
最新的版本反面对迅雷不起作用了,奇怪。原来用0.95版本是起了作用的。



不应该啊,0.99.6-r1版的过滤特征码是包含0.99.5的

能否抓包贴出来?只要抓到显示出“搜索到XXX个候选资源”就可以
作者: fuleru    时间: 2007-11-28 18:37
的确是这样。。。


2007-11-28 18:35:34 开始连接......
2007-11-28 18:35:34 使用资源http://soft.ylmf.com/download.ph ... id=864&s=0.html单独下载
2007-11-28 18:35:35 原始资源连接成功,得到的文件长度: 37508275
2007-11-28 18:35:35 开始创建文件......
2007-11-28 18:35:35 文件创建成功,开始下载数据......


然后就开开始下载了。。。

不过,源只有一个。。

迅雷的版本是5.1.5.189
作者: ShadowStar    时间: 2007-11-28 21:08
原帖由 ShadowStar 于 2007-11-18 17:25 发表


不应该一点数据都没有下载啊。

这个屏蔽的不是迅雷的全部下载,仅仅是屏蔽了迅雷从其他候选资源进行的p2sp下载,原始资源还是可以下载的。

在迅雷的任务信息应该能看到“搜索候选资源发生错误,稍后重 ...


fuleru
这个模块并不是完全阻止迅雷下载,仅仅是阻止迅雷通过候选资源多点下载。

[ 本帖最后由 ShadowStar 于 2007-11-28 21:09 编辑 ]
作者: fuleru    时间: 2007-11-28 22:01
知道了,我全看过上面的帖子和以前的帖子才知道。

就是让迅雷变成快车
作者: platinum    时间: 2007-11-29 03:16
原帖由 fuleru 于 2007-11-28 22:01 发表
知道了,我全看过上面的帖子和以前的帖子才知道。

就是让迅雷变成快车

要想阻止迅雷软件也简单,你把 HTTP 和 FTP 也禁掉 :wink:
作者: squarewang    时间: 2007-12-01 13:19
11月出来的最新的好像不行
有没有热用最新的测试成功的
作者: ShadowStar    时间: 2007-12-01 14:32
原帖由 squarewang 于 2007-12-1 13:19 发表
11月出来的最新的好像不行
有没有热用最新的测试成功的


最新的什么软件?迅雷么?
我这边测试用的是5.7.4的
作者: fuleru    时间: 2007-12-04 13:51
又出新的版本了??呵呵,不错啊。

用了ShadowStar 的pp2p发现网络近来好了好多啊。

新的版本出现,标题也在更新ing。

[ 本帖最后由 fuleru 于 2007-12-5 09:46 编辑 ]
作者: laixi781211    时间: 2007-12-05 11:45
顶一下,又出来新版了。
作者: 5639863    时间: 2007-12-05 19:29
更新的速度可真是快啊,真好。
作者: skynet    时间: 2007-12-06 11:39
我编译成功,messages日志出现这个提示:“kernel: ipt_ipp2p: no version for "struct_module" found: kernel tainted.”
执行:iptables -D INTPUT -m ipp2p --ipp2p -j DROP没有什么提示,lsmod | grep ipp2p也有ipt_ipp2p,但迅雷还可以下载,版本:5.7.4.401的。
作者: ShadowStar    时间: 2007-12-06 12:47
原帖由 skynet 于 2007-12-6 11:39 发表
我编译成功,messages日志出现这个提示:“kernel: ipt_ipp2p: no version for "struct_module" found: kernel tainted.”
执行:iptables -D INTPUT -m ipp2p --ipp2p -j DROP没有什么提示,lsmod | grep ipp ...


请阅读置顶帖,以了解iptables的基本使用规则。

请阅读1楼说明,了解ipp2p的使用说明。
作者: jick0214    时间: 2007-12-06 13:06
原帖由 fuleru 于 2007-11-18 08:58 发表
编译成功。谢谢

dmesg | grep IPP
IPP2P v0.99.5 loading

iptables -A FORWARD -p udp -m time --timestart 08:00 --timestop 20:00 --days Mon,Tue,Wed,Thu,Fri,Sat -m ipp2p --xunlei -j DROP
iptabl ...


我想请教一下为什么他用 dmesg | grep IPP  IPP2P v0.99.5 loading

我用的时候显示余下
[root@porxy ~]# dmesg | grep IPP      
IPP2P v0.8.1_rc1 loading
IPP2P v0.8.1_rc1 unloaded
IPP2P v0.8.1_rc1 loading
IPP2P v0.8.1_rc1 unloaded
IPP2P v0.8.1_rc1 loading
IPP2P v0.8.1_rc1 unloaded
IPP2P v0.99.7 loading
IPP2P v0.99.7 unloaded
IPP2P v0.99.7 loading
请问这个 IPP2P v0.8.1_rc1 loading 会影响到 IPP2P v0.99.7 loading 的使用效果吗?
IPP2P v0.99.7  好像对 pps 没有效果,其他的测试都OK!

[ 本帖最后由 jick0214 于 2007-12-6 13:11 编辑 ]
作者: ShadowStar    时间: 2007-12-06 13:27
原帖由 jick0214 于 2007-12-6 13:06 发表


我想请教一下为什么他用 dmesg | grep IPP  IPP2P v0.99.5 loading

我用的时候显示余下
[root@porxy ~]# dmesg | grep IPP      
IPP2P v0.8.1_rc1 loading
IPP2P v0.8.1_rc1 unloaded
IPP2P v0.8 ...


你看dmesg的信息,最终加载的还是0.99.7版的,0.8.1_rc1版的unloaded。

至于pps无效,能说明一下你使用的版本么?最好能抓一下包。
我这边测试是可以的,包括PPStream启用“我的网络受到运营商限制”选项。
作者: skynet    时间: 2007-12-06 14:14
iptables -A INTPUT -m ipp2p --xunlei -j DROP
还是不行。
作者: ShadowStar    时间: 2007-12-06 15:00
原帖由 skynet 于 2007-12-6 14:14 发表
iptables -A INTPUT -m ipp2p --xunlei -j DROP
还是不行。


你的网络拓扑结构是什么?为什么在INPUT链DROP?

你在Linux下用迅雷?
作者: skynet    时间: 2007-12-06 15:41
用Squid做透明代理的。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2