- 论坛徽章:
- 0
|
2.6.24内核1.4.0iptables下编译成功!
还是要感谢ShadowStar的帮助,以及73楼的兄弟。
把过程贴出来 希望能帮助有需要的人
2.6.24.7内核,1.4.0iptables下成功编译加载ipp2p
ipp2p版本为0.99.15,其中关于迅雷的特征码已更新如下。
if ( (*t < 0x40) && (*(t+1) == 0x00) && get_u16(t,2) == __constant_htons(0x0000) && (*(t+5) == 0x00 || *(t+5) == 0x01) && get_u16(t,6) == __constant_htons(0x0000) && (get_u32(t, == (payload+plen-t-12)) ) return (IPP2P_XUNLEI *100 + 1);
下载2.6.24.7的内核源码,1.4.0的iptables
编译定制内核:
tar zxvf linux-2.6.24.7.tar.gz
cd linux-2.6.24.7/
make menuconfig 。
make bzImage
make modules
make modules_install
make install
vi /etc/grub.conf 将新内核设置为默认启动项。
reboot 重启系统
uname -r 查看新内核版本为:2.6.24.7
编译安装iptables1.4.0
bzip2 -d iptables-1.4.0.tar.bz2
tar xvf iptables-1.4.0.tar
cd iptables-1.4.0/
make KERNEL_DIR=/usr/src/linux-2.6.24.7
make install KERNEL_DIR=/usr/src/linux-2.6.24.7
iptables 查看iptables版本为1.4.0
编译加载ipp2p(这个步骤一定会出现一些问题,是新版本的内核和iptabels的改变导致的)
首先修改Makefile,编译
tar zxvf ipp2p-0.99.15.tar.gz
cd ipp2p-0.99.15/
vi Makefile 修改kernel_dir为/usr/src/linux-2.6.24.7
make
如果完全按照上面的步骤操作,编译的时候遇到的第一个错误应该
是这样的:图一
这是因为因为引用了iptables1.4.0的头文件造成的。这里需要用系统的ip_tables.h来替换iptbales1.4.0的ip_tables.h:
拷贝/usr/include/linux/netfilter_ipv4下的ip_tables.h到/usr/src/iptables-1.4.0/include/netfilter_ipv4/下覆盖原来的。
之前最好将原来的改个名字备份。
然后重新编译,make clean; make
会看到如下的警告信息: 图二
这是版本差异造成的,需要修改代码:
修改libipt_ipp2p.c
找到报警的行:375,376,378,379
参考系统的libxt_mark.c修改相关代码如下:
static void
-init(struct ipt_entry_match *m, unsigned int *nfcache)
+init(struct xt_entry_match *m)
{
struct ipt_p2p_info *info = (struct ipt_p2p_info *)m->data;
- *nfcache |= NFC_UNKNOWN;
+// *nfcache |= NFC_UNKNOWN;
/*init the module with default values*/
info->cmd = 0;
info->debug = 0;
}
static int
parse(int c, char **argv, int invert, unsigned int *flags,
- const struct ipt_entry *entry,
- unsigned int *nfcache,
+ const void *entry,
struct xt_entry_match **match)
{
struct ipt_p2p_info *info = (struct ipt_p2p_info *)(*match)->data;
static void
-print(const struct ipt_ip *ip,
+print(const void *ip,
const struct xt_entry_match *match,
int numeric)
{
static void
-save(const struct ipt_ip *ip, const struct iptt_entry_match *match)
+save(const void *ip, const struct xt_entry_match *match)
{
struct ipt_p2p_info *info = (struct ipt_p2p_info *)match->data;
重新编译,make clean make
成功编译!
经加载测试,能够屏蔽最新版本的迅雷下载。
[ 本帖最后由 banevv 于 2008-7-16 12:59 编辑 ] |
|