From b7457b40cd77e0f3e6b45a77232af64aba17aea3 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 4 Aug 2021 13:29:48 -0400 Subject: [PATCH] lib: Blackhole nexthops cannot be used as part of label generation Signed-off-by: Donald Sharp --- lib/zclient.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/zclient.c b/lib/zclient.c index f68e0e1b0c..5ca5849948 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -3442,6 +3442,14 @@ int zapi_labels_decode(struct stream *s, struct zapi_labels *zl) if (zapi_nexthop_decode(s, znh, 0, 0) < 0) return -1; + + if (znh->type == NEXTHOP_TYPE_BLACKHOLE) { + flog_warn( + EC_LIB_ZAPI_ENCODE, + "%s: Prefix %pFX has a blackhole nexthop which we cannot use for a label", + __func__, &zl->route.prefix); + return -1; + } } if (CHECK_FLAG(zl->message, ZAPI_LABELS_HAS_BACKUPS)) { @@ -3463,6 +3471,14 @@ int zapi_labels_decode(struct stream *s, struct zapi_labels *zl) if (zapi_nexthop_decode(s, znh, 0, 0) < 0) return -1; + + if (znh->type == NEXTHOP_TYPE_BLACKHOLE) { + flog_warn( + EC_LIB_ZAPI_ENCODE, + "%s: Prefix %pFX has a backup blackhole nexthop which we cannot use for a label", + __func__, &zl->route.prefix); + return -1; + } } } -- 2.39.5