summaryrefslogtreecommitdiffstats
path: root/xtables.c
diff options
context:
space:
mode:
authorJamal Hadi Salim <hadi@cyberus.ca>2009-02-11 13:00:02 +0100
committerPatrick McHardy <kaber@trash.net>2009-02-11 13:00:02 +0100
commit84c3055bf08d0a8fe5db6e5f3f96dd826a290147 (patch)
treec66e311cd6fba61bac93caf3bd787ee3560066cf /xtables.c
parent8e90ce66a99e5dc9b055a9fd14e8e9216f90233c (diff)
libxtables: define xtables_free_opts()
Introduce xtables_free_opts() an xtables variant of free_opts() which uses xtables_globals already set by xtables_set_params(). The end goal is to have all internal references in xtables.c use xtables_free_opts() instead of depending on external defined free_opts() Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca> Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'xtables.c')
-rw-r--r--xtables.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/xtables.c b/xtables.c
index aad5e533..95be5f8e 100644
--- a/xtables.c
+++ b/xtables.c
@@ -68,6 +68,17 @@ int xtables_set_params(struct xtables_globals *xtp)
return 0;
}
+void xtables_free_opts(int reset_offset, struct option *original_opts)
+{
+ if (xt_params->opts != original_opts) {
+ if (original_opts)
+ free(xt_params->opts);
+ xt_params->opts = original_opts;
+ if (reset_offset)
+ xt_params->option_offset = 0;
+ }
+}
+
/**
* xtables_afinfo - protocol family dependent information
* @kmod: kernel module basename (e.g. "ip_tables")