]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Fix nexthop num
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 24 Aug 2017 12:30:08 +0000 (08:30 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 24 Aug 2017 12:30:08 +0000 (08:30 -0400)
If we assign MULTIPATH_NUM to be 256, this causes issues
for us since 256 is bigger than a u_char.  So let's make
the api's multipath_num to be a u_int16_t and pass it
around as a word.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/zclient.c
lib/zclient.h

index 75005d656b066336a1c7d29ab8f5fac749923032..72fa2679b320a7f1b1f3ee47270493af5cac24b0 100644 (file)
@@ -940,7 +940,7 @@ int zapi_route_encode(u_char cmd, struct stream *s, struct zapi_route *api)
                        api->nexthop_num = MULTIPATH_NUM;
                }
 
-               stream_putc(s, api->nexthop_num);
+               stream_putw(s, api->nexthop_num);
 
                for (i = 0; i < api->nexthop_num; i++) {
                        api_nh = &api->nexthops[i];
@@ -1047,7 +1047,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
 
        /* Nexthops. */
        if (CHECK_FLAG(api->message, ZAPI_MESSAGE_NEXTHOP)) {
-               api->nexthop_num = stream_getc(s);
+               api->nexthop_num = stream_getw(s);
                if (api->nexthop_num > MULTIPATH_NUM) {
                        zlog_warn("%s: invalid number of nexthops (%u)",
                                  __func__, api->nexthop_num);
index bae52a441bf9c055c380663bbb901de124125cd9..7c4780201e07a434c9856779448d05b61b875e29 100644 (file)
@@ -242,7 +242,7 @@ struct zapi_route {
        struct prefix prefix;
        struct prefix_ipv6 src_prefix;
 
-       u_char nexthop_num;
+       u_int16_t nexthop_num;
        struct zapi_nexthop nexthops[MULTIPATH_NUM];
 
        u_char distance;