@@ -12,6 +12,7 @@ void path_group_prio_update(struct pathgroup *pgp)
int i;
int priority = 0;
int marginal = 0;
+ int defined_prios = 0;
struct path * pp;
pgp->enabled_paths = 0;
@@ -24,12 +25,17 @@ void path_group_prio_update(struct pathgroup *pgp)
marginal++;
if (pp->state == PATH_UP ||
pp->state == PATH_GHOST) {
- priority += pp->priority;
+ if (pp->priority != PRIO_UNDEF) {
+ defined_prios++;
+ priority += pp->priority;
+ }
pgp->enabled_paths++;
}
}
- if (pgp->enabled_paths)
- pgp->priority = priority / pgp->enabled_paths;
+ if (defined_prios)
+ pgp->priority = priority / defined_prios;
+ else if (pgp->enabled_paths)
+ pgp->priority = PRIO_UNDEF;
else
pgp->priority = 0;
if (marginal && marginal == i)