From: Donald Sharp Date: Sat, 18 Jan 2020 14:25:38 +0000 (-0500) Subject: lib: Fix nexthop encoding X-Git-Tag: frr-7.5.1~866^2~1 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=9d080116b9b439e4bee274af0bf85b07871a269e;p=mirror_frr.git lib: Fix nexthop encoding Commit 68a02e06e5f103048d947262c08c569056f74d1c broke nexthop encoding for nexthop tracking. This code combined the different types of nexthop encoding being done in the zapi protocol. What was missed that resolved nexthops of type NEXTHOP_TYPE_IPV4|6 have an ifindex value that was not being reported. This commit ensures that we always send this data( even if it is 0). The following test commit will ensure that this stays working as is expected by an upper level protocol. Signed-off-by: Donald Sharp --- diff --git a/lib/zclient.c b/lib/zclient.c index ec1082807..b2c74cd0b 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -911,8 +911,6 @@ int zapi_nexthop_encode(struct stream *s, const struct zapi_nexthop *api_nh, stream_putc(s, api_nh->bh_type); break; case NEXTHOP_TYPE_IPV4: - stream_put_in_addr(s, &api_nh->gate.ipv4); - break; case NEXTHOP_TYPE_IPV4_IFINDEX: stream_put_in_addr(s, &api_nh->gate.ipv4); stream_putl(s, api_nh->ifindex); @@ -921,9 +919,6 @@ int zapi_nexthop_encode(struct stream *s, const struct zapi_nexthop *api_nh, stream_putl(s, api_nh->ifindex); break; case NEXTHOP_TYPE_IPV6: - stream_write(s, (uint8_t *)&api_nh->gate.ipv6, - 16); - break; case NEXTHOP_TYPE_IPV6_IFINDEX: stream_write(s, (uint8_t *)&api_nh->gate.ipv6, 16); @@ -1071,9 +1066,6 @@ static int zapi_nexthop_decode(struct stream *s, struct zapi_nexthop *api_nh, STREAM_GETC(s, api_nh->bh_type); break; case NEXTHOP_TYPE_IPV4: - STREAM_GET(&api_nh->gate.ipv4.s_addr, s, - IPV4_MAX_BYTELEN); - break; case NEXTHOP_TYPE_IPV4_IFINDEX: STREAM_GET(&api_nh->gate.ipv4.s_addr, s, IPV4_MAX_BYTELEN); @@ -1083,8 +1075,6 @@ static int zapi_nexthop_decode(struct stream *s, struct zapi_nexthop *api_nh, STREAM_GETL(s, api_nh->ifindex); break; case NEXTHOP_TYPE_IPV6: - STREAM_GET(&api_nh->gate.ipv6, s, 16); - break; case NEXTHOP_TYPE_IPV6_IFINDEX: STREAM_GET(&api_nh->gate.ipv6, s, 16); STREAM_GETL(s, api_nh->ifindex);