]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/mpls.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / lib / mpls.c
index ac5792a6864c8b1852be5c79596c81b4decf4148..8c656f78fffb29d2d95803697c848f888acce9d4 100644 (file)
@@ -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);
        }