V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
luckypoem
V2EX  ›  macOS

如何在 mac 上成功编译 iptables?

  •  
  •   luckypoem · 2016-04-09 19:12:19 +08:00 · 4960 次点击
    这是一个创建于 2931 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我在 mac 上编译 iptables,遇到错误(在 make 这一步):
    wget http://www.netfilter.org/projects/iptables/files/iptables-1.6.0.tar.bz2
    tar jxvf iptables-1.6.0.tar.bz2
    cd iptables-1.6.0
    ./configure
    make (在 make 这步遇到错误)

    ../include/linux/types.h:4:10: fatal error: 'asm/types.h' file not found
    #include <asm/types.h>
    ^
    1 error generated.
    make[2]: *** [libip4tc.lo] Error 1
    make[1]: *** [all-recursive] Error 1
    make: *** [all] Error 2
    yudeMacBook-Air:iptables-1.6.0 brite$

    在 google 里搜索了 fatal error: 'asm/types.h' file not found ,始终未找到解决办法。
    有 mac 的读者可以在你的 mac 上,尝试编译 iptables 吗?看看是否也遇到我这样的错误?
    非常感谢你的回复
    13 条回复    2016-04-09 23:09:31 +08:00
    UnisandK
        1
    UnisandK  
       2016-04-09 19:19:36 +08:00
    编译出来能用吗。。
    luckypoem
        2
    luckypoem  
    OP
       2016-04-09 19:22:51 +08:00
    @UnisandK ,这个要编译成功之后才知道。
    chinvo
        3
    chinvo  
       2016-04-09 19:26:33 +08:00
    iptables 需要内核支持
    UnisandK
        5
    UnisandK  
       2016-04-09 19:28:22 +08:00
    @luckypoem 我是说理论上,像这个人问的。。 http://lists.netfilter.org/pipermail/netfilter/2003-June/045010.html

    > If I understand correctly, there are two parts of iptables,
    > kernel space and user space and what we use in the RPM is
    > only user space. It need the kernel space change compiled
    > into the kernel, e.g. Linux. If so, does anyone know if
    > the Mac OS kernel, based on BSD I believe, supports the user
    > space part of the iptables?

    iptables 不仅是有它自己的代码实现,它还依靠了内核特性啊。。
    Zzzzzzzzz
        6
    Zzzzzzzzz  
       2016-04-09 19:28:58 +08:00
    iptables 是用来操作 netfilter 的, netfilter 是 linux kernel 里的......
    auser
        7
    auser  
       2016-04-09 19:33:10 +08:00 via iPhone
    我可以帮你实现内核模块让你在 mac 上用 iptables 😃
    luckypoem
        8
    luckypoem  
    OP
       2016-04-09 19:50:44 +08:00
    @UnisandK 哈,那条问题是我问的,当时提交后,找不到问题的地址了,谢谢你无意中替我找回
    luckypoem
        9
    luckypoem  
    OP
       2016-04-09 19:56:02 +08:00
    不过这里 http://lists.netfilter.org/pipermail/netfilter/2003-June/045010.html ,说:“ You don't need to even 'get' ipfw on Mac OS X. It's there by default (at
    /sbin/ipfw).”,我的 mac 上怎么没有 ipfw 命令??

    yudeMacBook-Air:privoxy brite$ /sbin/ipfw
    -bash: /sbin/ipfw: No such file or directory
    yudeMacBook-Air:privoxy brite$ ipfw
    -bash: ipfw: command not found
    yudeMacBook-Air:privoxy brite$
    luckypoem
        10
    luckypoem  
    OP
       2016-04-09 19:58:55 +08:00
    @auser 你怎么实现呢?
    congeec
        11
    congeec  
       2016-04-09 20:02:49 +08:00
    @luckypoem ipfw is gone, use pfctl instead
    auser
        12
    auser  
       2016-04-09 23:01:52 +08:00 via iPhone
    @luckypoem 写内核扩展 不过目前没动力和时间精力搞
    yangxin0
        13
    yangxin0  
       2016-04-09 23:09:31 +08:00 via iPhone
    iptables 基于 netfilter , Mac 内核都没得这个子系统
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5632 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 06:13 · PVG 14:13 · LAX 23:13 · JFK 02:13
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.