diff options
author | Dave Barach <dave@barachs.net> | 2020-02-28 09:27:07 -0500 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2020-02-28 15:33:40 +0000 |
commit | bdfdc4a480260a874de9b828723b01f119b57fbe (patch) | |
tree | 79ff8edf1698c5096a24747d65827a059e7529d3 /src/plugins/vrrp/vrrp_test.c | |
parent | fe7b8c2b4aeadaa5cf3f55b0fcc04600c91df427 (diff) |
vrrp: fix api-related coverity warnings
Type: fix
Ticket: VPP-1837
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I13c0e4771defaebccc976a6f6703493de29434dd
Diffstat (limited to 'src/plugins/vrrp/vrrp_test.c')
-rw-r--r-- | src/plugins/vrrp/vrrp_test.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/plugins/vrrp/vrrp_test.c b/src/plugins/vrrp/vrrp_test.c index 89ad712dc73..eaa0c40ecd0 100644 --- a/src/plugins/vrrp/vrrp_test.c +++ b/src/plugins/vrrp/vrrp_test.c @@ -227,12 +227,19 @@ vl_api_vrrp_vr_details_t_handler (vl_api_vrrp_vr_details_t * mp) vat_main_t *vam = vrrp_test_main.vat_main; u32 api_flags = ntohl (mp->config.flags); int i; + u32 state; char *states[] = { "VRRP_API_VR_STATE_INIT", "VRRP_API_VR_STATE_BACKUP", "VRRP_API_VR_STATE_MASTER", + "BAD STATE!", }; + state = ntohl (mp->runtime.state); + + if (state > ARRAY_LEN (states) - 2) + state = ARRAY_LEN (states) - 1; + fformat (vam->ofp, "sw_if_index %u vr_id %u IPv%d: " "priority %u interval %u preempt %s accept %s unicast %s " "state %s master_adv_interval %u skew %u master_down_interval %u " @@ -243,7 +250,7 @@ vl_api_vrrp_vr_details_t_handler (vl_api_vrrp_vr_details_t * mp) (api_flags & VRRP_API_VR_PREEMPT) ? "yes" : "no", (api_flags & VRRP_API_VR_ACCEPT) ? "yes" : "no", (api_flags & VRRP_API_VR_UNICAST) ? "yes" : "no", - states[ntohl (mp->runtime.state)], + states[state], ntohs (mp->runtime.master_adv_int), ntohs (mp->runtime.skew), ntohs (mp->runtime.master_down_int), format_ethernet_address, &mp->runtime.mac); |