]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
extensions: use multi-target registration
authorJan Engelhardt <jengelh@medozas.de>
Fri, 22 Jul 2011 10:11:03 +0000 (12:11 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Fri, 22 Jul 2011 10:14:38 +0000 (12:14 +0200)
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
extensions/libxt_TCPMSS.c
extensions/libxt_TEE.c

index 2266326d3e214027004215244c4e6c5b5f0288fc..48ab0445c11426b2c940ce1b08e6ba6aa7cdffec 100644 (file)
@@ -91,36 +91,36 @@ static void TCPMSS_save(const void *ip, const struct xt_entry_target *target)
                printf(" --set-mss %u", mssinfo->mss);
 }
 
-static struct xtables_target tcpmss_target = {
-       .family         = NFPROTO_IPV4,
-       .name           = "TCPMSS",
-       .version        = XTABLES_VERSION,
-       .size           = XT_ALIGN(sizeof(struct xt_tcpmss_info)),
-       .userspacesize  = XT_ALIGN(sizeof(struct xt_tcpmss_info)),
-       .help           = TCPMSS_help,
-       .print          = TCPMSS_print,
-       .save           = TCPMSS_save,
-       .x6_parse       = TCPMSS_parse,
-       .x6_fcheck      = TCPMSS_check,
-       .x6_options     = TCPMSS4_opts,
-};
-
-static struct xtables_target tcpmss_target6 = {
-       .family         = NFPROTO_IPV6,
-       .name           = "TCPMSS",
-       .version        = XTABLES_VERSION,
-       .size           = XT_ALIGN(sizeof(struct xt_tcpmss_info)),
-       .userspacesize  = XT_ALIGN(sizeof(struct xt_tcpmss_info)),
-       .help           = TCPMSS_help6,
-       .print          = TCPMSS_print,
-       .save           = TCPMSS_save,
-       .x6_parse       = TCPMSS_parse,
-       .x6_fcheck      = TCPMSS_check,
-       .x6_options     = TCPMSS6_opts,
+static struct xtables_target tcpmss_tg_reg[] = {
+       {
+               .family        = NFPROTO_IPV4,
+               .name          = "TCPMSS",
+               .version       = XTABLES_VERSION,
+               .size          = XT_ALIGN(sizeof(struct xt_tcpmss_info)),
+               .userspacesize = XT_ALIGN(sizeof(struct xt_tcpmss_info)),
+               .help          = TCPMSS_help,
+               .print         = TCPMSS_print,
+               .save          = TCPMSS_save,
+               .x6_parse      = TCPMSS_parse,
+               .x6_fcheck     = TCPMSS_check,
+               .x6_options    = TCPMSS4_opts,
+       },
+       {
+               .family        = NFPROTO_IPV6,
+               .name          = "TCPMSS",
+               .version       = XTABLES_VERSION,
+               .size          = XT_ALIGN(sizeof(struct xt_tcpmss_info)),
+               .userspacesize = XT_ALIGN(sizeof(struct xt_tcpmss_info)),
+               .help          = TCPMSS_help6,
+               .print         = TCPMSS_print,
+               .save          = TCPMSS_save,
+               .x6_parse      = TCPMSS_parse,
+               .x6_fcheck     = TCPMSS_check,
+               .x6_options    = TCPMSS6_opts,
+       },
 };
 
 void _init(void)
 {
-       xtables_register_target(&tcpmss_target);
-       xtables_register_target(&tcpmss_target6);
+       xtables_register_targets(tcpmss_tg_reg, ARRAY_SIZE(tcpmss_tg_reg));
 }
index c89e58090598f7326410a149149cab3df4e5cd51..92c7601c083de8f1e882309bd8dd76af1c3130ab 100644 (file)
@@ -92,36 +92,36 @@ static void tee_tg6_save(const void *ip, const struct xt_entry_target *target)
                printf(" --oif %s", info->oif);
 }
 
-static struct xtables_target tee_tg_reg = {
-       .name          = "TEE",
-       .version       = XTABLES_VERSION,
-       .revision      = 1,
-       .family        = NFPROTO_IPV4,
-       .size          = XT_ALIGN(sizeof(struct xt_tee_tginfo)),
-       .userspacesize = XT_ALIGN(sizeof(struct xt_tee_tginfo)),
-       .help          = tee_tg_help,
-       .print         = tee_tg_print,
-       .save          = tee_tg_save,
-       .x6_parse      = xtables_option_parse,
-       .x6_options    = tee_tg_opts,
-};
-
-static struct xtables_target tee_tg6_reg = {
-       .name          = "TEE",
-       .version       = XTABLES_VERSION,
-       .revision      = 1,
-       .family        = NFPROTO_IPV6,
-       .size          = XT_ALIGN(sizeof(struct xt_tee_tginfo)),
-       .userspacesize = XT_ALIGN(sizeof(struct xt_tee_tginfo)),
-       .help          = tee_tg_help,
-       .print         = tee_tg6_print,
-       .save          = tee_tg6_save,
-       .x6_parse      = xtables_option_parse,
-       .x6_options    = tee_tg_opts,
+static struct xtables_target tee_tg_reg[] = {
+       {
+               .name          = "TEE",
+               .version       = XTABLES_VERSION,
+               .revision      = 1,
+               .family        = NFPROTO_IPV4,
+               .size          = XT_ALIGN(sizeof(struct xt_tee_tginfo)),
+               .userspacesize = XT_ALIGN(sizeof(struct xt_tee_tginfo)),
+               .help          = tee_tg_help,
+               .print         = tee_tg_print,
+               .save          = tee_tg_save,
+               .x6_parse      = xtables_option_parse,
+               .x6_options    = tee_tg_opts,
+       },
+       {
+               .name          = "TEE",
+               .version       = XTABLES_VERSION,
+               .revision      = 1,
+               .family        = NFPROTO_IPV6,
+               .size          = XT_ALIGN(sizeof(struct xt_tee_tginfo)),
+               .userspacesize = XT_ALIGN(sizeof(struct xt_tee_tginfo)),
+               .help          = tee_tg_help,
+               .print         = tee_tg6_print,
+               .save          = tee_tg6_save,
+               .x6_parse      = xtables_option_parse,
+               .x6_options    = tee_tg_opts,
+       },
 };
 
 void _init(void)
 {
-       xtables_register_target(&tee_tg_reg);
-       xtables_register_target(&tee_tg6_reg);
+       xtables_register_targets(tee_tg_reg, ARRAY_SIZE(tee_tg_reg));
 }