]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
extensions: remove redundant init functions
authorJan Engelhardt <jengelh@medozas.de>
Fri, 18 Feb 2011 01:00:33 +0000 (02:00 +0100)
committerJan Engelhardt <jengelh@medozas.de>
Sat, 19 Feb 2011 14:28:47 +0000 (15:28 +0100)
The main program already zeroes the per-extension data block.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 files changed:
extensions/libip6t_ah.c
extensions/libip6t_dst.c
extensions/libip6t_frag.c
extensions/libip6t_hbh.c
extensions/libip6t_ipv6header.c
extensions/libip6t_rt.c
extensions/libipt_SAME.c
extensions/libxt_NFLOG.c
extensions/libxt_RATEEST.c
extensions/libxt_TCPOPTSTRIP.c
extensions/libxt_dccp.c
extensions/libxt_hashlimit.c
extensions/libxt_sctp.c
extensions/libxt_string.c

index 5fa0d2dd1fcd4835265f9930286a5cff56286eb1..29220474e6aabd75e9fe10037a3c4b0124c81316 100644 (file)
@@ -73,8 +73,6 @@ static void ah_init(struct xt_entry_match *m)
        struct ip6t_ah *ahinfo = (struct ip6t_ah *)m->data;
 
        ahinfo->spis[1] = 0xFFFFFFFF;
-       ahinfo->hdrlen = 0;
-       ahinfo->hdrres = 0;
 }
 
 static int ah_parse(int c, char **argv, int invert, unsigned int *flags,
index 3ba804fe9217b19125c465996a2b7d80597712a8..8b656a6666aeac22c8b3911451351f015559943e 100644 (file)
@@ -106,16 +106,6 @@ parse_options(const char *optsstr, uint16_t *opts)
        return i;
 }
 
