summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2022-02-27 20:00:41 +0100
committerDonald Sharp <sharpd@nvidia.com>2022-02-28 15:50:35 +0100
commit16d91fce151c16b81fa5554de9fec89dfc16ecae (patch)
treedaced063bd28f6c95abb3cfe9d489f1c16a3f7b1 /zebra/zebra_rib.c
parentMerge pull request #9674 from leonshaw/fix/staticd-nht-reg (diff)
downloadfrr-16d91fce151c16b81fa5554de9fec89dfc16ecae.tar.xz
frr-16d91fce151c16b81fa5554de9fec89dfc16ecae.zip
zebra: Prevent crash if ZEBRA_ROUTE_ALL is used for a route type
FRR will crash when the re->type is a ZEBRA_ROUTE_ALL and it is inserted into the meta-queue. Let's just put some basic code in place to prevent a crash from happening. No routing protocol should be using ZEBRA_ROUTE_ALL as a value but bugs do happen. Let's just accept the weird route type gracefully and move on. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to '')
-rw-r--r--zebra/zebra_rib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index af159da3c..e376d4b2a 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -116,6 +116,7 @@ static const struct {
[ZEBRA_ROUTE_OPENFABRIC] = {ZEBRA_ROUTE_OPENFABRIC, 115, 5},
[ZEBRA_ROUTE_VRRP] = {ZEBRA_ROUTE_VRRP, 255, 7},
[ZEBRA_ROUTE_SRTE] = {ZEBRA_ROUTE_SRTE, 255, 7},
+ [ZEBRA_ROUTE_ALL] = {ZEBRA_ROUTE_ALL, 255, 7},
/* Any new route type added to zebra, should be mirrored here */
/* no entry/default: 150 */
@@ -4386,9 +4387,8 @@ static void check_route_info(void)
* ZEBRA_ROUTE_ALL is also ignored.
*/
for (int i = 0; i < len; i++) {
- if (i == ZEBRA_ROUTE_SYSTEM || i == ZEBRA_ROUTE_ALL)
- continue;
- assert(route_info[i].key);
+ assert(route_info[i].key >= ZEBRA_ROUTE_SYSTEM &&
+ route_info[i].key < ZEBRA_ROUTE_MAX);
assert(route_info[i].meta_q_map < MQ_SIZE);
}
}