]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
extensions: libebt_*: Drop some needless init callbacks
authorPhil Sutter <phil@nwl.cc>
Wed, 13 Dec 2023 20:43:10 +0000 (21:43 +0100)
committerPhil Sutter <phil@nwl.cc>
Wed, 10 Jan 2024 15:07:31 +0000 (16:07 +0100)
Extension data is zero by default.

extensions/libebt_802_3.c
extensions/libebt_ip.c
extensions/libebt_ip6.c
extensions/libebt_mark_m.c

index f05d02ead5a4a6d8046e8719af28ce11924fdbe3..8cbcdcea4912f9898917b2365970b3c6c6b31ebe 100644 (file)
@@ -36,14 +36,6 @@ static void br802_3_print_help(void)
 "  Type implies SAP value 0xaa\n");
 }
 
-static void br802_3_init(struct xt_entry_match *match)
-{
-       struct ebt_802_3_info *info = (struct ebt_802_3_info *)match->data;
-
-       info->invflags = 0;
-       info->bitmask = 0;
-}
-
 static int
 br802_3_parse(int c, char **argv, int invert, unsigned int *flags,
              const void *entry, struct xt_entry_match **match)
@@ -119,7 +111,6 @@ static struct xtables_match br802_3_match =
        .family         = NFPROTO_BRIDGE,
        .size           = XT_ALIGN(sizeof(struct ebt_802_3_info)),
        .userspacesize  = XT_ALIGN(sizeof(struct ebt_802_3_info)),
-       .init           = br802_3_init,
        .help           = br802_3_print_help,
        .parse          = br802_3_parse,
        .final_check    = br802_3_final_check,
index 68f34bff97debeca0586fce1ba124627aee99c0e..97ec4160942da014249b78a1d1c325924df13f81 100644 (file)
@@ -69,14 +69,6 @@ static void brip_print_help(void)
        xt_print_icmp_types(igmp_types, ARRAY_SIZE(igmp_types));
 }
 
-static void brip_init(struct xt_entry_match *match)
-{
-       struct ebt_ip_info *info = (struct ebt_ip_info *)match->data;
-
-       info->invflags = 0;
-       info->bitmask = 0;
-}
-
 static void
 parse_port_range(const char *protocol, const char *portstring, uint16_t *ports)
 {
@@ -503,7 +495,6 @@ static struct xtables_match brip_match = {
        .family         = NFPROTO_BRIDGE,
        .size           = XT_ALIGN(sizeof(struct ebt_ip_info)),
        .userspacesize  = XT_ALIGN(sizeof(struct ebt_ip_info)),
-       .init           = brip_init,
        .help           = brip_print_help,
        .parse          = brip_parse,
        .final_check    = brip_final_check,
index 18bb2720ccbec6b0c88c8d658bc58af073c981b7..d926e86a585f494d4b6c2dec2ad5de74b607f22c 100644 (file)
@@ -127,18 +127,6 @@ static void brip6_print_help(void)
        xt_print_icmp_types(icmpv6_codes, ARRAY_SIZE(icmpv6_codes));
 }
 
-static void brip6_init(struct xt_entry_match *match)
-{
-       struct ebt_ip6_info *ipinfo = (struct ebt_ip6_info *)match->data;
-
-       ipinfo->invflags = 0;
-       ipinfo->bitmask = 0;
-       memset(ipinfo->saddr.s6_addr, 0, sizeof(ipinfo->saddr.s6_addr));
-       memset(ipinfo->smsk.s6_addr, 0, sizeof(ipinfo->smsk.s6_addr));
-       memset(ipinfo->daddr.s6_addr, 0, sizeof(ipinfo->daddr.s6_addr));
-       memset(ipinfo->dmsk.s6_addr, 0, sizeof(ipinfo->dmsk.s6_addr));
-}
-
 /* wrap xtables_ip6parse_any(), ignoring any but the first returned address */
 static void ebt_parse_ip6_address(char *address,
                                  struct in6_addr *addr, struct in6_addr *msk)
@@ -452,7 +440,6 @@ static struct xtables_match brip6_match = {
        .family         = NFPROTO_BRIDGE,
        .size           = XT_ALIGN(sizeof(struct ebt_ip6_info)),
        .userspacesize  = XT_ALIGN(sizeof(struct ebt_ip6_info)),
-       .init           = brip6_init,
        .help           = brip6_print_help,
        .parse          = brip6_parse,
        .final_check    = brip6_final_check,
index 2462d0af7d0bc4adae7fbd9220d0e7c2211b8e2c..178c9ecef94da9bdaf08433d64e03c31c69db5ea 100644 (file)
@@ -30,16 +30,6 @@ static void brmark_m_print_help(void)
 "--mark    [!] [value][/mask]: Match nfmask value (see man page)\n");
 }
 
-static void brmark_m_init(struct xt_entry_match *match)
-{
-       struct ebt_mark_m_info *info = (struct ebt_mark_m_info *)match->data;
-
-       info->mark = 0;
-       info->mask = 0;
-       info->invert = 0;
-       info->bitmask = 0;
-}
-
 #define OPT_MARK 0x01
 static int
 brmark_m_parse(int c, char **argv, int invert, unsigned int *flags,
@@ -128,7 +118,6 @@ static struct xtables_match brmark_m_match = {
        .family         = NFPROTO_BRIDGE,
        .size           = XT_ALIGN(sizeof(struct ebt_mark_m_info)),
        .userspacesize  = XT_ALIGN(sizeof(struct ebt_mark_m_info)),
-       .init           = brmark_m_init,
        .help           = brmark_m_print_help,
        .parse          = brmark_m_parse,
        .final_check    = brmark_m_final_check,