getprotobyname错误的iptables错误、getprotobyname、iptables

2023-09-13 01:21:17 作者:请上我的贼船

我已经用的android iptables的支持植根设备上。

我似乎得到这个错误,任何人有任何想法,为什么?

 的iptables -A INPUT -p tcp的-i eth0的--dport 8000 -m状态--state NEW -j ACCEPT
 

 整我!实施getprotobyname()仿生/ libc中/仿生/ stubs.c:378
 

解决方案

Android使用仿生libc中,这是缺少很多东西真的很少的libc。该错误信息是说, getprotobyname()未在仿生libc中实现的。 的iptables 似乎想运行命令时被触发这个错误,但我的猜测是,它忽略了 -p TCP 的一部分,只设置对所有协议规则。

幸运该功能不是必须的使用iptables工作。 getprotobyname()只是协议的名称转换如TCP为数字(TCP == 6)。你可以在这里找到这些数字:http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml

Error getaddrinfo failed

使用的协议号,而不是 -p 6 来消除错误消息:

iptables的-A INPUT -p 6 -i eth0的--dport 8000 -m状态--state NEW -j ACCEPT

I have android with iptables support on a rooted device.

I seem to get this error, anyone have any idea why?

iptables -A INPUT -p tcp -i eth0 --dport 8000 -m state --state NEW -j ACCEPT

FIX ME! implement getprotobyname() bionic/libc/bionic/stubs.c:378

解决方案

Android uses Bionic libc, which is a really minimal libc that is missing lots of things. That error message is saying that getprotobyname() is not implemented in Bionic libc. iptables seems to run the command anyway when this error is triggered, but my guess is that its ignoring the -p tcp part and just setting the rule for all protocols.

Luckily that function is not essential to working with iptables. getprotobyname() just converts protocol names like tcp to a number (tcp == 6). You can find those numbers here: http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml

Use the protocol number instead -p 6 to eliminate the error message:

iptables -A INPUT -p 6 -i eth0 --dport 8000 -m state --state NEW -j ACCEPT