netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 37/47] netfilter: ebt_stp: Use generic functions for comparisons
Date: Fri, 30 Mar 2018 13:44:59 +0200	[thread overview]
Message-ID: <20180330114509.18738-8-pablo@netfilter.org> (raw)
In-Reply-To: <20180330114509.18738-1-pablo@netfilter.org>

From: Joe Perches <joe@perches.com>

Instead of unnecessary const declarations, use the generic functions to
save a little object space.

$ size net/bridge/netfilter/ebt_stp.o*
   text	   data	    bss	    dec	    hex	filename
   1250	    144	      0	   1394	    572	net/bridge/netfilter/ebt_stp.o.new
   1344	    144	      0	   1488	    5d0	net/bridge/netfilter/ebt_stp.o.old

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/bridge/netfilter/ebt_stp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/bridge/netfilter/ebt_stp.c b/net/bridge/netfilter/ebt_stp.c
index 3140eb912d7e..47ba98db145d 100644
--- a/net/bridge/netfilter/ebt_stp.c
+++ b/net/bridge/netfilter/ebt_stp.c
@@ -153,8 +153,6 @@ ebt_stp_mt(const struct sk_buff *skb, struct xt_action_param *par)
 static int ebt_stp_mt_check(const struct xt_mtchk_param *par)
 {
 	const struct ebt_stp_info *info = par->matchinfo;
-	const u8 bridge_ula[6] = {0x01, 0x80, 0xc2, 0x00, 0x00, 0x00};
-	const u8 msk[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 	const struct ebt_entry *e = par->entryinfo;
 
 	if (info->bitmask & ~EBT_STP_MASK || info->invflags & ~EBT_STP_MASK ||
@@ -162,8 +160,8 @@ static int ebt_stp_mt_check(const struct xt_mtchk_param *par)
 		return -EINVAL;
 	/* Make sure the match only receives stp frames */
 	if (!par->nft_compat &&
-	    (!ether_addr_equal(e->destmac, bridge_ula) ||
-	     !ether_addr_equal(e->destmsk, msk) ||
+	    (!ether_addr_equal(e->destmac, eth_stp_addr) ||
+	     !is_broadcast_ether_addr(e->destmsk) ||
 	     !(e->bitmask & EBT_DESTMAC)))
 		return -EINVAL;
 
-- 
2.11.0

  parent reply	other threads:[~2018-03-30 11:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-30 11:44 [PATCH 30/47] netfilter: Replace printk() with pr_*() and define pr_fmt() Pablo Neira Ayuso
2018-03-30 11:44 ` [PATCH 31/47] netfilter: ctnetlink: synproxy support Pablo Neira Ayuso
2018-03-30 11:44 ` [PATCH 32/47] netfilter: ebtables: add support for matching ICMP type and code Pablo Neira Ayuso
2018-03-30 11:44 ` [PATCH 33/47] netfilter: ebtables: add support for matching IGMP type Pablo Neira Ayuso
2018-03-30 11:44 ` [PATCH 34/47] netfilter: ebtables: Add support for specifying match revision Pablo Neira Ayuso
2018-03-30 11:44 ` [PATCH 35/47] netfilter: ebtables: Add string filter Pablo Neira Ayuso
2018-03-30 11:44 ` [PATCH 36/47] netfilter: add flowtable documentation Pablo Neira Ayuso
2018-03-30 11:44 ` Pablo Neira Ayuso [this message]
2018-03-30 11:45 ` [PATCH 38/47] netfilter: nf_tables: rename struct nf_chain_type Pablo Neira Ayuso
2018-03-30 11:45 ` [PATCH 39/47] netfilter: nf_tables: nft_register_chain_type() returns void Pablo Neira Ayuso

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=20180330114509.18738-8-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).