Patchwork bridge: Fix enforcement of multicast hash_max limit

login
register
mail settings
Submitter Thomas Graf
Date July 11, 2012, 8:29 a.m.
Message ID <417e2d4ff99d88014f288e9924c5a45d4650f474.1341995313.git.tgraf@suug.ch>
Download mbox | patch
Permalink /patch/170385/
State Accepted
Delegated to: David Miller
Headers show

Comments

Thomas Graf - July 11, 2012, 8:29 a.m.
The hash size is doubled when it needs to grow and compared against
hash_max. The >= comparison will limit the hash table size to half
of what is expected i.e. the default 512 hash_max will not allow
the hash table to grow larger than 256.

Also print the hash table limit instead of the desirable size when
the limit is reached.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
---
 net/bridge/br_multicast.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
David Miller - July 17, 2012, 5:59 a.m.
From: Thomas Graf <tgraf@suug.ch>
Date: Wed, 11 Jul 2012 10:29:19 +0200

> The hash size is doubled when it needs to grow and compared against
> hash_max. The >= comparison will limit the hash table size to half
> of what is expected i.e. the default 512 hash_max will not allow
> the hash table to grow larger than 256.
> 
> Also print the hash table limit instead of the desirable size when
> the limit is reached.
> 
> Signed-off-by: Thomas Graf <tgraf@suug.ch>

Applied to net-next, thanks Thomas.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index b665812..8213618 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -540,10 +540,11 @@  static struct net_bridge_mdb_entry *br_multicast_get_group(
 
 	if (mdb->size >= max) {
 		max *= 2;
-		if (unlikely(max >= br->hash_max)) {
-			br_warn(br, "Multicast hash table maximum "
-				"reached, disabling snooping: %s, %d\n",
-				port ? port->dev->name : br->dev->name, max);
+		if (unlikely(max > br->hash_max)) {
+			br_warn(br, "Multicast hash table maximum of %d "
+				"reached, disabling snooping: %s\n",
+				br->hash_max,
+				port ? port->dev->name : br->dev->name);
 			err = -E2BIG;
 disable:
 			br->multicast_disabled = 1;