cfm: Fix appctl negative report.
authorEthan Jackson <ethan@nicira.com>
Thu, 31 Mar 2011 23:12:01 +0000 (16:12 -0700)
committerEthan Jackson <ethan@nicira.com>
Thu, 31 Mar 2011 23:17:34 +0000 (16:17 -0700)
When the cfm module has never received a bad CCM message, it would
report a negative time.

lib/cfm.c

index 4e5117d5bb8d1d65c1c23d35e686f15cb66dd378..fc7486e2f905d6021122ddd6e2ff4c09850ed119 100644 (file)
--- a/lib/cfm.c
+++ b/lib/cfm.c
@@ -399,11 +399,14 @@ cfm_dump_ds(const struct cfm *cfm, struct ds *ds)
 
     ds_put_format(ds, "\tinterval: %dms\n", cfmi->ccm_interval_ms);
     ds_put_format(ds, "\ttime since CCM tx: %lldms\n", now - cfmi->ccm_sent);
-    ds_put_format(ds, "\ttime since bad CCM rx: %lldms\n",
-                  now - cfmi->x_recv_time);
     ds_put_format(ds, "\ttime since fault check: %lldms\n",
                   now - cfmi->fault_check);
 
+    if (cfmi->x_recv_time != LLONG_MIN) {
+        ds_put_format(ds, "\ttime since bad CCM rx: %lldms\n",
+                      now - cfmi->x_recv_time);
+    }
+
     ds_put_cstr(ds, "\n");
     HMAP_FOR_EACH (rmp, node, &cfm->remote_mps) {
         ds_put_format(ds, "Remote MPID %"PRIu16": %s\n", rmp->mpid,