From 76c9c4231400245864addfc7a8aabaa79843b4bd Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Wed, 6 Apr 2011 17:23:40 -0700 Subject: cfm: Fix broken fault logic. If the last receive time for a remote MP was before the last fault check, the CFM code would not declare a fault. This is, of course, exactly the wrong response. Bug #5303. --- lib/cfm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/cfm.c') diff --git a/lib/cfm.c b/lib/cfm.c index 5a547d0d..a504714c 100644 --- a/lib/cfm.c +++ b/lib/cfm.c @@ -174,11 +174,14 @@ cfm_run(struct cfm *cfm) if (timer_expired(&cfmi->fault_timer)) { bool fault; struct remote_mp *rmp; + long long int interval; - fault = now < cfmi->x_recv_time + cfm_fault_interval(cfmi); + interval = cfm_fault_interval(cfmi); + fault = now < cfmi->x_recv_time + interval; HMAP_FOR_EACH (rmp, node, &cfm->remote_mps) { - if (timer_expired_at(&cfmi->fault_timer, rmp->recv_time)) { + if (rmp->recv_time < timer_enabled_at(&cfmi->fault_timer, interval) + || timer_expired_at(&cfmi->fault_timer, rmp->recv_time)) { rmp->fault = true; } @@ -188,7 +191,7 @@ cfm_run(struct cfm *cfm) } cfm->fault = fault; - timer_set_duration(&cfmi->fault_timer, cfm_fault_interval(cfmi)); + timer_set_duration(&cfmi->fault_timer, interval); } } -- cgit v1.2.3