diff options
author | Jan Engelhardt <jengelh@medozas.de> | 2007-10-04 16:28:39 +0000 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2007-10-04 16:28:39 +0000 |
commit | 59d164019340d110d302634e429320577f0db7be (patch) | |
tree | 69c2cb242bed3041027b2ac047b1214e13be48ce /extensions | |
parent | 932e648f38ac16b1ea14c1f66f23951388448c5a (diff) |
Unique names 3/6
Give symbols of libxt matches unique names (2/3).
Adds unique prefixes to all functions (most of them - especially the hook
functions) so that debugging programs can unambiguously map a symbol to an
address. Also unifies the names of the xtables_match/xtables_target structs,
(based upon libxt_connmark.c/libip6t_*.c).
Signed-off-by: Jan Engelhardt <jengelh@gmx.de>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/libipt_addrtype.c | 59 | ||||
-rw-r--r-- | extensions/libipt_ah.c | 37 | ||||
-rw-r--r-- | extensions/libipt_condition.c | 44 | ||||
-rw-r--r-- | extensions/libipt_conntrack.c | 40 | ||||
-rw-r--r-- | extensions/libipt_ecn.c | 41 | ||||
-rw-r--r-- | extensions/libipt_icmp.c | 38 | ||||
-rw-r--r-- | extensions/libipt_iprange.c | 39 | ||||
-rw-r--r-- | extensions/libipt_owner.c | 39 | ||||
-rw-r--r-- | extensions/libipt_policy.c | 34 | ||||
-rw-r--r-- | extensions/libipt_realm.c | 39 | ||||
-rw-r--r-- | extensions/libipt_recent.c | 44 | ||||
-rw-r--r-- | extensions/libipt_set.c | 41 | ||||
-rw-r--r-- | extensions/libipt_tos.c | 39 | ||||
-rw-r--r-- | extensions/libipt_ttl.c | 35 | ||||
-rw-r--r-- | extensions/libipt_unclean.c | 18 |
15 files changed, 248 insertions, 339 deletions
diff --git a/extensions/libipt_addrtype.c b/extensions/libipt_addrtype.c index aefc6d6d..b8605c73 100644 --- a/extensions/libipt_addrtype.c +++ b/extensions/libipt_addrtype.c @@ -36,7 +36,7 @@ static void addrtype_help_types(void) printf(" %s\n", rtn_names[i]); } -static void addrtype_help(void) +static void addrtype_help(void) { printf( "Address type match v%s options:\n" @@ -49,7 +49,7 @@ static void addrtype_help(void) } static int -addrtype_parse_type(const char *name, size_t strlen, u_int16_t *mask) +parse_type(const char *name, size_t strlen, u_int16_t *mask) { int i; @@ -63,27 +63,27 @@ addrtype_parse_type(const char *name, size_t strlen, u_int16_t *mask) return 0; } -static void addrtype_parse_types(const char *arg, u_int16_t *mask) +static void parse_types(const char *arg, u_int16_t *mask) { const char *comma; while ((comma = strchr(arg, ',')) != NULL) { - if (comma == arg || !addrtype_parse_type(arg, comma-arg, mask)) + if (comma == arg || !parse_type(arg, comma-arg, mask)) exit_error(PARAMETER_PROBLEM, "addrtype: bad type `%s'", arg); arg = comma + 1; } - if (strlen(arg) == 0 || !addrtype_parse_type(arg, strlen(arg), mask)) + if (strlen(arg) == 0 || !parse_type(arg, strlen(arg), mask)) exit_error(PARAMETER_PROBLEM, "addrtype: bad type `%s'", arg); } #define IPT_ADDRTYPE_OPT_SRCTYPE 0x1 #define IPT_ADDRTYPE_OPT_DSTTYPE 0x2 -static int addrtype_parse(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_match **match) +static int +addrtype_parse(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_match **match) { struct ipt_addrtype_info *info = (struct ipt_addrtype_info *) (*match)->data; @@ -94,7 +94,7 @@ static int addrtype_parse(int c, char **argv, int invert, unsigned int *flags, exit_error(PARAMETER_PROBLEM, "addrtype: can't specify src-type twice"); check_inverse(optarg, &invert, &optind, 0); - addrtype_parse_types(argv[optind-1], &info->source); + parse_types(argv[optind-1], &info->source); if (invert) info->invert_source = 1; *flags |= IPT_ADDRTYPE_OPT_SRCTYPE; @@ -104,7 +104,7 @@ static int addrtype_parse(int c, char **argv, int invert, unsigned int *flags, exit_error(PARAMETER_PROBLEM, "addrtype: can't specify dst-type twice"); check_inverse(optarg, &invert, &optind, 0); - addrtype_parse_types(argv[optind-1], &info->dest); + parse_types(argv[optind-1], &info->dest); if (invert) info->invert_dest = 1; *flags |= IPT_ADDRTYPE_OPT_DSTTYPE; @@ -116,14 +116,14 @@ static int addrtype_parse(int c, char **argv, int invert, unsigned int *flags, return 1; } -static void addrtype_final_check(unsigned int flags) +static void addrtype_check(unsigned int flags) { if (!(flags & (IPT_ADDRTYPE_OPT_SRCTYPE|IPT_ADDRTYPE_OPT_DSTTYPE))) exit_error(PARAMETER_PROBLEM, "addrtype: you must specify --src-type or --dst-type"); } -static void addrtype_print_types(u_int16_t mask) +static void print_types(u_int16_t mask) { const char *sep = ""; int i; @@ -137,9 +137,8 @@ static void addrtype_print_types(u_int16_t mask) printf(" "); } -static void addrtype_print(const void *ip, - const struct xt_entry_match *match, - int numeric) +static void addrtype_print(const void *ip, const struct xt_entry_match *match, + int numeric) { const struct ipt_addrtype_info *info = (struct ipt_addrtype_info *) match->data; @@ -149,18 +148,17 @@ static void addrtype_print(const void *ip, printf("src-type "); if (info->invert_source) printf("!"); - addrtype_print_types(info->source); + print_types(info->source); } if (info->dest) { printf("dst-type "); if (info->invert_dest) printf("!"); - addrtype_print_types(info->dest); + print_types(info->dest); } } -static void addrtype_save(const void *ip, - const struct xt_entry_match *match) +static void addrtype_save(const void *ip, const struct xt_entry_match *match) { const struct ipt_addrtype_info *info = (struct ipt_addrtype_info *) match->data; @@ -169,38 +167,37 @@ static void addrtype_save(const void *ip, printf("--src-type "); if (info->invert_source) printf("! "); - addrtype_print_types(info->source); + print_types(info->source); } if (info->dest) { printf("--dst-type "); if (info->invert_dest) printf("! "); - addrtype_print_types(info->dest); + print_types(info->dest); } } -static const struct option opts[] = { +static const struct option addrtype_opts[] = { { "src-type", 1, NULL, '1' }, { "dst-type", 1, NULL, '2' }, { } }; -static -struct iptables_match addrtype = { +static struct iptables_match addrtype_match = { .name = "addrtype", .version = IPTABLES_VERSION, .size = IPT_ALIGN(sizeof(struct ipt_addrtype_info)), .userspacesize = IPT_ALIGN(sizeof(struct ipt_addrtype_info)), - .help = &addrtype_help, - .parse = &addrtype_parse, - .final_check = &addrtype_final_check, - .print = &addrtype_print, - .save = &addrtype_save, - .extra_opts = opts + .help = addrtype_help, + .parse = addrtype_parse, + .final_check = addrtype_check, + .print = addrtype_print, + .save = addrtype_save, + .extra_opts = addrtype_opts, }; void _init(void) { - register_match(&addrtype); + register_match(&addrtype_match); } diff --git a/extensions/libipt_ah.c b/extensions/libipt_ah.c index 22a13d15..70ba03eb 100644 --- a/extensions/libipt_ah.c +++ b/extensions/libipt_ah.c @@ -9,8 +9,7 @@ #include <linux/netfilter_ipv4/ipt_ah.h> /* Function which prints out usage message. */ -static void -help(void) +static void ah_help(void) { printf( "AH v%s options:\n" @@ -19,7 +18,7 @@ help(void) IPTABLES_VERSION); } -static const struct option opts[] = { +static const struct option ah_opts[] = { { "ahspi", 1, NULL, '1' }, { } }; @@ -67,8 +66,7 @@ parse_ah_spis(const char *spistring, u_int32_t *spis) } /* Initialize the match. */ -static void -init(struct xt_entry_match *m) +static void ah_init(struct xt_entry_match *m) { struct ipt_ah *ahinfo = (struct ipt_ah *)m->data; @@ -79,10 +77,8 @@ init(struct xt_entry_match *m) /* Function which parses command options; returns true if it ate an option */ -static int -parse(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_match **match) +static int ah_parse(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_match **match) { struct ipt_ah *ahinfo = (struct ipt_ah *)(*match)->data; @@ -126,9 +122,8 @@ print_spis(const char *name, u_int32_t min, u_int32_t max, } /* Prints out the union ipt_matchinfo. */ -static void -print(const void *ip, - const struct xt_entry_match *match, int numeric) +static void ah_print(const void *ip, const struct xt_entry_match *match, + int numeric) { const struct ipt_ah *ah = (struct ipt_ah *)match->data; @@ -141,7 +136,7 @@ print(const void *ip, } /* Saves the union ipt_matchinfo in parsable form to stdout. */ -static void save(const void *ip, const struct xt_entry_match *match) +static void ah_save(const void *ip, const struct xt_entry_match *match) { const struct ipt_ah *ahinfo = (struct ipt_ah *)match->data; @@ -161,21 +156,21 @@ static void save(const void *ip, const struct xt_entry_match *match) } -static struct iptables_match ah = { +static struct iptables_match ah_match = { .name = "ah", .version = IPTABLES_VERSION, .size = IPT_ALIGN(sizeof(struct ipt_ah)), .userspacesize = IPT_ALIGN(sizeof(struct ipt_ah)), - .help = &help, - .init = &init, - .parse = &parse, - .print = &print, - .save = &save, - .extra_opts = opts + .help = ah_help, + .init = ah_init, + .parse = ah_parse, + .print = ah_print, + .save = ah_save, + .extra_opts = ah_opts, }; void _init(void) { - register_match(&ah); + register_match(&ah_match); } diff --git a/extensions/libipt_condition.c b/extensions/libipt_condition.c index 8ce9b530..4a98dd8c 100644 --- a/extensions/libipt_condition.c +++ b/extensions/libipt_condition.c @@ -8,9 +8,7 @@ #include<linux/netfilter_ipv4/ip_tables.h> #include<linux/netfilter_ipv4/ipt_condition.h> - -static void -help(void) +static void condition_help(void) { printf("condition match v%s options:\n" "--condition [!] filename " @@ -18,16 +16,13 @@ help(void) IPTABLES_VERSION); } - -static const struct option opts[] = { +static const struct option condition_opts[] = { { .name = "condition", .has_arg = 1, .flag = 0, .val = 'X' }, { .name = 0 } }; -static int -parse(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_match **match) +static int condition_parse(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_match **match) { struct condition_info *info = (struct condition_info *) (*match)->data; @@ -53,19 +48,15 @@ parse(int c, char **argv, int invert, unsigned int *flags, return 0; } - -static void -final_check(unsigned int flags) +static void condition_check(unsigned int flags) { if (!flags) exit_error(PARAMETER_PROBLEM, "Condition match: must specify --condition"); } - -static void -print(const void *ip, - const struct xt_entry_match *match, int numeric) +static void condition_print(const void *ip, const struct xt_entry_match *match, + int numeric) { const struct condition_info *info = (const struct condition_info *) match->data; @@ -74,9 +65,7 @@ print(const void *ip, } -static void -save(const void *ip, - const struct xt_entry_match *match) +static void condition_save(const void *ip, const struct xt_entry_match *match) { const struct condition_info *info = (const struct condition_info *) match->data; @@ -84,23 +73,22 @@ save(const void *ip, printf("--condition %s\"%s\" ", (info->invert) ? "! " : "", info->name); } - -static struct iptables_match condition = { +static struct iptables_match condition_match = { .name = "condition", .version = IPTABLES_VERSION, .size = IPT_ALIGN(sizeof(struct condition_info)), .userspacesize = IPT_ALIGN(sizeof(struct condition_info)), - .help = &help, - .parse = &parse, - .final_check = &final_check, - .print = &print, - .save = &save, - .extra_opts = opts + .help = condition_help, + .parse = condition_parse, + .final_check = condition_check, + .print = condition_print, + .save = condition_save, + .extra_opts = condition_opts, }; void _init(void) { - register_match(&condition); + register_match(&condition_match); } diff --git a/extensions/libipt_conntrack.c b/extensions/libipt_conntrack.c index 6ee8353c..6b3d39b2 100644 --- a/extensions/libipt_conntrack.c +++ b/extensions/libipt_conntrack.c @@ -18,8 +18,7 @@ #endif /* Function which prints out usage message. */ -static void -help(void) +static void conntrack_help(void) { printf( "conntrack match v%s options:\n" @@ -41,9 +40,7 @@ help(void) "\n", IPTABLES_VERSION); } - - -static const struct option opts[] = { +static const struct option conntrack_opts[] = { { "ctstate", 1, NULL, '1' }, { "ctproto", 1, NULL, '2' }, { "ctorigsrc", 1, NULL, '3' }, @@ -165,10 +162,8 @@ parse_expires(const char *s, struct ipt_conntrack_info *sinfo) /* Function which parses command options; returns true if it ate an option */ -static int -parse(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_match **match) +static int conntrack_parse(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_match **match) { struct ipt_conntrack_info *sinfo = (struct ipt_conntrack_info *)(*match)->data; char *protocol = NULL; @@ -316,8 +311,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, return 1; } -static void -final_check(unsigned int flags) +static void conntrack_check(unsigned int flags) { if (!flags) exit_error(PARAMETER_PROBLEM, "You must specify one or more options"); @@ -489,34 +483,32 @@ matchinfo_print(const void *ip, const struct xt_entry_match *match, int numeric, } /* Prints out the matchinfo. */ -static void -print(const void *ip, - const struct xt_entry_match *match, - int numeric) +static void conntrack_print(const void *ip, const struct xt_entry_match *match, + int numeric) { matchinfo_print(ip, match, numeric, ""); } /* Saves the matchinfo in parsable form to stdout. */ -static void save(const void *ip, const struct xt_entry_match *match) +static void conntrack_save(const void *ip, const struct xt_entry_match *match) { matchinfo_print(ip, match, 1, "--"); } -static struct iptables_match conntrack = { +static struct iptables_match conntrack_match = { .name = "conntrack", .version = IPTABLES_VERSION, .size = IPT_ALIGN(sizeof(struct ipt_conntrack_info)), .userspacesize = IPT_ALIGN(sizeof(struct ipt_conntrack_info)), - .help = &help, - .parse = &parse, - .final_check = &final_check, - .print = &print, - .save = &save, - .extra_opts = opts + .help = conntrack_help, + .parse = conntrack_parse, + .final_check = conntrack_check, + .print = conntrack_print, + .save = conntrack_save, + .extra_opts = conntrack_opts, }; void _init(void) { - register_match(&conntrack); + register_match(&conntrack_match); } diff --git a/extensions/libipt_ecn.c b/extensions/libipt_ecn.c index 52bdf66f..d32d3142 100644 --- a/extensions/libipt_ecn.c +++ b/extensions/libipt_ecn.c @@ -16,7 +16,7 @@ #include <linux/netfilter_ipv4/ip_tables.h> #include <linux/netfilter_ipv4/ipt_ecn.h> -static void help(void) +static void ecn_help(void) { printf( "ECN match v%s options\n" @@ -26,17 +26,15 @@ static void help(void) IPTABLES_VERSION); } -static const struct option opts[] = { +static const struct option ecn_opts[] = { { .name = "ecn-tcp-cwr", .has_arg = 0, .val = 'F' }, { .name = "ecn-tcp-ece", .has_arg = 0, .val = 'G' }, { .name = "ecn-ip-ect", .has_arg = 1, .val = 'H' }, { } }; -static int -parse(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_match **match) +static int ecn_parse(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_match **match) { unsigned int result; struct ipt_ecn_info *einfo @@ -86,8 +84,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, return 1; } -static void -final_check(unsigned int flags) +static void ecn_check(unsigned int flags) { if (!flags) exit_error(PARAMETER_PROBLEM, @@ -95,10 +92,8 @@ final_check(unsigned int flags) } /* Prints out the matchinfo. */ -static void -print(const void *ip, - const struct xt_entry_match *match, - int numeric) +static void ecn_print(const void *ip, const struct xt_entry_match *match, + int numeric) { const struct ipt_ecn_info *einfo = (const struct ipt_ecn_info *)match->data; @@ -125,8 +120,7 @@ print(const void *ip, } /* Saves the union ipt_matchinfo in parsable form to stdout. */ -static void -save(const void *ip, const struct xt_entry_match *match) +static void ecn_save(const void *ip, const struct xt_entry_match *match) { const struct ipt_ecn_info *einfo = (const struct ipt_ecn_info *)match->data; @@ -150,21 +144,20 @@ save(const void *ip, const struct xt_entry_match *match) } } -static -struct iptables_match ecn -= { .name = "ecn", +static struct iptables_match ecn_match = { + .name = "ecn", .version = IPTABLES_VERSION, .size = IPT_ALIGN(sizeof(struct ipt_ecn_info)), .userspacesize = IPT_ALIGN(sizeof(struct ipt_ecn_info)), - .help = &help, - .parse = &parse, - .final_check = &final_check, - .print = &print, - .save = &save, - .extra_opts = opts + .help = ecn_help, + .parse = ecn_parse, + .final_check = ecn_check, + .print = ecn_print, + .save = ecn_save, + .extra_opts = ecn_opts, }; void _init(void) { - register_match(&ecn); + register_match(&ecn_match); } diff --git a/extensions/libipt_icmp.c b/extensions/libipt_icmp.c index 0c1fbe74..fa766014 100644 --- a/extensions/libipt_icmp.c +++ b/extensions/libipt_icmp.c @@ -98,8 +98,7 @@ print_icmptypes(void) } /* Function which prints out usage message. */ -static void -help(void) +static void icmp_help(void) { printf( "ICMP v%s options:\n" @@ -109,7 +108,7 @@ help(void) print_icmptypes(); } -static const struct option opts[] = { +static const struct option icmp_opts[] = { { "icmp-type", 1, NULL, '1' }, { } }; @@ -168,8 +167,7 @@ parse_icmp(const char *icmptype, u_int8_t *type, u_int8_t code[]) } /* Initialize the match. */ -static void -init(struct xt_entry_match *m) +static void icmp_init(struct xt_entry_match *m) { struct ipt_icmp *icmpinfo = (struct ipt_icmp *)m->data; @@ -179,10 +177,8 @@ init(struct xt_entry_match *m) /* Function which parses command options; returns true if it ate an option */ -static int -parse(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_match **match) +static int icmp_parse(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_match **match) { struct ipt_icmp *icmpinfo = (struct ipt_icmp *)(*match)->data; @@ -244,10 +240,8 @@ static void print_icmptype(u_int8_t type, } /* Prints out the union ipt_matchinfo. */ -static void -print(const void *ip, - const struct xt_entry_match *match, - int numeric) +static void icmp_print(const void *ip, const struct xt_entry_match *match, + int numeric) { const struct ipt_icmp *icmp = (struct ipt_icmp *)match->data; @@ -262,7 +256,7 @@ print(const void *ip, } /* Saves the match in parsable form to stdout. */ -static void save(const void *ip, const struct xt_entry_match *match) +static void icmp_save(const void *ip, const struct xt_entry_match *match) { const struct ipt_icmp *icmp = (struct ipt_icmp *)match->data; @@ -280,20 +274,20 @@ static void save(const void *ip, const struct xt_entry_match *match) } } -static struct iptables_match icmp = { +static struct iptables_match icmp_match = { .name = "icmp", .version = IPTABLES_VERSION, .size = IPT_ALIGN(sizeof(struct ipt_icmp)), .userspacesize = IPT_ALIGN(sizeof(struct ipt_icmp)), - .help = &help, - .init = &init, - .parse = &parse, - .print = &print, - .save = &save, - .extra_opts = opts + .help = icmp_help, + .init = icmp_init, + .parse = icmp_parse, + .print = icmp_print, + .save = icmp_save, + .extra_opts = icmp_opts, }; void _init(void) { - register_match(&icmp); + register_match(&icmp_match); } diff --git a/extensions/libipt_iprange.c b/extensions/libipt_iprange.c index 46e78259..05d6db95 100644 --- a/extensions/libipt_iprange.c +++ b/extensions/libipt_iprange.c @@ -9,8 +9,7 @@ #include <linux/netfilter_ipv4/ipt_iprange.h> /* Function which prints out usage message. */ -static void -help(void) +static void iprange_help(void) { printf( "iprange match v%s options:\n" @@ -20,7 +19,7 @@ help(void) IPTABLES_VERSION); } -static const struct option opts[] = { +static const struct option iprange_opts[] = { { "src-range", 1, NULL, '1' }, { "dst-range", 1, NULL, '2' }, { } @@ -54,10 +53,8 @@ parse_iprange(char *arg, struct ipt_iprange *range) /* Function which parses command options; returns true if it ate an option */ -static int -parse(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_match **match) +static int iprange_parse(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_match **match) { struct ipt_iprange_info *info = (struct ipt_iprange_info *)(*match)->data; @@ -99,8 +96,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, } /* Final check; must have specified --src-range or --dst-range. */ -static void -final_check(unsigned int flags) +static void iprange_check(unsigned int flags) { if (!flags) exit_error(PARAMETER_PROBLEM, @@ -120,10 +116,8 @@ print_iprange(const struct ipt_iprange *range) } /* Prints out the info. */ -static void -print(const void *ip, - const struct xt_entry_match *match, - int numeric) +static void iprange_print(const void *ip, const struct xt_entry_match *match, + int numeric) { struct ipt_iprange_info *info = (struct ipt_iprange_info *)match->data; @@ -142,8 +136,7 @@ print(const void *ip, } /* Saves the union ipt_info in parsable form to stdout. */ -static void -save(const void *ip, const struct xt_entry_match *match) +static void iprange_save(const void *ip, const struct xt_entry_match *match) { struct ipt_iprange_info *info = (struct ipt_iprange_info *)match->data; @@ -163,20 +156,20 @@ save(const void *ip, const struct xt_entry_match *match) } } -static struct iptables_match iprange = { +static struct iptables_match iprange_match = { .name = "iprange", .version = IPTABLES_VERSION, .size = IPT_ALIGN(sizeof(struct ipt_iprange_info)), .userspacesize = IPT_ALIGN(sizeof(struct ipt_iprange_info)), - .help = &help, - .parse = &parse, - .final_check = &final_check, - .print = &print, - .save = &save, - .extra_opts = opts + .help = iprange_help, + .parse = iprange_parse, + .final_check = iprange_check, + .print = iprange_print, + .save = iprange_save, + .extra_opts = iprange_opts, }; void _init(void) { - register_match(&iprange); + register_match(&iprange_match); } diff --git a/extensions/libipt_owner.c b/extensions/libipt_owner.c index e11bfb1b..910e011f 100644 --- a/extensions/libipt_owner.c +++ b/extensions/libipt_owner.c @@ -11,8 +11,7 @@ #include <linux/netfilter_ipv4/ipt_owner.h> /* Function which prints out usage message. */ -static void -help(void) +static void owner_help(void) { #ifdef IPT_OWNER_COMM printf( @@ -38,7 +37,7 @@ IPTABLES_VERSION); #endif /* IPT_OWNER_COMM */ } -static const struct option opts[] = { +static const struct option owner_opts[] = { { "uid-owner", 1, NULL, '1' }, { "gid-owner", 1, NULL, '2' }, { "pid-owner", 1, NULL, '3' }, @@ -51,10 +50,8 @@ static const struct option opts[] = { /* Function which parses command options; returns true if it ate an option */ -static int -parse(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_match **match) +static int owner_parse(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_match **match) { struct ipt_owner_info *ownerinfo = (struct ipt_owner_info *)(*match)->data; @@ -189,8 +186,7 @@ print_item(struct ipt_owner_info *info, u_int8_t flag, int numeric, char *label) } /* Final check; must have specified --own. */ -static void -final_check(unsigned int flags) +static void owner_check(unsigned int flags) { if (!flags) exit_error(PARAMETER_PROBLEM, @@ -198,10 +194,8 @@ final_check(unsigned int flags) } /* Prints out the matchinfo. */ -static void -print(const void *ip, - const struct xt_entry_match *match, - int numeric) +static void owner_print(const void *ip, const struct xt_entry_match *match, + int numeric) { struct ipt_owner_info *info = (struct ipt_owner_info *)match->data; @@ -215,8 +209,7 @@ print(const void *ip, } /* Saves the union ipt_matchinfo in parsable form to stdout. */ -static void -save(const void *ip, const struct xt_entry_match *match) +static void owner_save(const void *ip, const struct xt_entry_match *match) { struct ipt_owner_info *info = (struct ipt_owner_info *)match->data; @@ -229,20 +222,20 @@ save(const void *ip, const struct xt_entry_match *match) #endif } -static struct iptables_match owner = { +static struct iptables_match owner_match = { .name = "owner", .version = IPTABLES_VERSION, .size = IPT_ALIGN(sizeof(struct ipt_owner_info)), .userspacesize = IPT_ALIGN(sizeof(struct ipt_owner_info)), - .help = &help, - .parse = &parse, - .final_check = &final_check, - .print = &print, - .save = &save, - .extra_opts = opts + .help = owner_help, + .parse = owner_parse, + .final_check = owner_check, + .print = owner_print, + .save = owner_save, + .extra_opts = owner_opts, }; void _init(void) { - register_match(&owner); + register_match(&owner_match); } diff --git a/extensions/libipt_policy.c b/extensions/libipt_policy.c index 0e27975f..16797bfb 100644 --- a/extensions/libipt_policy.c +++ b/extensions/libipt_policy.c @@ -21,7 +21,7 @@ */ static struct ipt_policy_info *policy_info; -static void help(void) +static void policy_help(void) { printf( "policy v%s options:\n" @@ -40,7 +40,7 @@ static void help(void) IPTABLES_VERSION); } -static const struct option opts[] = +static const struct option policy_opts[] = { { .name = "dir", @@ -120,9 +120,8 @@ static int parse_mode(char *s) exit_error(PARAMETER_PROBLEM, "policy match: invalid mode `%s'", s); } -static int parse(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_match **match) +static int policy_parse(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_match **match) { struct ipt_policy_info *info = (void *)(*match)->data; struct ipt_policy_elem *e = &info->pol[info->len]; @@ -249,7 +248,7 @@ static int parse(int c, char **argv, int invert, unsigned int *flags, return 1; } -static void final_check(unsigned int flags) +static void policy_check(unsigned int flags) { struct ipt_policy_info *info = policy_info; struct ipt_policy_elem *e; @@ -381,9 +380,8 @@ static void print_flags(char *prefix, const struct ipt_policy_info *info) printf("%sstrict ", prefix); } -static void print(const void *ip, - const struct xt_entry_match *match, - int numeric) +static void policy_print(const void *ip, const struct xt_entry_match *match, + int numeric) { const struct ipt_policy_info *info = (void *)match->data; unsigned int i; @@ -397,7 +395,7 @@ static void print(const void *ip, } } -static void save(const void *ip, const struct xt_entry_match *match) +static void policy_save(const void *ip, const struct xt_entry_match *match) { const struct ipt_policy_info *info = (void *)match->data; unsigned int i; @@ -410,20 +408,20 @@ static void save(const void *ip, const struct xt_entry_match *match) } } -static struct iptables_match policy = { +static struct iptables_match policy_match = { .name = "policy", .version = IPTABLES_VERSION, .size = IPT_ALIGN(sizeof(struct ipt_policy_info)), .userspacesize = IPT_ALIGN(sizeof(struct ipt_policy_info)), - .help = help, - .parse = parse, - .final_check = final_check, - .print = print, - .save = save, - .extra_opts = opts + .help = policy_help, + .parse = policy_parse, + .final_check = policy_check, + .print = policy_print, + .save = policy_save, + .extra_opts = policy_opts, }; void _init(void) { - register_match(&policy); + register_match(&policy_match); } diff --git a/extensions/libipt_realm.c b/extensions/libipt_realm.c index 2bd04c34..4f3416f0 100644 --- a/extensions/libipt_realm.c +++ b/extensions/libipt_realm.c @@ -15,8 +15,7 @@ #include <linux/netfilter_ipv4/ipt_realm.h> /* Function which prints out usage message. */ -static void -help(void) +static void realm_help(void) { printf( "realm v%s options:\n" @@ -25,7 +24,7 @@ help(void) "\n", IPTABLES_VERSION); } -static const struct option opts[] = { +static const struct option realm_opts[] = { { "realm", 1, NULL, '1' }, { } }; @@ -154,10 +153,8 @@ static const char *realm_id2name(int id) /* Function which parses command options; returns true if it ate an option */ -static int -parse(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_match **match) +static int realm_parse(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_match **match) { struct ipt_realm_info *realminfo = (struct ipt_realm_info *)(*match)->data; int id; @@ -213,10 +210,8 @@ print_realm(unsigned long id, unsigned long mask, int numeric) } /* Prints out the matchinfo. */ -static void -print(const void *ip, - const struct xt_entry_match *match, - int numeric) +static void realm_print(const void *ip, const struct xt_entry_match *match, + int numeric) { struct ipt_realm_info *ri = (struct ipt_realm_info *) match->data; @@ -229,8 +224,7 @@ print(const void *ip, /* Saves the union ipt_matchinfo in parsable form to stdout. */ -static void -save(const void *ip, const struct xt_entry_match *match) +static void realm_save(const void *ip, const struct xt_entry_match *match) { struct ipt_realm_info *ri = (struct ipt_realm_info *) match->data; @@ -242,30 +236,29 @@ save(const void *ip, const struct xt_entry_match *match) } /* Final check; must have specified --mark. */ -static void -final_check(unsigned int flags) +static void realm_check(unsigned int flags) { if (!flags) exit_error(PARAMETER_PROBLEM, "realm match: You must specify `--realm'"); } -static struct iptables_match realm = { +static struct iptables_match realm_match = { .name = "realm", .version = IPTABLES_VERSION, .size = IPT_ALIGN(sizeof(struct ipt_realm_info)), .userspacesize = IPT_ALIGN(sizeof(struct ipt_realm_info)), - .help = &help, - .parse = &parse, - .final_check = &final_check, - .print = &print, - .save = &save, - .extra_opts = opts + .help = realm_help, + .parse = realm_parse, + .final_check = realm_check, + .print = realm_print, + .save = realm_save, + .extra_opts = realm_opts, }; void _init(void) { - register_match(&realm); + register_match(&realm_match); } diff --git a/extensions/libipt_recent.c b/extensions/libipt_recent.c index 002fecb1..76f9771e 100644 --- a/extensions/libipt_recent.c +++ b/extensions/libipt_recent.c @@ -22,7 +22,7 @@ #endif /* IPT_RECENT_NAME_LEN */ /* Options for this module */ -static const struct option opts[] = { +static const struct option recent_opts[] = { { .name = "set", .has_arg = 0, .val = 201 }, { .name = "rcheck", .has_arg = 0, .val = 202 }, { .name = "update", .has_arg = 0, .val = 203 }, @@ -37,8 +37,7 @@ static const struct option opts[] = { }; /* Function which prints out usage message. */ -static void -help(void) +static void recent_help(void) { printf( "recent v%s options:\n" @@ -67,8 +66,7 @@ IPTABLES_VERSION); } /* Initialize the match. */ -static void -init(struct xt_entry_match *match) +static void recent_init(struct xt_entry_match *match) { struct ipt_recent_info *info = (struct ipt_recent_info *)(match)->data; @@ -82,10 +80,8 @@ init(struct xt_entry_match *match) /* Function which parses command options; returns true if it ate an option */ -static int -parse(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_match **match) +static int recent_parse(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_match **match) { struct ipt_recent_info *info = (struct ipt_recent_info *)(*match)->data; switch (c) { @@ -162,8 +158,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, } /* Final check; must have specified a specific option. */ -static void -final_check(unsigned int flags) +static void recent_check(unsigned int flags) { if (!flags) @@ -173,10 +168,8 @@ final_check(unsigned int flags) } /* Prints out the matchinfo. */ -static void -print(const void *ip, - const struct xt_entry_match *match, - int numeric) +static void recent_print(const void *ip, const struct xt_entry_match *match, + int numeric) { struct ipt_recent_info *info = (struct ipt_recent_info *)match->data; @@ -197,8 +190,7 @@ print(const void *ip, } /* Saves the union ipt_matchinfo in parsable form to stdout. */ -static void -save(const void *ip, const struct xt_entry_match *match) +static void recent_save(const void *ip, const struct xt_entry_match *match) { struct ipt_recent_info *info = (struct ipt_recent_info *)match->data; @@ -218,21 +210,21 @@ save(const void *ip, const struct xt_entry_match *match) } /* Structure for iptables to use to communicate with module */ -static struct iptables_match recent = { +static struct iptables_match recent_match = { .name = "recent", .version = IPTABLES_VERSION, .size = IPT_ALIGN(sizeof(struct ipt_recent_info)), .userspacesize = IPT_ALIGN(sizeof(struct ipt_recent_info)), - .help = &help, - .init = &init, - .parse = &parse, - .final_check = &final_check, - .print = &print, - .save = &save, - .extra_opts = opts + .help = recent_help, + .init = recent_init, + .parse = recent_parse, + .final_check = recent_check, + .print = recent_print, + .save = recent_save, + .extra_opts = recent_opts, }; void _init(void) { - register_match(&recent); + register_match(&recent_match); } diff --git a/extensions/libipt_set.c b/extensions/libipt_set.c index e2804b0a..932008bb 100644 --- a/extensions/libipt_set.c +++ b/extensions/libipt_set.c @@ -22,7 +22,7 @@ #include "libipt_set.h" /* Function which prints out usage message. */ -static void help(void) +static void set_help(void) { printf("set v%s options:\n" " [!] --set name flags\n" @@ -32,13 +32,13 @@ static void help(void) "\n", IPTABLES_VERSION); } -static const struct option opts[] = { +static const struct option set_opts[] = { {"set", 1, 0, '1'}, {0} }; /* Initialize the match. */ -static void init(struct xt_entry_match *match) +static void set_init(struct xt_entry_match *match) { struct ipt_set_info_match *info = (struct ipt_set_info_match *) match->data; @@ -49,10 +49,8 @@ static void init(struct xt_entry_match *match) } /* Function which parses command options; returns true if it ate an option */ -static int -parse(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_match **match) +static int set_parse(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_match **match) { struct ipt_set_info_match *myinfo = (struct ipt_set_info_match *) (*match)->data; @@ -95,7 +93,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, } /* Final check; must have specified --set. */ -static void final_check(unsigned int flags) +static void set_check(unsigned int flags) { if (!flags) exit_error(PARAMETER_PROBLEM, @@ -125,9 +123,8 @@ print_match(const char *prefix, const struct ipt_set_info *info) } /* Prints out the matchinfo. */ -static void -print(const void *ip, - const struct xt_entry_match *match, int numeric) +static void set_print(const void *ip, const struct xt_entry_match *match, + int numeric) { struct ipt_set_info_match *info = (struct ipt_set_info_match *) match->data; @@ -136,8 +133,7 @@ print(const void *ip, } /* Saves the matchinfo in parsable form to stdout. */ -static void save(const void *ip, - const struct xt_entry_match *match) +static void set_save(const void *ip, const struct xt_entry_match *match) { struct ipt_set_info_match *info = (struct ipt_set_info_match *) match->data; @@ -145,22 +141,21 @@ static void save(const void *ip, print_match("--set", &info->match_set); } -static -struct iptables_match set = { +static struct iptables_match set_match = { .name = "set", .version = IPTABLES_VERSION, .size = IPT_ALIGN(sizeof(struct ipt_set_info_match)), .userspacesize = IPT_ALIGN(sizeof(struct ipt_set_info_match)), - .help = &help, - .init = &init, - .parse = &parse, - .final_check = &final_check, - .print = &print, - .save = &save, - .extra_opts = opts + .help = set_help, + .init = set_init, + .parse = set_parse, + .final_check = set_check, + .print = set_print, + .save = set_save, + .extra_opts = set_opts, }; void _init(void) { - register_match(&set); + register_match(&set_match); } diff --git a/extensions/libipt_tos.c b/extensions/libipt_tos.c index ebdd0c1c..11c304f1 100644 --- a/extensions/libipt_tos.c +++ b/extensions/libipt_tos.c @@ -23,8 +23,7 @@ struct TOS_value }; /* Function which prints out usage message. */ -static void -help(void) +static void tos_help(void) { unsigned int i; @@ -42,7 +41,7 @@ IPTABLES_VERSION); fputc('\n', stdout); } -static const struct option opts[] = { +static const struct option tos_opts[] = { { "tos", 1, NULL, '1' }, { } }; @@ -74,10 +73,8 @@ parse_tos(const char *s, struct ipt_tos_info *info) /* Function which parses command options; returns true if it ate an option */ -static int -parse(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_match **match) +static int tos_parse(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_match **match) { struct ipt_tos_info *tosinfo = (struct ipt_tos_info *)(*match)->data; @@ -117,8 +114,7 @@ print_tos(u_int8_t tos, int numeric) } /* Final check; must have specified --tos. */ -static void -final_check(unsigned int flags) +static void tos_check(unsigned int flags) { if (!flags) exit_error(PARAMETER_PROBLEM, @@ -126,10 +122,8 @@ final_check(unsigned int flags) } /* Prints out the matchinfo. */ -static void -print(const void *ip, - const struct xt_entry_match *match, - int numeric) +static void tos_print(const void *ip, const struct xt_entry_match *match, + int numeric) { const struct ipt_tos_info *info = (const struct ipt_tos_info *)match->data; @@ -140,8 +134,7 @@ print(const void *ip, } /* Saves the union ipt_matchinfo in parsable form to stdout. */ -static void -save(const void *ip, const struct xt_entry_match *match) +static void tos_save(const void *ip, const struct xt_entry_match *match) { const struct ipt_tos_info *info = (const struct ipt_tos_info *)match->data; @@ -151,20 +144,20 @@ save(const void *ip, const struct xt_entry_match *match) print_tos(info->tos, 0); } -static struct iptables_match tos = { +static struct iptables_match tos_match = { .name = "tos", .version = IPTABLES_VERSION, .size = IPT_ALIGN(sizeof(struct ipt_tos_info)), .userspacesize = IPT_ALIGN(sizeof(struct ipt_tos_info)), - .help = &help, - .parse = &parse, - .final_check = &final_check, - .print = &print, - .save = &save, - .extra_opts = opts + .help = tos_help, + .parse = tos_parse, + .final_check = tos_check, + .print = tos_print, + .save = tos_save, + .extra_opts = tos_opts, }; void _init(void) { - register_match(&tos); + register_match(&tos_match); } diff --git a/extensions/libipt_ttl.c b/extensions/libipt_ttl.c index b6edbc1a..622e60af 100644 --- a/extensions/libipt_ttl.c +++ b/extensions/libipt_ttl.c @@ -14,7 +14,7 @@ #include <linux/netfilter_ipv4/ip_tables.h> #include <linux/netfilter_ipv4/ipt_ttl.h> -static void help(void) +static void ttl_help(void) { printf( "TTL match v%s options:\n" @@ -24,9 +24,8 @@ static void help(void) , IPTABLES_VERSION); } -static int parse(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_match **match) +static int ttl_parse(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_match **match) { struct ipt_ttl_info *info = (struct ipt_ttl_info *) (*match)->data; unsigned int value; @@ -84,7 +83,7 @@ static int parse(int c, char **argv, int invert, unsigned int *flags, return 1; } -static void final_check(unsigned int flags) +static void ttl_check(unsigned int flags) { if (!flags) exit_error(PARAMETER_PROBLEM, @@ -92,9 +91,8 @@ static void final_check(unsigned int flags) "`--ttl-eq', `--ttl-lt', `--ttl-gt"); } -static void print(const void *ip, - const struct xt_entry_match *match, - int numeric) +static void ttl_print(const void *ip, const struct xt_entry_match *match, + int numeric) { const struct ipt_ttl_info *info = (struct ipt_ttl_info *) match->data; @@ -117,8 +115,7 @@ static void print(const void *ip, printf("%u ", info->ttl); } -static void save(const void *ip, - const struct xt_entry_match *match) +static void ttl_save(const void *ip, const struct xt_entry_match *match) { const struct ipt_ttl_info *info = (struct ipt_ttl_info *) match->data; @@ -143,7 +140,7 @@ static void save(const void *ip, printf("%u ", info->ttl); } -static const struct option opts[] = { +static const struct option ttl_opts[] = { { "ttl", 1, NULL, '2' }, { "ttl-eq", 1, NULL, '2'}, { "ttl-lt", 1, NULL, '3'}, @@ -151,21 +148,21 @@ static const struct option opts[] = { { } }; -static struct iptables_match ttl = { +static struct iptables_match ttl_match = { .name = "ttl", .version = IPTABLES_VERSION, .size = IPT_ALIGN(sizeof(struct ipt_ttl_info)), .userspacesize = IPT_ALIGN(sizeof(struct ipt_ttl_info)), - .help = &help, - .parse = &parse, - .final_check = &final_check, - .print = &print, - .save = &save, - .extra_opts = opts + .help = ttl_help, + .parse = ttl_parse, + .final_check = ttl_check, + .print = ttl_print, + .save = ttl_save, + .extra_opts = ttl_opts, }; void _init(void) { - register_match(&ttl); + register_match(&ttl_match); } diff --git a/extensions/libipt_unclean.c b/extensions/libipt_unclean.c index 6b5bcbfc..648d0980 100644 --- a/extensions/libipt_unclean.c +++ b/extensions/libipt_unclean.c @@ -5,8 +5,7 @@ #include <iptables.h> /* Function which prints out usage message. */ -static void -help(void) +static void unclean_help(void) { printf( "unclean v%s takes no options\n" @@ -15,25 +14,22 @@ help(void) /* Function which parses command options; returns true if it ate an option */ -static int -parse(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_match **match) +static int unclean_parse(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_match **match) { return 0; } -static -struct iptables_match unclean = { +static struct iptables_match unclean_match = { .name = "unclean", .version = IPTABLES_VERSION, .size = IPT_ALIGN(0), .userspacesize = IPT_ALIGN(0), - .help = &help, - .parse = &parse, + .help = unclean_help, + .parse = unclean_parse, }; void _init(void) { - register_match(&unclean); + register_match(&unclean_match); } |