From bc1c37618a9e106b2b66f21f87454af6ac5852aa Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Wed, 2 Nov 2011 00:26:23 +0100 Subject: [PATCH] src: use xtables_register_targets throughout --- extensions/libxt_RAWDNAT.c | 61 +++++++++++++++++++------------------- extensions/libxt_RAWSNAT.c | 61 +++++++++++++++++++------------------- extensions/libxt_TEE.c | 61 +++++++++++++++++++------------------- 3 files changed, 93 insertions(+), 90 deletions(-) diff --git a/extensions/libxt_RAWDNAT.c b/extensions/libxt_RAWDNAT.c index e77060f..243eef3 100644 --- a/extensions/libxt_RAWDNAT.c +++ b/extensions/libxt_RAWDNAT.c @@ -151,38 +151,39 @@ rawdnat_tg6_save(const void *entry, const struct xt_entry_target *target) info->mask); } -static struct xtables_target rawdnat_tg4_reg = { - .version = XTABLES_VERSION, - .name = "RAWDNAT", - .revision = 0, - .family = NFPROTO_IPV4, - .size = XT_ALIGN(sizeof(struct xt_rawnat_tginfo)), - .userspacesize = XT_ALIGN(sizeof(struct xt_rawnat_tginfo)), - .help = rawdnat_tg_help, - .parse = rawdnat_tg4_parse, - .final_check = rawdnat_tg_check, - .print = rawdnat_tg4_print, - .save = rawdnat_tg4_save, - .extra_opts = rawdnat_tg_opts, -}; - -static struct xtables_target rawdnat_tg6_reg = { - .version = XTABLES_VERSION, - .name = "RAWDNAT", - .revision = 0, - .family = NFPROTO_IPV6, - .size = XT_ALIGN(sizeof(struct xt_rawnat_tginfo)), - .userspacesize = XT_ALIGN(sizeof(struct xt_rawnat_tginfo)), - .help = rawdnat_tg_help, - .parse = rawdnat_tg6_parse, - .final_check = rawdnat_tg_check, - .print = rawdnat_tg6_print, - .save = rawdnat_tg6_save, - .extra_opts = rawdnat_tg_opts, +static struct xtables_target rawdnat_tg_reg[] = { + { + .version = XTABLES_VERSION, + .name = "RAWDNAT", + .revision = 0, + .family = NFPROTO_IPV4, + .size = XT_ALIGN(sizeof(struct xt_rawnat_tginfo)), + .userspacesize = XT_ALIGN(sizeof(struct xt_rawnat_tginfo)), + .help = rawdnat_tg_help, + .parse = rawdnat_tg4_parse, + .final_check = rawdnat_tg_check, + .print = rawdnat_tg4_print, + .save = rawdnat_tg4_save, + .extra_opts = rawdnat_tg_opts, + }, + { + .version = XTABLES_VERSION, + .name = "RAWDNAT", + .revision = 0, + .family = NFPROTO_IPV6, + .size = XT_ALIGN(sizeof(struct xt_rawnat_tginfo)), + .userspacesize = XT_ALIGN(sizeof(struct xt_rawnat_tginfo)), + .help = rawdnat_tg_help, + .parse = rawdnat_tg6_parse, + .final_check = rawdnat_tg_check, + .print = rawdnat_tg6_print, + .save = rawdnat_tg6_save, + .extra_opts = rawdnat_tg_opts, + }, }; static void _init(void) { - xtables_register_target(&rawdnat_tg4_reg); - xtables_register_target(&rawdnat_tg6_reg); + xtables_register_targets(rawdnat_tg_reg, + sizeof(rawdnat_tg_reg) / sizeof(*rawdnat_tg_reg)); } diff --git a/extensions/libxt_RAWSNAT.c b/extensions/libxt_RAWSNAT.c index 1c1c35d..efcd9f0 100644 --- a/extensions/libxt_RAWSNAT.c +++ b/extensions/libxt_RAWSNAT.c @@ -151,38 +151,39 @@ rawsnat_tg6_save(const void *entry, const struct xt_entry_target *target) info->mask); } -static struct xtables_target rawsnat_tg4_reg = { - .version = XTABLES_VERSION, - .name = "RAWSNAT", - .revision = 0, - .family = NFPROTO_IPV4, - .size = XT_ALIGN(sizeof(struct xt_rawnat_tginfo)), - .userspacesize = XT_ALIGN(sizeof(struct xt_rawnat_tginfo)), - .help = rawsnat_tg_help, - .parse = rawsnat_tg4_parse, - .final_check = rawsnat_tg_check, - .print = rawsnat_tg4_print, - .save = rawsnat_tg4_save, - .extra_opts = rawsnat_tg_opts, -}; - -static struct xtables_target rawsnat_tg6_reg = { - .version = XTABLES_VERSION, - .name = "RAWSNAT", - .revision = 0, - .family = NFPROTO_IPV6, - .size = XT_ALIGN(sizeof(struct xt_rawnat_tginfo)), - .userspacesize = XT_ALIGN(sizeof(struct xt_rawnat_tginfo)), - .help = rawsnat_tg_help, - .parse = rawsnat_tg6_parse, - .final_check = rawsnat_tg_check, - .print = rawsnat_tg6_print, - .save = rawsnat_tg6_save, - .extra_opts = rawsnat_tg_opts, +static struct xtables_target rawsnat_tg_reg[] = { + { + .version = XTABLES_VERSION, + .name = "RAWSNAT", + .revision = 0, + .family = NFPROTO_IPV4, + .size = XT_ALIGN(sizeof(struct xt_rawnat_tginfo)), + .userspacesize = XT_ALIGN(sizeof(struct xt_rawnat_tginfo)), + .help = rawsnat_tg_help, + .parse = rawsnat_tg4_parse, + .final_check = rawsnat_tg_check, + .print = rawsnat_tg4_print, + .save = rawsnat_tg4_save, + .extra_opts = rawsnat_tg_opts, + }, + { + .version = XTABLES_VERSION, + .name = "RAWSNAT", + .revision = 0, + .family = NFPROTO_IPV6, + .size = XT_ALIGN(sizeof(struct xt_rawnat_tginfo)), + .userspacesize = XT_ALIGN(sizeof(struct xt_rawnat_tginfo)), + .help = rawsnat_tg_help, + .parse = rawsnat_tg6_parse, + .final_check = rawsnat_tg_check, + .print = rawsnat_tg6_print, + .save = rawsnat_tg6_save, + .extra_opts = rawsnat_tg_opts, + }, }; static void _init(void) { - xtables_register_target(&rawsnat_tg4_reg); - xtables_register_target(&rawsnat_tg6_reg); + xtables_register_targets(rawsnat_tg_reg, + sizeof(rawsnat_tg_reg) / sizeof(*rawsnat_tg_reg)); } diff --git a/extensions/libxt_TEE.c b/extensions/libxt_TEE.c index 64c6b41..06f823b 100644 --- a/extensions/libxt_TEE.c +++ b/extensions/libxt_TEE.c @@ -135,38 +135,39 @@ static void tee_tg6_save(const void *ip, const struct xt_entry_target *target) printf(" --gateway %s ", xtables_ip6addr_to_numeric(&info->gw.in6)); } -static struct xtables_target tee_tg_reg = { - .name = "TEE", - .version = XTABLES_VERSION, - .revision = 0, - .family = NFPROTO_IPV4, - .size = XT_ALIGN(sizeof(struct xt_tee_tginfo)), - .userspacesize = XT_ALIGN(sizeof(struct xt_tee_tginfo)), - .help = tee_tg_help, - .parse = tee_tg_parse, - .final_check = tee_tg_check, - .print = tee_tg_print, - .save = tee_tg_save, - .extra_opts = tee_tg_opts, -}; - -static struct xtables_target tee_tg6_reg = { - .name = "TEE", - .version = XTABLES_VERSION, - .revision = 0, - .family = NFPROTO_IPV6, - .size = XT_ALIGN(sizeof(struct xt_tee_tginfo)), - .userspacesize = XT_ALIGN(sizeof(struct xt_tee_tginfo)), - .help = tee_tg_help, - .parse = tee_tg6_parse, - .final_check = tee_tg_check, - .print = tee_tg6_print, - .save = tee_tg6_save, - .extra_opts = tee_tg_opts, +static struct xtables_target tee_tg_reg[] = { + { + .name = "TEE", + .version = XTABLES_VERSION, + .revision = 0, + .family = NFPROTO_IPV4, + .size = XT_ALIGN(sizeof(struct xt_tee_tginfo)), + .userspacesize = XT_ALIGN(sizeof(struct xt_tee_tginfo)), + .help = tee_tg_help, + .parse = tee_tg_parse, + .final_check = tee_tg_check, + .print = tee_tg_print, + .save = tee_tg_save, + .extra_opts = tee_tg_opts, + }, + { + .name = "TEE", + .version = XTABLES_VERSION, + .revision = 0, + .family = NFPROTO_IPV6, + .size = XT_ALIGN(sizeof(struct xt_tee_tginfo)), + .userspacesize = XT_ALIGN(sizeof(struct xt_tee_tginfo)), + .help = tee_tg_help, + .parse = tee_tg6_parse, + .final_check = tee_tg_check, + .print = tee_tg6_print, + .save = tee_tg6_save, + .extra_opts = tee_tg_opts, + }, }; static __attribute__((constructor)) void tee_tg_ldr(void) { - xtables_register_target(&tee_tg_reg); - xtables_register_target(&tee_tg6_reg); + xtables_register_targets(tee_tg_reg, + sizeof(tee_tg_reg) / sizeof(*tee_tg_reg)); }