]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: Fix nexthop encoding
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 18 Jan 2020 14:25:38 +0000 (09:25 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 18 Jan 2020 14:29:30 +0000 (09:29 -0500)
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 <sharpd@cumulusnetworks.com>
lib/zclient.c

index ec1082807c7dfb4bd9048f48310a0ff2d9359ddb..b2c74cd0b90875201a155cd9fa019e9947e1ebc8 100644 (file)
@@ -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);