summaryrefslogtreecommitdiffstats
path: root/iptables.c
diff options
context:
space:
mode:
Diffstat (limited to 'iptables.c')
-rw-r--r--iptables.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/iptables.c b/iptables.c
index b0638232..b90952dc 100644
--- a/iptables.c
+++ b/iptables.c
@@ -145,6 +145,16 @@ int line = -1;
static struct option *opts = original_opts;
static unsigned int global_option_offset = 0;
+void iptables_exit_error(enum xtables_exittype status, const char *msg, ...) __attribute__((noreturn, format(printf,2,3)));
+
+struct xtables_globals iptables_globals = {
+ .option_offset = 0,
+ .program_version = IPTABLES_VERSION,
+ .program_name = "iptables",
+ .opts = original_opts,
+ .exit_err = iptables_exit_error,
+};
+
/* Table of legal combinations of commands and options. If any of the
* given commands make an option legal, that option is legal (applies to
* CMD_LIST and CMD_ZERO only).
@@ -340,7 +350,7 @@ exit_printhelp(struct xtables_rule_match *matches)
}
void
-exit_error(enum xtables_exittype status, const char *msg, ...)
+iptables_exit_error(enum xtables_exittype status, const char *msg, ...)
{
va_list args;
@@ -1393,6 +1403,7 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle
demand-load a protocol. */
opterr = 0;
+ xtables_set_params(&iptables_globals);
while ((c = getopt_long(argc, argv,
"-A:D:R:I:L::S::M:F::Z::N:X::E:P:Vh::o:p:s:d:j:i:fbvnt:m:xc:g:",
opts, NULL)) != -1) {