]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: Add some extra safety for route_info
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 4 May 2019 00:14:39 +0000 (20:14 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 3 May 2019 09:05:19 +0000 (05:05 -0400)
The route_info[X].meta_q_map *must* be less than MQ_SIZE
or we will do some strange stuff, so assert on it at startup.

The distance in route_info is a uint8_t so let's keep the data
structure the same.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/zebra_rib.c

index 026fa41af57c0c0065407b5dca32944bb5bb2aad..10be5d8fa58bd31b598b3d152b7dc0fe2e410eec 100644 (file)
@@ -71,7 +71,7 @@ extern int allow_delete;
 /* Each route type's string and default distance value. */
 static const struct {
        int key;
-       int distance;
+       uint8_t distance;
        uint8_t meta_q_map;
 } route_info[ZEBRA_ROUTE_MAX] = {
        [ZEBRA_ROUTE_SYSTEM] = {ZEBRA_ROUTE_SYSTEM, 0, 4},
@@ -3407,6 +3407,7 @@ static void check_route_info(void)
                if (i == ZEBRA_ROUTE_SYSTEM || i == ZEBRA_ROUTE_ALL)
                        continue;
                assert(route_info[i].key);
+               assert(route_info[i].meta_q_map < MQ_SIZE);
        }
 }