summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2020-05-19 17:42:36 +0200
committerGitHub <noreply@github.com>2020-05-19 17:42:36 +0200
commit0a6fd9ce9dcf3729581ce28c113cacd8232b3270 (patch)
treedd64917bf6427f5e9bbae58a92057371456881c1
parentMerge pull request #6419 from vivek-cumulus/zebra_macfdb_fixup (diff)
parentzebra: prefer outer label_type for recursive nexthops (diff)
downloadfrr-0a6fd9ce9dcf3729581ce28c113cacd8232b3270.tar.xz
frr-0a6fd9ce9dcf3729581ce28c113cacd8232b3270.zip
Merge pull request #6389 from mjstapp/fix_recursive_label_type
zebra: prefer outer label_type for recursive nexthops
-rw-r--r--zebra/zebra_nhg.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c
index fdbeac88e..1ac18c6fd 100644
--- a/zebra/zebra_nhg.c
+++ b/zebra/zebra_nhg.c
@@ -1681,17 +1681,37 @@ static void nexthop_set_resolved(afi_t afi, const struct nexthop *newhop,
/* Copy labels of the resolved route and the parent resolving to it */
if (newhop->nh_label) {
- for (i = 0; i < newhop->nh_label->num_labels; i++)
+ for (i = 0; i < newhop->nh_label->num_labels; i++) {
+ /* Be a bit picky about overrunning the local array */
+ if (num_labels >= MPLS_MAX_LABELS) {
+ if (IS_ZEBRA_DEBUG_NHG || IS_ZEBRA_DEBUG_RIB)
+ zlog_debug("%s: too many labels in newhop %pNHv",
+ __func__, newhop);
+ break;
+ }
labels[num_labels++] = newhop->nh_label->label[i];
+ }
+ /* Use the "outer" type */
label_type = newhop->nh_label_type;
}
if (nexthop->nh_label) {
- for (i = 0; i < nexthop->nh_label->num_labels; i++)
+ for (i = 0; i < nexthop->nh_label->num_labels; i++) {
+ /* Be a bit picky about overrunning the local array */
+ if (num_labels >= MPLS_MAX_LABELS) {
+ if (IS_ZEBRA_DEBUG_NHG || IS_ZEBRA_DEBUG_RIB)
+ zlog_debug("%s: too many labels in nexthop %pNHv",
+ __func__, nexthop);
+ break;
+ }
labels[num_labels++] = nexthop->nh_label->label[i];
+ }
- /* If the parent has labels, use its type */
- label_type = nexthop->nh_label_type;
+ /* If the parent has labels, use its type if
+ * we don't already have one.
+ */
+ if (label_type == ZEBRA_LSP_NONE)
+ label_type = nexthop->nh_label_type;
}
if (num_labels)