X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fvrrp%2Fvrrp_test.c;h=eaa0c40ecd025789d092e4f6d70a81d747a5687e;hb=21cbdc75f21cde6ea83382e647c9da081d7d5f5b;hp=89ad712dc7358ba70b723fcb786da1b2d05c35a7;hpb=39e9428b90bc74d1bb15fc17759c8ef6ad712418;p=vpp.git 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);