Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getprotobyname error iptables

Tags:

android

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
like image 548
user907810 Avatar asked Dec 12 '22 03:12

user907810


2 Answers

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

like image 178
Hans-Christoph Steiner Avatar answered Jan 04 '23 09:01

Hans-Christoph Steiner


You can type 6 instead of tcp.

iptables -A INPUT -p 6 (instead of iptables -A INPUT -p tcp )

http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml

like image 37
Hayro Avatar answered Jan 04 '23 07:01

Hayro