From: Alex Oprea Date: Mon, 8 May 2017 14:30:13 +0000 (+0200) Subject: bridge: reset primary only after marking the member not present X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=commitdiff_plain;h=20a1bac4810e98a463380e5d0f1f77c72ac31941;hp=6b9c2673173f9636647e021a84d560c0863b1b99 bridge: reset primary only after marking the member not present 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 --- 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;