From 18637fdc2e3279240b61eef5162aaff159e766d0 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 6 Mar 2013 14:47:11 -0800 Subject: [PATCH] bridge: Fix remote_opstate bug recently introduced. 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 Acked-by: Ethan Jackson --- ofproto/ofproto.h | 7 ++++++- vswitchd/bridge.c | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h index a3c52b5e4..3ea56df56 100644 --- a/ofproto/ofproto.h +++ b/ofproto/ofproto.h @@ -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; diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index b28ef26c9..311753db7 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -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); -- 2.39.5