From 2fec17cd047defee33e5a469b0c5bf9e2853a8f9 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 30 Sep 2020 18:22:33 -0400 Subject: [PATCH 1/2] lib: fix zapi_nexthop_update_decode error rc This function returns true on success and false otherwise. Returning -1 on error is equivalent to returning true. Signed-off-by: Quentin Young --- lib/zclient.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/zclient.c b/lib/zclient.c index b7d240b4e8..914b02749e 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -1765,7 +1765,7 @@ bool zapi_nexthop_update_decode(struct stream *s, struct zapi_route *nhr) for (i = 0; i < nhr->nexthop_num; i++) { if (zapi_nexthop_decode(s, &(nhr->nexthops[i]), 0, 0) != 0) - return -1; + return false; } return true; From 6c83ddedcf1a5935284be238ba09cfa3d6e7cd1e Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 30 Sep 2020 18:37:15 -0400 Subject: [PATCH 2/2] *: make failure to decode nht update an error This should never happen; no need to debug guard it and it's not a warning, if this isn't working then NHT is not working at all. Signed-off-by: Quentin Young --- bgpd/bgp_nht.c | 5 ++--- pbrd/pbr_zebra.c | 2 +- pimd/pim_nht.c | 6 ++---- sharpd/sharp_zebra.c | 3 +-- staticd/static_zebra.c | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index c89978e91b..e97c34bb5e 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -441,9 +441,8 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id) } if (!zapi_nexthop_update_decode(zclient->ibuf, &nhr)) { - if (BGP_DEBUG(nht, NHT)) - zlog_debug("%s[%s]: Failure to decode nexthop update", - __PRETTY_FUNCTION__, bgp->name_pretty); + zlog_err("%s[%s]: Failure to decode nexthop update", + __PRETTY_FUNCTION__, bgp->name_pretty); return; } diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c index 8ef675186f..866f27136e 100644 --- a/pbrd/pbr_zebra.c +++ b/pbrd/pbr_zebra.c @@ -401,7 +401,7 @@ static int pbr_zebra_nexthop_update(ZAPI_CALLBACK_ARGS) uint32_t i; if (!zapi_nexthop_update_decode(zclient->ibuf, &nhr)) { - zlog_warn("Failure to decode Nexthop update message"); + zlog_err("Failure to decode Nexthop update message"); return 0; } diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c index a888d68f09..f06d4ae605 100644 --- a/pimd/pim_nht.c +++ b/pimd/pim_nht.c @@ -735,10 +735,8 @@ int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS) pim = vrf->info; if (!zapi_nexthop_update_decode(zclient->ibuf, &nhr)) { - if (PIM_DEBUG_PIM_NHT) - zlog_debug( - "%s: Decode of nexthop update from zebra failed", - __func__); + zlog_err("%s: Decode of nexthop update from zebra failed", + __func__); return 0; } diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c index d167e8e277..231de6403d 100644 --- a/sharpd/sharp_zebra.c +++ b/sharpd/sharp_zebra.c @@ -547,8 +547,7 @@ static int sharp_nexthop_update(ZAPI_CALLBACK_ARGS) struct zapi_route nhr; if (!zapi_nexthop_update_decode(zclient->ibuf, &nhr)) { - zlog_warn("%s: Decode of update failed", __func__); - + zlog_err("%s: Decode of update failed", __func__); return 0; } diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c index 1bdbb69d00..57903daaed 100644 --- a/staticd/static_zebra.c +++ b/staticd/static_zebra.c @@ -184,7 +184,7 @@ static int static_zebra_nexthop_update(ZAPI_CALLBACK_ARGS) afi_t afi = AFI_IP; if (!zapi_nexthop_update_decode(zclient->ibuf, &nhr)) { - zlog_warn("Failure to decode nexthop update message"); + zlog_err("Failure to decode nexthop update message"); return 1; }