如何在 mac 上成功编译 iptables?

2016-04-09 19:12:19 +08:00
 luckypoem
我在 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 吗?看看是否也遇到我这样的错误?
非常感谢你的回复
5013 次点击
所在节点    macOS
13 条回复
UnisandK
2016-04-09 19:19:36 +08:00
编译出来能用吗。。
luckypoem
2016-04-09 19:22:51 +08:00
@UnisandK ,这个要编译成功之后才知道。
chinvo
2016-04-09 19:26:33 +08:00
iptables 需要内核支持
yixiang
2016-04-09 19:27:46 +08:00
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
2016-04-09 19:28:58 +08:00
iptables 是用来操作 netfilter 的, netfilter 是 linux kernel 里的......
auser
2016-04-09 19:33:10 +08:00
我可以帮你实现内核模块让你在 mac 上用 iptables 😃
luckypoem
2016-04-09 19:50:44 +08:00
@UnisandK 哈,那条问题是我问的,当时提交后,找不到问题的地址了,谢谢你无意中替我找回
luckypoem
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
2016-04-09 19:58:55 +08:00
@auser 你怎么实现呢?
congeec
2016-04-09 20:02:49 +08:00
@luckypoem ipfw is gone, use pfctl instead
auser
2016-04-09 23:01:52 +08:00
@luckypoem 写内核扩展 不过目前没动力和时间精力搞
yangxin0
2016-04-09 23:09:31 +08:00
iptables 基于 netfilter , Mac 内核都没得这个子系统

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/269805

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX