* [PATCH] bridge: netfilter: ebt_stp: Use generic functions for comparisons
@ 2018-03-21 11:03 ` Joe Perches
0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2018-03-21 11:03 UTC (permalink / raw)
To: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal
Cc: Stephen Hemminger, David S. Miller, netfilter-devel, coreteam,
bridge, netdev, linux-kernel
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>
---
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.15.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Bridge] [PATCH] bridge: netfilter: ebt_stp: Use generic functions for comparisons
@ 2018-03-21 11:03 ` Joe Perches
0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2018-03-21 11:03 UTC (permalink / raw)
To: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal
Cc: netdev, bridge, linux-kernel, coreteam, netfilter-devel, David S. Miller
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>
---
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.15.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] bridge: netfilter: ebt_stp: Use generic functions for comparisons
2018-03-21 11:03 ` [Bridge] " Joe Perches
@ 2018-03-30 9:52 ` Pablo Neira Ayuso
-1 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2018-03-30 9:52 UTC (permalink / raw)
To: Joe Perches
Cc: Jozsef Kadlecsik, Florian Westphal, Stephen Hemminger,
David S. Miller, netfilter-devel, coreteam, bridge, netdev,
linux-kernel
On Wed, Mar 21, 2018 at 04:03:22AM -0700, Joe Perches wrote:
> 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
Applied, thanks Joe.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Bridge] [PATCH] bridge: netfilter: ebt_stp: Use generic functions for comparisons
@ 2018-03-30 9:52 ` Pablo Neira Ayuso
0 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2018-03-30 9:52 UTC (permalink / raw)
To: Joe Perches
Cc: netdev, bridge, Florian Westphal, linux-kernel, coreteam,
netfilter-devel, Jozsef Kadlecsik, David S. Miller
On Wed, Mar 21, 2018 at 04:03:22AM -0700, Joe Perches wrote:
> 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
Applied, thanks Joe.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-03-30 9:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-21 11:03 [PATCH] bridge: netfilter: ebt_stp: Use generic functions for comparisons Joe Perches
2018-03-21 11:03 ` [Bridge] " Joe Perches
2018-03-30 9:52 ` Pablo Neira Ayuso
2018-03-30 9:52 ` [Bridge] " Pablo Neira Ayuso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.