This patch adds better error reporting when the user inserts a space
between two states with the --state option.
iptables -I INPUT -m state ESTABLISHED, RELATED
^
mind the space
results in:
iptables v1.4.2-rc1: Bad state `'
Try `iptables -h' or 'iptables --help' for more information.
Now this returns:
iptables v1.4.2-rc1: `--state' requires a list of states with no
spaces, e.g. ESTABLISHED,RELATED
This patch also applies to libxt_conntrack which has a copy of the
function.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
exit_error(PARAMETER_PROBLEM, "Bad ctstate `%s'", arg);
arg = comma+1;
}
-
+ if (!*arg)
+ exit_error(PARAMETER_PROBLEM, "`--ctstate' requires a list of "
+ "states with no spaces, e.g. "
+ "ESTABLISHED,RELATED");
if (strlen(arg) == 0 || !parse_state(arg, strlen(arg), sinfo))
exit_error(PARAMETER_PROBLEM, "Bad ctstate `%s'", arg);
}
exit_error(PARAMETER_PROBLEM, "Bad state `%s'", arg);
arg = comma+1;
}
-
+ if (!*arg)
+ exit_error(PARAMETER_PROBLEM, "`--state' requires a list of "
+ "states with no spaces, e.g. "
+ "ESTABLISHED,RELATED");
if (strlen(arg) == 0 || !state_parse_state(arg, strlen(arg), sinfo))
exit_error(PARAMETER_PROBLEM, "Bad state `%s'", arg);
}