Previously, the flap count logic for CFM was dependent on the state of
the logging facility. This patch ensures that flaps are counted in all
cases.

Found by inspection.

Signed-off-by: Joe Stringer <[email protected]>
---
---
 lib/cfm.c |   27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/lib/cfm.c b/lib/cfm.c
index d256a5f..01c9a8c 100644
--- a/lib/cfm.c
+++ b/lib/cfm.c
@@ -480,20 +480,19 @@ cfm_run(struct cfm *cfm) OVS_EXCLUDED(mutex)
             cfm->fault |= CFM_FAULT_RECV;
         }
 
-        if (old_cfm_fault != cfm->fault && !VLOG_DROP_INFO(&rl)) {
-            struct ds ds = DS_EMPTY_INITIALIZER;
-
-            ds_put_cstr(&ds, "from [");
-            ds_put_cfm_fault(&ds, old_cfm_fault);
-            ds_put_cstr(&ds, "] to [");
-            ds_put_cfm_fault(&ds, cfm->fault);
-            ds_put_char(&ds, ']');
-            VLOG_INFO("%s: CFM faults changed %s.", cfm->name, ds_cstr(&ds));
-            ds_destroy(&ds);
-
-            /* If there is a flap, increments the counter. */
-            if (old_cfm_fault == false || cfm->fault == false) {
-                cfm->flap_count++;
+        if (old_cfm_fault != cfm->fault) {
+            cfm->flap_count++;
+
+            if (!VLOG_DROP_INFO(&rl)) {
+                struct ds ds = DS_EMPTY_INITIALIZER;
+
+                ds_put_cstr(&ds, "from [");
+                ds_put_cfm_fault(&ds, old_cfm_fault);
+                ds_put_cstr(&ds, "] to [");
+                ds_put_cfm_fault(&ds, cfm->fault);
+                ds_put_char(&ds, ']');
+                VLOG_INFO("%s: CFM faults changed %s.", cfm->name, 
ds_cstr(&ds));
+                ds_destroy(&ds);
             }
         }
 
-- 
1.7.9.5

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to