Index: sys/net/bridgestp.c =================================================================== --- sys/net/bridgestp.c +++ sys/net/bridgestp.c @@ -129,6 +129,7 @@ static uint32_t bstp_calc_path_cost(struct bstp_port *); static void bstp_notify_state(void *, int); static void bstp_notify_rtage(void *, int); +static void bstp_notify_media(void *, int); static void bstp_ifupdstatus(void *, int); static void bstp_enable_port(struct bstp_state *, struct bstp_port *); static void bstp_disable_port(struct bstp_state *, struct bstp_port *); @@ -1783,7 +1784,14 @@ } static void -bstp_ifupdstatus(void *arg, int pending) +bstp_notify_media(void *arg, int pending) +{ + + bstp_ifupdstatus(arg, 1); +} + +static void +bstp_ifupdstatus(void *arg, int polled) { struct bstp_port *bp = (struct bstp_port *)arg; struct bstp_state *bs = bp->bp_bs; @@ -1812,8 +1820,12 @@ } } - /* Calc the cost if the link was down previously */ - if (bp->bp_flags & BSTP_PORT_PNDCOST) { + /* + * Recalculate the cost if the link was down previously. + * Always recalculate on real media change notifications + * (i.e. not polled). + */ + if (!polled || (bp->bp_flags & BSTP_PORT_PNDCOST)) { uint32_t cost; cost = bstp_calc_path_cost(bp); @@ -2206,7 +2218,7 @@ bp->bp_priority = BSTP_DEFAULT_PORT_PRIORITY; TASK_INIT(&bp->bp_statetask, 0, bstp_notify_state, bp); TASK_INIT(&bp->bp_rtagetask, 0, bstp_notify_rtage, bp); - TASK_INIT(&bp->bp_mediatask, 0, bstp_ifupdstatus, bp); + TASK_INIT(&bp->bp_mediatask, 0, bstp_notify_media, bp); /* Init state */ bp->bp_infois = BSTP_INFO_DISABLED;