summaryrefslogtreecommitdiffstats
path: root/iptables/xshared.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2022-06-01 19:24:41 +0200
committerPhil Sutter <phil@nwl.cc>2022-06-10 15:35:33 +0200
commit6de62a9d47624155fa67530bc4a8f0ea647189f6 (patch)
tree533dabd86fa1a62c26b417cc9713976b061d6ff8 /iptables/xshared.c
parentef5d0c68261611d72ccecb3ae05c24448fbc91f5 (diff)
xshared: Make some functions static
With all ip(6)tables variants using the same do_parse() function, quite a bunch of functions are not used outside of xshared.c anymore. Make them static. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables/xshared.c')
-rw-r--r--iptables/xshared.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/iptables/xshared.c b/iptables/xshared.c
index 9b5e5b5b..bd4e1022 100644
--- a/iptables/xshared.c
+++ b/iptables/xshared.c
@@ -39,8 +39,8 @@ char *arp_opcodes[] =
* to the commandline, and see expected results. So we call help for all
* specified matches and targets.
*/
-void print_extension_helps(const struct xtables_target *t,
- const struct xtables_rule_match *m)
+static void print_extension_helps(const struct xtables_target *t,
+ const struct xtables_rule_match *m)
{
for (; t != NULL; t = t->next) {
if (t->used) {
@@ -129,8 +129,8 @@ static struct xtables_match *load_proto(struct iptables_command_state *cs)
cs->options & OPT_NUMERIC, &cs->matches);
}
-int command_default(struct iptables_command_state *cs,
- struct xtables_globals *gl, bool invert)
+static int command_default(struct iptables_command_state *cs,
+ struct xtables_globals *gl, bool invert)
{
struct xtables_rule_match *matchp;
struct xtables_match *m;
@@ -789,7 +789,7 @@ void save_iface(char letter, const char *iface,
}
}
-void command_match(struct iptables_command_state *cs, bool invert)
+static void command_match(struct iptables_command_state *cs, bool invert)
{
struct option *opts = xt_params->opts;
struct xtables_match *m;
@@ -827,7 +827,7 @@ void command_match(struct iptables_command_state *cs, bool invert)
xt_params->opts = opts;
}
-const char *xt_parse_target(const char *targetname)
+static const char *xt_parse_target(const char *targetname)
{
const char *ptr;
@@ -889,7 +889,7 @@ void command_jump(struct iptables_command_state *cs, const char *jumpto)
xt_params->opts = opts;
}
-char cmd2char(int option)
+static char cmd2char(int option)
{
/* cmdflags index corresponds with position of bit in CMD_* values */
static const char cmdflags[] = { 'I', 'D', 'D', 'R', 'A', 'L', 'F', 'Z',
@@ -905,8 +905,8 @@ char cmd2char(int option)
return cmdflags[i];
}
-void add_command(unsigned int *cmd, const int newcmd,
- const int othercmds, int invert)
+static void add_command(unsigned int *cmd, const int newcmd,
+ const int othercmds, int invert)
{
if (invert)
xtables_error(PARAMETER_PROBLEM, "unexpected '!' flag");
@@ -917,7 +917,7 @@ void add_command(unsigned int *cmd, const int newcmd,
}
/* Can't be zero. */
-int parse_rulenumber(const char *rule)
+static int parse_rulenumber(const char *rule)
{
unsigned int rulenum;
@@ -928,6 +928,10 @@ int parse_rulenumber(const char *rule)
return rulenum;
}
+#define NUMBER_OF_OPT ARRAY_SIZE(optflags)
+static const char optflags[]
+= { 'n', 's', 'd', 'p', 'j', 'v', 'x', 'i', 'o', '0', 'c', 'f', 2, 3, 'l', 4, 5, 6 };
+
/* 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).
@@ -957,7 +961,7 @@ static const char commands_v_options[NUMBER_OF_CMD][NUMBER_OF_OPT] =
/*CHECK*/ {'x',' ',' ',' ',' ',' ','x',' ',' ','x','x',' ',' ',' ',' ',' ',' ',' '},
};
-void generic_opt_check(int command, int options)
+static void generic_opt_check(int command, int options)
{
int i, j, legal = 0;
@@ -992,7 +996,7 @@ void generic_opt_check(int command, int options)
}
}
-char opt2char(int option)
+static char opt2char(int option)
{
const char *ptr;
@@ -1024,7 +1028,7 @@ static const int inverse_for_options[NUMBER_OF_OPT] =
/* 6 */ IPT_INV_PROTO,
};
-void
+static void
set_option(unsigned int *options, unsigned int option, uint16_t *invflg,
bool invert)
{