lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 4 Aug 2008 10:27:03 -0700
From:	Stephen Hemminger <shemminger@...tta.com>
To:	Herbert Xu <herbert@...dor.apana.org.au>
Cc:	"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: bridge: Eliminate unnecessary forward delay

On Tue, 5 Aug 2008 01:04:39 +0800
Herbert Xu <herbert@...dor.apana.org.au> wrote:

> Hi:
> 
> bridge: Eliminate unnecessary forward delay
> 
> When the forward delay is set to zero, we still delay the setting
> of the forwarding state by one or possibly two timers depending
> on whether STP is enabled.  This could either turn out to be
> instantaneous, or horribly slow depending on the load of the
> machine.
> 
> As there is nothing preventing us from enabling forwarding straight
> away, this patch eliminates this potential delay by executing the
> code directly if the forward delay is zero.
> 
> The effect of this problem is that immediately after the carrier
> comes on a port, the bridge will drop all packets received from
> that port until it enters forwarding mode, thus causing unnecessary
> packet loss.
> 
> Note that this patch doesn't fully remove the delay due to the
> link watcher.  We should also check the carrier state when we
> are about to drop an incoming packet because the port is disabled.
> But that's for another patch.
> 
> Signed-off-by: Herbert Xu <herbert@...dor.apana.org.au>

How about this, it is simpler just to do the state change.

--- a/net/bridge/br_stp.c	2008-08-04 10:20:21.000000000 -0700
+++ b/net/bridge/br_stp.c	2008-08-04 10:26:04.000000000 -0700
@@ -368,14 +368,26 @@ static void br_make_blocking(struct net_
 /* called under bridge lock */
 static void br_make_forwarding(struct net_bridge_port *p)
 {
-	if (p->state == BR_STATE_BLOCKING) {
-		if (p->br->stp_enabled == BR_KERNEL_STP)
-			p->state = BR_STATE_LISTENING;
-		else
-			p->state = BR_STATE_LEARNING;
+	struct net_bridge *br = p->br;
 
-		br_log_state(p);
-		mod_timer(&p->forward_delay_timer, jiffies + p->br->forward_delay);	}
+	if (p->state != BR_STATE_BLOCKING)
+		return;
+
+	if (br->forward_delay == 0) {
+		p->state = BR_STATE_FORWARDING;
+		if (br_is_designated_for_some_port(br))
+			br_topology_change_detection(br);
+		del_timer(&p->forward_delay_timer);
+	}
+	else if (p->br->stp_enabled == BR_KERNEL_STP)
+		p->state = BR_STATE_LISTENING;
+	else
+		p->state = BR_STATE_LEARNING;
+
+	br_log_state(p);
+
+	if (br->forward_delay != 0)
+		mod_timer(&p->forward_delay_timer, jiffies + br->forward_delay);
 }
 
 /* called under bridge lock */
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