From 932e648f38ac16b1ea14c1f66f23951388448c5a Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 4 Oct 2007 16:27:30 +0000 Subject: Unique names 2/6 Give symbols of libxt targets unique names (1/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 --- extensions/libxt_MARK.c | 84 ++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 47 deletions(-) (limited to 'extensions/libxt_MARK.c') diff --git a/extensions/libxt_MARK.c b/extensions/libxt_MARK.c index ddfa3236..01872986 100644 --- a/extensions/libxt_MARK.c +++ b/extensions/libxt_MARK.c @@ -9,8 +9,7 @@ #include /* Function which prints out usage message. */ -static void -help(void) +static void MARK_help(void) { printf( "MARK target v%s options:\n" @@ -21,7 +20,7 @@ help(void) IPTABLES_VERSION); } -static const struct option opts[] = { +static const struct option MARK_opts[] = { { "set-mark", 1, NULL, '1' }, { "and-mark", 1, NULL, '2' }, { "or-mark", 1, NULL, '3' }, @@ -31,9 +30,8 @@ static const struct option opts[] = { /* Function which parses command options; returns true if it ate an option */ static int -parse_v0(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_target **target) +MARK_parse_v0(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_target **target) { struct xt_mark_target_info *markinfo = (struct xt_mark_target_info *)(*target)->data; @@ -61,8 +59,7 @@ parse_v0(int c, char **argv, int invert, unsigned int *flags, return 1; } -static void -final_check(unsigned int flags) +static void MARK_check(unsigned int flags) { if (!flags) exit_error(PARAMETER_PROBLEM, @@ -73,9 +70,8 @@ final_check(unsigned int flags) /* Function which parses command options; returns true if it ate an option */ static int -parse_v1(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_target **target) +MARK_parse_v1(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_target **target) { struct xt_mark_target_info_v1 *markinfo = (struct xt_mark_target_info_v1 *)(*target)->data; @@ -112,10 +108,8 @@ print_mark(unsigned long mark) } /* Prints out the targinfo. */ -static void -print_v0(const void *ip, - const struct xt_entry_target *target, - int numeric) +static void MARK_print_v0(const void *ip, + const struct xt_entry_target *target, int numeric) { const struct xt_mark_target_info *markinfo = (const struct xt_mark_target_info *)target->data; @@ -124,8 +118,7 @@ print_v0(const void *ip, } /* Saves the union ipt_targinfo in parsable form to stdout. */ -static void -save_v0(const void *ip, const struct xt_entry_target *target) +static void MARK_save_v0(const void *ip, const struct xt_entry_target *target) { const struct xt_mark_target_info *markinfo = (const struct xt_mark_target_info *)target->data; @@ -135,10 +128,8 @@ save_v0(const void *ip, const struct xt_entry_target *target) } /* Prints out the targinfo. */ -static void -print_v1(const void *ip, - const struct xt_entry_target *target, - int numeric) +static void MARK_print_v1(const void *ip, const struct xt_entry_target *target, + int numeric) { const struct xt_mark_target_info_v1 *markinfo = (const struct xt_mark_target_info_v1 *)target->data; @@ -158,8 +149,7 @@ print_v1(const void *ip, } /* Saves the union ipt_targinfo in parsable form to stdout. */ -static void -save_v1(const void *ip, const struct xt_entry_target *target) +static void MARK_save_v1(const void *ip, const struct xt_entry_target *target) { const struct xt_mark_target_info_v1 *markinfo = (const struct xt_mark_target_info_v1 *)target->data; @@ -178,54 +168,54 @@ save_v1(const void *ip, const struct xt_entry_target *target) print_mark(markinfo->mark); } -static struct xtables_target mark_v0 = { +static struct xtables_target mark_target_v0 = { .family = AF_INET, .name = "MARK", .version = IPTABLES_VERSION, .revision = 0, .size = XT_ALIGN(sizeof(struct xt_mark_target_info)), .userspacesize = XT_ALIGN(sizeof(struct xt_mark_target_info)), - .help = &help, - .parse = &parse_v0, - .final_check = &final_check, - .print = &print_v0, - .save = &save_v0, - .extra_opts = opts, + .help = MARK_help, + .parse = MARK_parse_v0, + .final_check = MARK_check, + .print = MARK_print_v0, + .save = MARK_save_v0, + .extra_opts = MARK_opts, }; -static struct xtables_target mark_v1 = { +static struct xtables_target mark_target_v1 = { .family = AF_INET, .name = "MARK", .version = IPTABLES_VERSION, .revision = 1, .size = XT_ALIGN(sizeof(struct xt_mark_target_info_v1)), .userspacesize = XT_ALIGN(sizeof(struct xt_mark_target_info_v1)), - .help = &help, - .parse = &parse_v1, - .final_check = &final_check, - .print = &print_v1, - .save = &save_v1, - .extra_opts = opts, + .help = MARK_help, + .parse = MARK_parse_v1, + .final_check = MARK_check, + .print = MARK_print_v1, + .save = MARK_save_v1, + .extra_opts = MARK_opts, }; -static struct xtables_target mark6_v0 = { +static struct xtables_target mark_target6_v0 = { .family = AF_INET6, .name = "MARK", .version = IPTABLES_VERSION, .revision = 0, .size = XT_ALIGN(sizeof(struct xt_mark_target_info)), .userspacesize = XT_ALIGN(sizeof(struct xt_mark_target_info)), - .help = &help, - .parse = &parse_v0, - .final_check = &final_check, - .print = &print_v0, - .save = &save_v0, - .extra_opts = opts, + .help = MARK_help, + .parse = MARK_parse_v0, + .final_check = MARK_check, + .print = MARK_print_v0, + .save = MARK_save_v0, + .extra_opts = MARK_opts, }; void _init(void) { - xtables_register_target(&mark_v0); - xtables_register_target(&mark_v1); - xtables_register_target(&mark6_v0); + xtables_register_target(&mark_target_v0); + xtables_register_target(&mark_target_v1); + xtables_register_target(&mark_target6_v0); } -- cgit v1.2.3