iptables.c changes submitted argv value
Hi,
can anyone tell me why it's necessary to set optarg[0] in case of '!' to '\0'?
iptables.c line 2010
---
case 1: /* non option */
if (optarg[0] == '!' && optarg[1] == '\0') {
if (invert)
exit_error(PARAMETER_PROBLEM,
"multiple consecutive ! not"
" allowed");
invert = TRUE;
-----> optarg[0] = '\0';
continue;
}
printf("Bad argument `%s'\n", optarg);
exit_tryhelp(2);---
I don't search a solution for this, only an explanation.
The Problem is i wanna build a deamon with iptables, which load's a static ruleset on init. In case of:
---
deamon -A INPUT -m mark ! --mark 0 -j IDS
deamon -A OUTPUT -m mark ! --mark 0 -j IDS
---
... my init crashes with "Bad Argument ''", because do_command in iptables changes my values ('!' to '\0')
for the ! in the second line (output-rule) ...
Thanks & Regards
Sascha
Quoted 2 lines · Sascha
The Problem is i wanna build a deamon with iptables, which load's a static ruleset on init.
The recommended method for doing this is using iptables-restore via a pipe from your daemon.
Regards
Henrik