[LEDE-DEV] [PATCH netifd] bridge: reset primary only after marking the member not present

Alex Oprea alex.oprea at inteno.se
Mon May 8 07:30:13 PDT 2017


Run the bridge_reset_primary function only after the member being removed
has been marked as not present.
This change prevents the bridge_reset_primary function from choosing the
member being removed as the new primary member.

Signed-off-by: Alex Oprea <alex.oprea at inteno.se>
---
 bridge.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bridge.c b/bridge.c
index c46d44e..96e0209 100644
--- a/bridge.c
+++ b/bridge.c
@@ -240,15 +240,15 @@ bridge_remove_member(struct bridge_member *bm)
 	if (!bm->present)
 		return;
 
-	if (bm == bst->primary_port)
-		bridge_reset_primary(bst);
-
 	if (bst->dev.active)
 		bridge_disable_member(bm);
 
 	bm->present = false;
 	bm->bst->n_present--;
 
+	if (bm == bst->primary_port)
+		bridge_reset_primary(bst);
+
 	if (bst->config.bridge_empty)
 		return;
 
-- 
2.7.4




More information about the Lede-dev mailing list