summaryrefslogtreecommitdiff
path: root/lib/mpls.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mpls.c')
-rw-r--r--lib/mpls.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/lib/mpls.c b/lib/mpls.c
index ac5792a686..8c656f78ff 100644
--- a/lib/mpls.c
+++ b/lib/mpls.c
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* mpls functions
*
* Copyright (C) 2018 Cumulus Networks, Inc.
* Donald Sharp
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
#include <mpls.h>
@@ -80,7 +67,7 @@ int mpls_str2label(const char *label_str, uint8_t *num_labels,
* Label to string conversion, labels in string separated by '/'.
*/
char *mpls_label2str(uint8_t num_labels, const mpls_label_t *labels, char *buf,
- int len, int pretty)
+ int len, enum lsp_types_t type, int pretty)
{
char label_buf[BUFSIZ];
int i;
@@ -90,9 +77,14 @@ char *mpls_label2str(uint8_t num_labels, const mpls_label_t *labels, char *buf,
if (i != 0)
strlcat(buf, "/", len);
if (pretty)
- label2str(labels[i], label_buf, sizeof(label_buf));
+ label2str(labels[i], type, label_buf,
+ sizeof(label_buf));
else
- snprintf(label_buf, sizeof(label_buf), "%u", labels[i]);
+ snprintf(label_buf, sizeof(label_buf), "%u",
+ ((type == ZEBRA_LSP_EVPN)
+ ? label2vni(&labels[i])
+ : labels[i]));
+
strlcat(buf, label_buf, len);
}