海运的博客

OpenWRT编译安装Iptables IPID模块

发布时间:September 15, 2012 // 分类:OpenWrt // 4 Comments

之前有介绍Openwrt下IPID模块的使用及自己编译的Openwrt IPID固件下载,本次记录下编译过程。
Openwrt源码根目录下编辑:

include/netfilter.mk

在ipopt软件包下添加:

$(eval $(call nf_add,IPT_IPOPT,CONFIG_NETFILTER_XT_TARGET_IPID, $(P_XT)xt_IPID))

编辑:

package/iptables/Makefile

在HL下添加:

- IPID

编辑:

package/kernel/modules/netfilter.mk

在TTL下添加:

 - IPID 

下载dev.openwrt.org.cn提供的IPID源码patch:

#https://www.haiyun.me
wget -P package/iptables/patches/ https://dev.openwrt.org.cn/export/553/trunk/package/iptables/patches/006-iptable-ipid.patch
wget -P target/linux/generic-2.6/patches-2.6.32/ https://dev.openwrt.org.cn/export/553/trunk/target/linux/generic/patches-2.6.32/995-netfilter_linux-ipid.patch

修改iptable-ipid.patch第二行为:

+++ b/extensions/libxt_IPID.c

然后编译Openwrt固件,选择IPOPT软件包即可。

标签:iptables, openwrt, ipid, openwrt编译添加ipid模块

有 4 条 关于" OpenWRT编译安装Iptables IPID模块 "的评论

  1. Jason

    你好,我按照你的文章编译了,但是是在比较新的3.3的内核上编译的,编译成功后运行提示说iptables: Input/output error. 请问你是在2.6.32的内核上编译的吗?

  2. 海运

    在2.6内核编译的,3未测试。

  3. chinashit

    我尝试改了一下,好像能用了,不知道是不是生效了。
    --- old/build_dir/linux-ar71xx_generic/linux-3.3.8/net/netfilter/xt_IPID.c 2014-10-20 21:47:16.000000000 +0800
    +++ new/build_dir/linux-ar71xx_generic/linux-3.3.8/net/netfilter/xt_IPID.c 2014-10-20 21:44:57.000000000 +0800
    @@ -3,6 +3,7 @@
    */

    +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
    #include
    #include
    #include
    @@ -29,7 +30,7 @@
    }

    static unsigned int
    -ipid_tg(struct sk_buff *skb, const struct xt_target_param *par)
    +ipid_tg(struct sk_buff *skb, const struct xt_action_param *par)

    {
    struct iphdr *iph;
    @@ -41,9 +42,7 @@
    return NF_DROP;

    iph = ip_hdr(skb);
    -
    id=get_id(par->out->name);
    -
    switch(info->mode){
    case IP_IPID_PACE:
    new_ipid[id] += info->ipid;
    @@ -60,14 +59,14 @@
    }

    -static bool ipid_tg_check(const struct xt_tgchk_param *par)
    +static int ipid_tg_check(const struct xt_tgchk_param *par)
    {
    if(strcmp(par->table, "mangle") != 0 ){
    - printk(KERN_WARNING "IPID: can only be called from \'mangle\' table, not \'%s\'.\n", par->table);
    - return false;
    + pr_info("IPID: can only be called from \'mangle\' table, not \'%s\'.\n", par->table);
    + return -EINVAL;
    }

    - return true;
    + return 0;

    }

  4. 陈浩南

    您好,您教程中的 dev.openwrt.org.cn 现在似乎不可用了。请问现在应该在哪里下载 ipid 的 patch 呢?

评论已关闭

分类
最新文章
最近回复
  • 海运: 恩山有很多。
  • swsend: 大佬可以分享一下固件吗,谢谢。
  • Jimmy: 方法一 nghtp3步骤需要改成如下才能编译成功: git clone https://git...
  • 海运: 地址格式和udpxy一样,udpxy和msd_lite能用这个就能用。
  • 1: 怎么用 编译后的程序在家里路由器内任意一台设备上运行就可以吗?比如笔记本电脑 m参数是笔记本的...
  • 孤狼: ups_status_set: seems that UPS [BK650M2-CH] is ...
  • 孤狼: 擦。。。。apcupsd会失联 nut在冲到到100的时候会ONBATT进入关机状态,我想想办...
  • 海运: 网络,找到相应的url编辑重发请求,firefox有此功能,其它未知。
  • knetxp: 用浏览器F12网络拦截或监听后编辑重发请求,修改url中的set为set_super,将POS...
  • Albert: 啊啊啊啊啊啊啊啊啊 我太激动了,终于好了英文区搜索了半天,翻遍了 pve 论坛没找到好方法,博...