diff options
-rw-r--r-- | include/xtables.h.in | 1 | ||||
-rw-r--r-- | xtables.c | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/include/xtables.h.in b/include/xtables.h.in index 61dbc767..1d333942 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -204,6 +204,7 @@ extern void *xtables_malloc(size_t); extern int xtables_insmod(const char *, const char *, bool); extern int xtables_load_ko(const char *, bool); int xtables_set_params(struct xtables_globals *xtp); +void xtables_free_opts(int reset_offset, struct option *original_opts); extern struct xtables_match *xtables_find_match(const char *name, enum xtables_tryload, struct xtables_rule_match **match); @@ -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") |