]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/zebra_rnh.c
Merge pull request #13455 from sri-mohan1/srib-ldpd
[mirror_frr.git] / zebra / zebra_rnh.c
index e24556122b8862a75e1031309d60d95d2a83924c..28b83ce8b6f6e139f45b47c8a3c0334cbbb95210 100644 (file)
@@ -1,21 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Zebra next hop tracking code
  * Copyright (C) 2013 Cumulus Networks, Inc.
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra 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, or (at your option) any
- * later version.
- *
- * GNU Zebra 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>
@@ -28,7 +13,7 @@
 #include "log.h"
 #include "sockunion.h"
 #include "linklist.h"
-#include "thread.h"
+#include "frrevent.h"
 #include "workqueue.h"
 #include "prefix.h"
 #include "routemap.h"
@@ -341,7 +326,7 @@ void zebra_register_rnh_pseudowire(vrf_id_t vrf_id, struct zebra_pw *pw,
 
        *nht_exists = false;
 
-       zvrf = vrf_info_lookup(vrf_id);
+       zvrf = zebra_vrf_lookup_by_id(vrf_id);
        if (!zvrf)
                return;
 
@@ -1401,7 +1386,8 @@ void show_nexthop_json_helper(json_object *json_nexthop,
                        json_object_string_addf(json_nexthop, "source", "%pI6",
                                                &nexthop->src.ipv6);
                break;
-       default:
+       case NEXTHOP_TYPE_IFINDEX:
+       case NEXTHOP_TYPE_BLACKHOLE:
                break;
        }
 
@@ -1412,8 +1398,14 @@ void show_nexthop_json_helper(json_object *json_nexthop,
                     label_index < nexthop->nh_label->num_labels; label_index++)
                        json_object_array_add(
                                json_labels,
-                               json_object_new_int(
-                                       nexthop->nh_label->label[label_index]));
+                               json_object_new_int((
+                                       (nexthop->nh_label_type ==
+                                        ZEBRA_LSP_EVPN)
+                                               ? label2vni(
+                                                         &nexthop->nh_label->label
+                                                                  [label_index])
+                                               : nexthop->nh_label->label
+                                                         [label_index])));
 
                json_object_object_add(json_nexthop, "labels", json_labels);
        }
@@ -1523,7 +1515,8 @@ void show_route_nexthop_helper(struct vty *vty, const struct route_entry *re,
                if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any))
                        vty_out(vty, ", src %pI6", &nexthop->src.ipv6);
                break;
-       default:
+       case NEXTHOP_TYPE_IFINDEX:
+       case NEXTHOP_TYPE_BLACKHOLE:
                break;
        }
 
@@ -1532,18 +1525,22 @@ void show_route_nexthop_helper(struct vty *vty, const struct route_entry *re,
                vty_out(vty, ", label %s",
                        mpls_label2str(nexthop->nh_label->num_labels,
                                       nexthop->nh_label->label, buf,
-                                      sizeof(buf), 1));
+                                      sizeof(buf), nexthop->nh_label_type, 1));
        }
 
        if (nexthop->nh_srv6) {
                seg6local_context2str(buf, sizeof(buf),
                                      &nexthop->nh_srv6->seg6local_ctx,
                                      nexthop->nh_srv6->seg6local_action);
-               vty_out(vty, ", seg6local %s %s",
-                       seg6local_action2str(
-                               nexthop->nh_srv6->seg6local_action),
-                       buf);
-               vty_out(vty, ", seg6 %pI6", &nexthop->nh_srv6->seg6_segs);
+               if (nexthop->nh_srv6->seg6local_action !=
+                   ZEBRA_SEG6_LOCAL_ACTION_UNSPEC)
+                       vty_out(vty, ", seg6local %s %s",
+                               seg6local_action2str(
+                                       nexthop->nh_srv6->seg6local_action),
+                               buf);
+               if (IPV6_ADDR_CMP(&nexthop->nh_srv6->seg6_segs, &in6addr_any))
+                       vty_out(vty, ", seg6 %pI6",
+                               &nexthop->nh_srv6->seg6_segs);
        }
 
        if (nexthop->weight)