diff --git a/lib/rstp.c b/lib/rstp.c index a057c60f1..c1d5e7e3a 100644 --- a/lib/rstp.c +++ b/lib/rstp.c @@ -280,6 +280,8 @@ rstp_create(const char *name, rstp_identifier bridge_address, rstp->aux = aux; rstp->changes = false; rstp->begin = true; + rstp->old_root_aux = NULL; + rstp->new_root_aux = NULL; ovs_refcount_init(&rstp->ref_cnt); diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index ef1ad1829..7b46f0f5e 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -2296,9 +2296,14 @@ rstp_run(struct ofproto_dpif *ofproto) } if (rstp_shift_root_learned_address(ofproto->rstp)) { - bundle_move(((struct ofport_dpif *)rstp_get_old_root_aux(ofproto->rstp))->bundle, - ((struct ofport_dpif *)rstp_get_new_root_aux(ofproto->rstp))->bundle); - rstp_reset_root_changed(ofproto->rstp); + struct ofport_dpif *old_root_aux = + (struct ofport_dpif *)rstp_get_old_root_aux(ofproto->rstp); + struct ofport_dpif *new_root_aux = + (struct ofport_dpif *)rstp_get_new_root_aux(ofproto->rstp); + if (old_root_aux != NULL && new_root_aux != NULL) { + bundle_move(old_root_aux->bundle, new_root_aux->bundle); + rstp_reset_root_changed(ofproto->rstp); + } } } }