path: root/iptables/xshared.h
diff options
authorPhil Sutter <>2018-08-02 17:05:17 +0200
committerFlorian Westphal <>2018-08-04 14:29:21 +0200
commita2ed880a19d0861342b3515721804b18d698bf44 (patch)
tree22fc03a1b1db3e30f594f292b166a86a92de7e19 /iptables/xshared.h
parent1cc09188079a64dc8b733f198c959cfb441e6e20 (diff)
xshared: Consolidate argv construction routines
Implementations were equal in {ip,ip6,x}tables-restore.c. The one in iptables-xml.c differed slightly. For now, collect all features together. Maybe it would make sense to migrate iptables-xml.c to using add_param_to_argv() at some point and therefore extend the latter to store whether a given parameter was quoted or not. While being at it, a few improvements were done: * free_argv() now also resets 'newargc' variable, so users don't have to do that anymore. * Indenting level in add_param_to_argv() was reduced a bit. * That long error message is put into a single line to aid in grepping for it. * Explicit call to exit() after xtables_error() is removed since the latter does not return anyway. Signed-off-by: Phil Sutter <> Signed-off-by: Florian Westphal <>
Diffstat (limited to 'iptables/xshared.h')
1 files changed, 13 insertions, 0 deletions
diff --git a/iptables/xshared.h b/iptables/xshared.h
index 55249341..801d0f75 100644
--- a/iptables/xshared.h
+++ b/iptables/xshared.h
@@ -155,4 +155,17 @@ bool xs_has_arg(int argc, char *argv[]);
extern const struct xtables_afinfo *afinfo;
+extern char *newargv[];
+extern int newargc;
+extern char *oldargv[];
+extern int oldargc;
+extern int newargvattr[];
+int add_argv(const char *what, int quoted);
+void free_argv(void);
+void save_argv(void);
+void add_param_to_argv(char *parsestart, int line);