-static void dst_init(struct xt_entry_match *m)
-{
-       struct ip6t_opts *optinfo = (struct ip6t_opts *)m->data;
-
-       optinfo->hdrlen = 0;
-       optinfo->flags = 0;
-       optinfo->invflags = 0;
-       optinfo->optsnr = 0;
-}
-
 static int dst_parse(int c, char **argv, int invert, unsigned int *flags,
                      const void *entry, struct xt_entry_match **match)
 {
@@ -227,7 +217,6 @@ static struct xtables_match dst_mt6_reg = {
        .size          = XT_ALIGN(sizeof(struct ip6t_opts)),
        .userspacesize = XT_ALIGN(sizeof(struct ip6t_opts)),
        .help          = dst_help,
-       .init          = dst_init,
        .parse         = dst_parse,
        .print         = dst_print,
        .save          = dst_save,
index ac9bd2e284f703fb0d9b2d78e0dde826ee29b69f..19aca4c504831446e5e70cc94871d59e2fede2fa 100644 (file)
@@ -78,11 +78,7 @@ static void frag_init(struct xt_entry_match *m)
 {
        struct ip6t_frag *fraginfo = (struct ip6t_frag *)m->data;
 
-       fraginfo->ids[0] = 0x0L;
        fraginfo->ids[1] = 0xFFFFFFFF;
-       fraginfo->hdrlen = 0;
-       fraginfo->flags = 0;
-       fraginfo->invflags = 0;
 }
 
 static int frag_parse(int c, char **argv, int invert, unsigned int *flags,
index e51569ef13767a4d4b99ce733f37f4d072ac525c..9eb504e6b3ec432642922b3a12cd2bf625a94e1c 100644 (file)
@@ -100,16 +100,6 @@ parse_options(const char *optsstr, uint16_t *opts)
        return i;
 }
 
-static void hbh_init(struct xt_entry_match *m)
-{
-       struct ip6t_opts *optinfo = (struct ip6t_opts *)m->data;
-
-       optinfo->hdrlen = 0;
-       optinfo->flags = 0;
-       optinfo->invflags = 0;
-       optinfo->optsnr = 0;
-}
-
 static int hbh_parse(int c, char **argv, int invert, unsigned int *flags,
                      const void *entry, struct xt_entry_match **match)
 {
@@ -211,7 +201,6 @@ static struct xtables_match hbh_mt6_reg = {
        .size           = XT_ALIGN(sizeof(struct ip6t_opts)),
        .userspacesize  = XT_ALIGN(sizeof(struct ip6t_opts)),
        .help           = hbh_help,
-       .init           = hbh_init,
        .parse          = hbh_parse,
        .print          = hbh_print,
        .save           = hbh_save,
index da832e2124074566fcba96f850fae8b76e2a26cc..187e0a43021d14e51b24bc590a586405058101a3 100644 (file)
@@ -146,15 +146,6 @@ static const struct option ipv6header_opts[] = {
        XT_GETOPT_TABLEEND,
 };
 
-static void ipv6header_init(struct xt_entry_match *m)
-{
-       struct ip6t_ipv6header_info *info = (struct ip6t_ipv6header_info *)m->data;
-
-       info->matchflags = 0x00;
-       info->invflags = 0x00;
-       info->modeflag = 0x00;
-}
-
 static unsigned int
 parse_header(const char *flags) {
         unsigned int ret = 0;
@@ -273,7 +264,6 @@ static struct xtables_match ipv6header_mt6_reg = {
        .size           = XT_ALIGN(sizeof(struct ip6t_ipv6header_info)),
        .userspacesize  = XT_ALIGN(sizeof(struct ip6t_ipv6header_info)),
        .help           = ipv6header_help,
-       .init           = ipv6header_init,
        .parse          = ipv6header_parse,
        .final_check    = ipv6header_check,
        .print          = ipv6header_print,
index ec492c12928e06e00d7c6cf69ed139d91d5e41b2..333350db78e7fa14f8743ed278121699ccb8f7c1 100644 (file)
@@ -140,13 +140,7 @@ static void rt_init(struct xt_entry_match *m)
 {
        struct ip6t_rt *rtinfo = (struct ip6t_rt *)m->data;
 
-       rtinfo->rt_type = 0x0L;
-       rtinfo->segsleft[0] = 0x0L;
        rtinfo->segsleft[1] = 0xFFFFFFFF;
-       rtinfo->hdrlen = 0;
-       rtinfo->flags = 0;
-       rtinfo->invflags = 0;
-       rtinfo->addrnr = 0;
 }
 
 static int rt_parse(int c, char **argv, int invert, unsigned int *flags,
index 9c548f5f7e608f01af051815442da70f7be36752..b18351e8feb429834f2fe2d0dfad7ac095ff8e85 100644 (file)
@@ -32,17 +32,6 @@ static const struct option SAME_opts[] = {
        XT_GETOPT_TABLEEND,
 };
 
-static void SAME_init(struct xt_entry_target *t)
-{
-       struct ipt_same_info *mr = (struct ipt_same_info *)t->data;
-
-       /* Set default to 0 */
-       mr->rangesize = 0;
-       mr->info = 0;
-       mr->ipnum = 0;
-       
-}
-
 /* Parses range of IPs */
 static void
 parse_to(char *arg, struct nf_nat_range *range)
@@ -197,7 +186,6 @@ static struct xtables_target same_tg_reg = {
        .size           = XT_ALIGN(sizeof(struct ipt_same_info)),
        .userspacesize  = XT_ALIGN(sizeof(struct ipt_same_info)),
        .help           = SAME_help,
-       .init           = SAME_init,
        .parse          = SAME_parse,
        .final_check    = SAME_check,
        .print          = SAME_print,
index b4fdc482cd9b904af8fb1970dbecb4510b5ef964..61c97412599d30c1ea39b41d165c8c4bf0615b87 100644 (file)
@@ -36,7 +36,6 @@ static void NFLOG_init(struct xt_entry_target *t)
 {
        struct xt_nflog_info *info = (struct xt_nflog_info *)t->data;
 
-       info->group     = 0;
        info->threshold = XT_NFLOG_DEFAULT_THRESHOLD;
 }
 
index eb3cdd9507106433fe6bcfe741e4e6db74a708e8..6369e9e4b60a6fb7525bbe84f032a0d3882c59a4 100644 (file)
@@ -82,13 +82,6 @@ RATEEST_print_time(unsigned int time)
                printf(" %uus", time);
 }
 
-static void
-RATEEST_init(struct xt_entry_target *target)
-{
-       interval = 0;
-       ewma_log = 0;
-}
-
 static int
 RATEEST_parse(int c, char **argv, int invert, unsigned int *flags,
              const void *entry, struct xt_entry_target **target)
@@ -206,7 +199,6 @@ static struct xtables_target rateest_tg_reg = {
        .size           = XT_ALIGN(sizeof(struct xt_rateest_target_info)),
        .userspacesize  = XT_ALIGN(sizeof(struct xt_rateest_target_info)),
        .help           = RATEEST_help,
-       .init           = RATEEST_init,
        .parse          = RATEEST_parse,
        .final_check    = RATEEST_final_check,
        .print          = RATEEST_print,
index 34f3562b65639dc4e8e47a49ee723a362c2f5151..338a311daf3e872c76d387824508c4e45dc4b9ad 100644 (file)
@@ -56,14 +56,6 @@ static void tcpoptstrip_tg_help(void)
                printf("    %-14s    strip \"%s\" option\n", w->name, w->desc);
 }
 
-static void tcpoptstrip_tg_init(struct xt_entry_target *t)
-{
-       struct xt_tcpoptstrip_target_info *info = (void *)t->data;
-
-       /* strictly necessary? play safe for now. */
-       memset(info->strip_bmap, 0, sizeof(info->strip_bmap));
-}
-
 static void parse_list(struct xt_tcpoptstrip_target_info *info, char *arg)
 {
        unsigned int option;
@@ -184,7 +176,6 @@ static struct xtables_target tcpoptstrip_tg_reg = {
        .size          = XT_ALIGN(sizeof(struct xt_tcpoptstrip_target_info)),
        .userspacesize = XT_ALIGN(sizeof(struct xt_tcpoptstrip_target_info)),
        .help          = tcpoptstrip_tg_help,
-       .init          = tcpoptstrip_tg_init,
        .parse         = tcpoptstrip_tg_parse,
        .final_check   = tcpoptstrip_tg_check,
        .print         = tcpoptstrip_tg_print,
index 3b2dc6b8716fe50bbde5e7f3416e8ad2a85af808..ee8e00956e854f2a3a6e51ae6bc40dd90e17f4d1 100644 (file)
 #define DEBUGP(format, fist...) 
 #endif
 
-static void dccp_init(struct xt_entry_match *m)
-{
-       struct xt_dccp_info *einfo = (struct xt_dccp_info *)m->data;
-
-       memset(einfo, 0, sizeof(struct xt_dccp_info));
-}
-
 static void dccp_help(void)
 {
        printf(
@@ -340,7 +333,6 @@ static struct xtables_match dccp_match = {
        .size           = XT_ALIGN(sizeof(struct xt_dccp_info)),
        .userspacesize  = XT_ALIGN(sizeof(struct xt_dccp_info)),
        .help           = dccp_help,
-       .init           = dccp_init,
        .parse          = dccp_parse,
        .print          = dccp_print,
        .save           = dccp_save,
index d766987ee9e8edb32b6be1ad0a6f053bd719598a..cd057c5ff3600a17c75aa6dc847584c88fa10d52 100644 (file)
@@ -134,7 +134,6 @@ static void hashlimit_init(struct xt_entry_match *m)
 {
        struct xt_hashlimit_info *r = (struct xt_hashlimit_info *)m->data;
 
-       r->cfg.mode = 0;
        r->cfg.burst = XT_HASHLIMIT_BURST;
        r->cfg.gc_interval = XT_HASHLIMIT_GCINTERVAL;
        r->cfg.expire = XT_HASHLIMIT_EXPIRE;
index 718d4c42d4891704b2e676ceb980466e7607b252..d3379d303d55ba1ac033a0afee244161c72def2f 100644 (file)
@@ -35,8 +35,6 @@ static void sctp_init(struct xt_entry_match *m)
        int i;
        struct xt_sctp_info *einfo = (struct xt_sctp_info *)m->data;
 
-       memset(einfo, 0, sizeof(struct xt_sctp_info));
-
        for (i = 0; i < XT_NUM_SCTP_FLAGS; i++) {
                einfo->flag_info[i].chunktype = -1;
        }
index 4f75757562f7d32149a6cee4a124da86a17b7d75..1030d2e308c587dbc1758d1a994e08c4907d143a 100644 (file)
@@ -58,8 +58,7 @@ static void string_init(struct xt_entry_match *m)
 {
        struct xt_string_info *i = (struct xt_string_info *) m->data;
 
-       if (i->to_offset == 0)
-               i->to_offset = UINT16_MAX;
+       i->to_offset = UINT16_MAX;
 }
 
 static void