summaryrefslogtreecommitdiffstats
path: root/iptables/xshared.h
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2023-11-14 18:51:59 +0100
committerPhil Sutter <phil@nwl.cc>2023-11-29 02:33:01 +0100
commit20e95a4ec5cec14d9e03ba562fa65f015d49dc14 (patch)
tree1d053079a387a14f2247eff64091c9dadf141a84 /iptables/xshared.h
parent0f5f2f38baf8de62d2ac81247260d7ee316141aa (diff)
xshared: Introduce xt_cmd_parse_ops::option_name
The old opt2char() function was flawed: Since not every field in optflags contains a printable character, typical use of its return value in print statements could lead to garbage on screen. Replace this by a mechanism to retrieve an option's long name which supports family-specific overrides. and get rid of optflags field altogether and define NUMBER_OF_OPT similar to NUMBER_OF_CMD. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables/xshared.h')
-rw-r--r--iptables/xshared.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/iptables/xshared.h b/iptables/xshared.h
index 815b9d3e..2470acbb 100644
--- a/iptables/xshared.h
+++ b/iptables/xshared.h
@@ -50,6 +50,7 @@ enum {
OPT_COMMAND = 1 << 20,
OPT_ZERO = 1 << 21,
};
+#define NUMBER_OF_OPT 23
enum {
CMD_NONE = 0,
@@ -272,6 +273,7 @@ struct xt_cmd_parse_ops {
void (*post_parse)(int command,
struct iptables_command_state *cs,
struct xtables_args *args);
+ const char *(*option_name)(int option);
};
struct xt_cmd_parse {
@@ -287,6 +289,8 @@ struct xt_cmd_parse {
struct xt_cmd_parse_ops *ops;
};
+const char *ip46t_option_name(int option);
+
void do_parse(int argc, char *argv[],
struct xt_cmd_parse *p, struct iptables_command_state *cs,
struct xtables_args *args);