Skip to contentSkip to conversation

iptables return code 256

DISCUSSION Ralf 2 participants 4 messages Feb 20, 2009 netfilter

lore
Share & tools
lore

Ralf

author
#0 lore raw

Sometimes an insert operation (-I) fails and iptables returns 256. Under which circumstances can iptables give a return code 256 ?

(I guess it happens when an internal resource is in locked state when user issues the iptables command, right?)

#1 lore raw
Quoted 2 lines · Ralf

Sometimes an insert operation (-I) fails and iptables returns 256. Under which circumstances can iptables give a return code 256 ?

Never should this happen, because the lower 8 bits of 256 that make up the exist status are 0 actually.
Or where do you see 256?

author
#2 lore raw
Quoted 8 lines · Jan Engelhardt
Quoted 2 lines · Ralf

Sometimes an insert operation (-I) fails and iptables returns 256. Under which circumstances can iptables give a return code 256 ?

Never should this happen, because the lower 8 bits of 256 that make up the exist status are 0 actually.
Or where do you see 256?

int rc = system(sz); // sz="iptables ..."

rc is sometimes definitely 256 !

What does it mean?

#3 lore raw
Quoted 9 lines · Ralf
Quoted 8 lines · Jan Engelhardt
Quoted 2 lines · Ralf

Sometimes an insert operation (-I) fails and iptables returns 256. Under which circumstances can iptables give a return code 256 ?

Never should this happen, because the lower 8 bits of 256 that make up the exist status are 0 actually.
Or where do you see 256?

[I thought about $? first...]

Quoted 6 lines

int rc = system(sz); // sz="iptables ..."

rc is sometimes definitely 256 !

What does it mean?

Humph humph, this is not a C forum!

man 3 system:

RETURN VALUE
The value returned is -1 on error (e.g. fork(2) failed), and the
return status of the command otherwise. This latter return status is in the format specified in wait(2). Thus, the exit code of the command
will be WEXITSTATUS(status). In case /bin/sh could not be executed,
the exit status will be that of a command that does exit(127).