bridge: Fix remote_opstate bug recently introduced.
authorBen Pfaff <blp@nicira.com>
Wed, 6 Mar 2013 22:47:11 +0000 (14:47 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 7 Mar 2013 00:23:27 +0000 (16:23 -0800)
Commit 9a9e3786b3a8 (ofproto: Merge all the CFM query functions into one.)
mistakenly transformed a tristate variable into a Boolean one.  This commit
fixes the problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
ofproto/ofproto.h
vswitchd/bridge.c

index a3c52b5..3ea56df 100644 (file)
@@ -363,9 +363,14 @@ void ofproto_free_ofproto_controller_info(struct shash *);
 /* CFM status query. */
 struct ofproto_cfm_status {
     enum cfm_fault_reason faults; /* 0 if not faulted. */
-    bool remote_opstate;          /* True if remote CFM endpoint is up.  */
     int health;                   /* Health status in [0,100] range. */
 
+    /* 0 if the remote CFM endpoint is operationally down,
+     * 1 if the remote CFM endpoint is operationally up,
+     * -1 if we don't know because the remote CFM endpoint is not in extended
+     * mode. */
+    int remote_opstate;
+
     /* MPIDs of remote maintenance points whose CCMs have been received. */
     const uint64_t *rmps;
     size_t n_rmps;
index b28ef26..311753d 100644 (file)
@@ -1769,8 +1769,13 @@ iface_refresh_cfm_stats(struct iface *iface)
         }
         ovsrec_interface_set_cfm_fault_status(cfg, (char **) reasons, j);
 
-        ovsrec_interface_set_cfm_remote_opstate(cfg, (status.remote_opstate
-                                                      ? "up" : "down"));
+        if (status.remote_opstate >= 0) {
+            const char *remote_opstate = status.remote_opstate ? "up" : "down";
+            ovsrec_interface_set_cfm_remote_opstate(cfg, remote_opstate);
+        } else {
+            ovsrec_interface_set_cfm_remote_opstate(cfg, NULL);
+        }
+
         ovsrec_interface_set_cfm_remote_mpids(cfg,
                                               (const int64_t *)status.rmps,
                                               status.n_rmps);