All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bridge] [PATCH] BRIDGE: Do not suppress FDB learning after topology change when forward_delay is 0.
@ 2009-05-14 11:01 Ian Campbell
  2009-05-14 14:37 ` Ian Campbell
  2009-05-14 15:35 ` Stephen Hemminger
  0 siblings, 2 replies; 6+ messages in thread
From: Ian Campbell @ 2009-05-14 11:01 UTC (permalink / raw)
  Cc: bridge, Ian Campbell

I recently noticed that my bridges were flooding traffic for a period of time
after a topology change. These bridges are part of a Xen host and therefore
have spanning tree disabled and forward_delay of zero. In this situation there
is no reason not to begin relearning immediately after a topology change.

The existing code uses hold_time == 0 to suppress learning in br_fdb_update.
hold_time() returns forward_delay if a topology change has recently occurred
and ageing_time if not. Setting each of those to zero has slightly different
semantics: Setting forward_delay to zero effectively means forward immediately
while setting ageing_time to zero effectively means do not learn.

The solution is to not learn after a topology change only if forward_delay is
non-zero but to retain the existing behaviour based on ageing_time if a
topology change has not occured.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: bridge@lists.linux-foundation.org
---
 net/bridge/br_fdb.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index a48f5ef..c4a38ed 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -57,6 +57,11 @@ static inline unsigned long hold_time(const struct net_bridge *br)
 	return br->topology_change ? br->forward_delay : br->ageing_time;
 }
 
+static inline int should_learn(const struct net_bridge *br)
+{
+	return br->topology_change ? !br->forward_delay : !!br->ageing_time;
+}
+
 static inline int has_expired(const struct net_bridge *br,
 				  const struct net_bridge_fdb_entry *fdb)
 {
@@ -384,7 +389,7 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
 	struct net_bridge_fdb_entry *fdb;
 
 	/* some users want to always flood. */
-	if (hold_time(br) == 0)
+	if (!should_learn(br))
 		return;
 
 	/* ignore packets unless we are using this port */
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-05-15 17:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-14 11:01 [Bridge] [PATCH] BRIDGE: Do not suppress FDB learning after topology change when forward_delay is 0 Ian Campbell
2009-05-14 14:37 ` Ian Campbell
2009-05-14 15:35 ` Stephen Hemminger
2009-05-15  9:34   ` Ian Campbell
2009-05-15 10:08   ` Uli Luckas
2009-05-15 17:04   ` richardvoigt

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.