Skip to content

Commit

Permalink
bridge: Fix interpretation of 'health' member of struct ofproto_cfm_s…
Browse files Browse the repository at this point in the history
…tatus.

Commit 9a9e378 (ofproto: Merge all the CFM query functions into one.)
mistakenly interpreted struct ofproto_cfm_status as always being in the
range [0,100].  It can in fact take the value -1 if the health status is
not currently well-defined.

Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Ethan Jackson <[email protected]>
  • Loading branch information
blp committed Mar 7, 2013
1 parent 18637fd commit 4cd9ab2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 7 additions & 2 deletions ofproto/ofproto.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,20 @@ void ofproto_free_ofproto_controller_info(struct shash *);

/* CFM status query. */
struct ofproto_cfm_status {
enum cfm_fault_reason faults; /* 0 if not faulted. */
int health; /* Health status in [0,100] range. */
/* 0 if not faulted, otherwise a combination of one or more reasons. */
enum cfm_fault_reason faults;

/* 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;

/* Ordinarily a "health status" in the range 0...100 inclusive, with 0
* being worst and 100 being best, or -1 if the health status is not
* well-defined. */
int health;

/* MPIDs of remote maintenance points whose CCMs have been received. */
const uint64_t *rmps;
size_t n_rmps;
Expand Down
6 changes: 5 additions & 1 deletion vswitchd/bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -1779,7 +1779,11 @@ iface_refresh_cfm_stats(struct iface *iface)
ovsrec_interface_set_cfm_remote_mpids(cfg,
(const int64_t *)status.rmps,
status.n_rmps);
ovsrec_interface_set_cfm_health(cfg, &cfm_health, 1);
if (cfm_health >= 0) {
ovsrec_interface_set_cfm_health(cfg, &cfm_health, 1);
} else {
ovsrec_interface_set_cfm_health(cfg, NULL, 0);
}
}
}

Expand Down

0 comments on commit 4cd9ab2

Please sign in to comment.