android中的iptables错误:iptables-save和iptables-restore无效

我已经为Android模拟器编译了Linux,并启用了完整的netfilter功能。从源代码构建android之后获得了iptables二进制文件。 当我把这个二进制文件推送到模拟器 我可以成功执行下面的命令。
iptables -L
iptables -F
iptables -A INPUT -s www.google.com -j DROP 
有这个错误:
# # iptables -L
getsockopt for multiport failed strangely: No such file or directory
getsockopt for multiport failed strangely: No such file or directory
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
# 
# iptables -A INPUT -s www.google.com -j DROP
getsockopt for multiport failed strangely: No such file or directory
getsockopt for multiport failed strangely: No such file or directory
FIX ME! implement getgrnam() bionic/libc/bionic/stubs.c:344
但至少他们上面的命令工作! 但是当我尝试
iptables-save     or
iptables-restore
我得到错误说
iptables-save: not found
在我的配置文件中
CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
问题是什么..??如何在android中启用完整的iptables功能,或者如何安全地保存当前活动的iptables规则并在下次重启时重新加载它们。 请帮忙。谢谢!     
已邀请:
这是我添加到Android.mk中以获取iptables-save和iptables-retore的内容。 它在android 4.0.3上编译好。 #------------------------------------------------- --------------- #iptables-save 包括$(CLEAR_VARS) LOCAL_C_INCLUDES:=     $(LOCAL_PATH)/../包括/ LOCAL_CFLAGS:= - DNO_SHARED_LIBS = 1 LOCAL_CFLAGS + = - DALL_INCLUSIVE LOCAL_CFLAGS + = - DXTABLES_INTERNAL #容纳未设置__ANDROID__的arm-eabi-4.4.3工具 LOCAL_CFLAGS + = - D__ANDROID__ LOCAL_SRC_FILES:=     iptables-save.c iptables.c xshared.c LOCAL_MODULE_TAGS:=可选 LOCAL_MODULE:= iptables-save命令 LOCAL_STATIC_LIBRARIES:=     libext     libext4     libip4tc     libxtables 包含$(BUILD_EXECUTABLE) #------------------------------------------------- --------------- #iptables-restore 包括$(CLEAR_VARS) LOCAL_C_INCLUDES:=     $(LOCAL_PATH)/../包括/ LOCAL_CFLAGS:= - DNO_SHARED_LIBS = 1 LOCAL_CFLAGS + = - DALL_INCLUSIVE LOCAL_CFLAGS + = - DXTABLES_INTERNAL #容纳未设置__ANDROID__的arm-eabi-4.4.3工具 LOCAL_CFLAGS + = - D__ANDROID__ LOCAL_SRC_FILES:=     iptables-restore.c iptables.c xshared.c LOCAL_MODULE_TAGS:=可选 LOCAL_MODULE:=由iptables-restore LOCAL_STATIC_LIBRARIES:=     libext     libext4     libip4tc     libxtables 包含$(BUILD_EXECUTABLE)     
iptables-save
iptables-restore
二进制文件不是由默认的Android系统makefile构建的。 你需要在
$mydroid/external/iptables/
中为
Android.mk
文件添加规则来构建它们。源文件
iptables-save.c
iptables-restore.c
已经在该目录中。 未经测试,但要建立
iptables-save
,在
Android.mk
的末尾添加这样的东西。冲洗并重复
iptables-restore
#
# Build iptables-save
#

include $(CLEAR_VARS)

LOCAL_C_INCLUDES:= 
    $(LOCAL_PATH)/include/ 
    $(KERNEL_HEADERS)

LOCAL_CFLAGS:=-DNO_SHARED_LIBS
LOCAL_CFLAGS+=-DIPTABLES_VERSION="1.3.7"

LOCAL_SRC_FILES:= 
    iptables-save.c 

LOCAL_MODULE_TAGS:=debug
LOCAL_MODULE:=iptables-save

LOCAL_STATIC_LIBRARIES := 
    libiptc 
    libext

include $(BUILD_EXECUTABLE)
    

要回复问题请先登录注册