Linux Netfilter development
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: netfilter-devel@vger.kernel.org
Subject: [iptables PATCH 06/23] extensions: libebt_*: Drop some needless init callbacks
Date: Wed, 20 Dec 2023 17:06:19 +0100	[thread overview]
Message-ID: <20231220160636.11778-7-phil@nwl.cc> (raw)
In-Reply-To: <20231220160636.11778-1-phil@nwl.cc>

Extension data is zero by default.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 extensions/libebt_802_3.c  |  9 ---------
 extensions/libebt_ip.c     |  9 ---------
 extensions/libebt_ip6.c    | 13 -------------
 extensions/libebt_mark_m.c | 11 -----------
 4 files changed, 42 deletions(-)

diff --git a/extensions/libebt_802_3.c b/extensions/libebt_802_3.c
index f05d02ead5a4a..8cbcdcea4912f 100644
--- a/extensions/libebt_802_3.c
+++ b/extensions/libebt_802_3.c
@@ -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,
diff --git a/extensions/libebt_ip.c b/extensions/libebt_ip.c
index 68f34bff97deb..97ec4160942da 100644
--- a/extensions/libebt_ip.c
+++ b/extensions/libebt_ip.c
@@ -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,
diff --git a/extensions/libebt_ip6.c b/extensions/libebt_ip6.c
index 18bb2720ccbec..d926e86a585f4 100644
--- a/extensions/libebt_ip6.c
+++ b/extensions/libebt_ip6.c
@@ -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,
diff --git a/extensions/libebt_mark_m.c b/extensions/libebt_mark_m.c
index 2462d0af7d0bc..178c9ecef94da 100644
--- a/extensions/libebt_mark_m.c
+++ b/extensions/libebt_mark_m.c
@@ -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,
-- 
2.43.0


  parent reply	other threads:[~2023-12-20 16:06 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20 16:06 [iptables PATCH 00/23] Guided option parser for ebtables Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 01/23] libxtables: xtoptions: Prevent XTOPT_PUT with XTTYPE_HOSTMASK Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 02/23] libxtables: xtoptions: Support XTOPT_NBO with XTTYPE_UINT* Phil Sutter
2023-12-20 19:07   ` Jan Engelhardt
2023-12-20 21:28     ` Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 03/23] libxtables: xtoptions: Implement XTTYPE_ETHERMACMASK Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 04/23] libxtables: xtoptions: Treat NFPROTO_BRIDGE as IPv4 Phil Sutter
2023-12-20 19:20   ` Jan Engelhardt
2023-12-20 21:35     ` Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 05/23] ebtables: Support for guided option parser Phil Sutter
2023-12-20 16:06 ` Phil Sutter [this message]
2023-12-20 16:06 ` [iptables PATCH 07/23] extensions: libebt_stp: Use " Phil Sutter
2023-12-20 19:29   ` Jan Engelhardt
2023-12-20 21:47     ` Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 08/23] extensions: libebt_arpreply: " Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 09/23] extensions: libebt_dnat: " Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 10/23] extensions: libebt_ip6: " Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 11/23] extensions: libebt_ip: " Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 12/23] extensions: libebt_log: " Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 13/23] extensions: libebt_mark: " Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 14/23] extensions: libebt_nflog: " Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 15/23] extensions: libebt_snat: " Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 16/23] extensions: libebt_redirect: " Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 17/23] extensions: libebt_802_3: " Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 18/23] extensions: libebt_vlan: " Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 19/23] extensions: libebt_arp: " Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 20/23] extensions: libxt_limit: Use guided option parser for NFPROTO_BRIDGE, too Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 21/23] extensions: libebt_pkttype: Use guided option parser Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 22/23] extensions: libebt_mark_m: " Phil Sutter
2023-12-20 16:06 ` [iptables PATCH 23/23] extensions: libxt_HMARK: Review HMARK_parse() Phil Sutter
2024-01-10 15:09 ` [iptables PATCH 00/23] Guided option parser for ebtables Phil Sutter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231220160636.11778-7-phil@nwl.cc \
    --to=phil@nwl.cc \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox