]> git.proxmox.com Git - mirror_frr.git/commitdiff
BGP_ATTR_LABEL_INDEX fixes
authorDaniel Walton <dwalton@cumulusnetworks.com>
Wed, 26 Apr 2017 15:53:35 +0000 (15:53 +0000)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 26 Apr 2017 17:59:02 +0000 (13:59 -0400)
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
- cleaned up the "show bgp ipv4 labeled-unicast x.x.x.x" output

- fixed some json keys to use camelCase

- bgp_attr_label_index() was clearing BGP_ATTR_LABEL_INDEX because it
  was comparing mp_update->afi against SAFI_LABELED_UNICAST instead of
  mp_update->safi

- added BGP_ATTR_LABEL_INDEX to attr_str

bgpd/bgp_attr.c
bgpd/bgp_route.c

index 6f4e797a94077590b862cffe093bbc2cea7d8c43..a25ebf4772cd9a4e4635c436a0c24676329c6cdc 100644 (file)
@@ -78,7 +78,8 @@ static const struct message attr_str [] =
 #if ENABLE_BGP_VNC
   { BGP_ATTR_VNC,              "VNC" },
 #endif
-  { BGP_ATTR_LARGE_COMMUNITIES, "LARGE_COMMUNITY" }
+  { BGP_ATTR_LARGE_COMMUNITIES, "LARGE_COMMUNITY" },
+  { BGP_ATTR_LABEL_INDEX,       "LABEL_INDEX" }
 };
 static const int attr_str_max = array_size(attr_str);
 
@@ -2315,7 +2316,7 @@ bgp_attr_label_index (struct bgp_attr_parser_args *args, struct bgp_nlri *mp_upd
    * Ignore the Label index attribute unless received for labeled-unicast
    * SAFI. We reset the flag, though it is probably unnecesary.
    */
-  if (!mp_update->length || mp_update->afi != SAFI_LABELED_UNICAST)
+  if (!mp_update->length || mp_update->safi != SAFI_LABELED_UNICAST)
     {
       attr->extra->label_index = BGP_INVALID_LABEL_INDEX;
       attr->flag &= ~ATTR_FLAG_BIT(BGP_ATTR_LABEL_INDEX);
index 140003cef0bd33736ef96a7807033a9b8afd6f8f..88147e2b6843fb7fc28d41e1c9300bee353dfa24 100644 (file)
@@ -7653,33 +7653,28 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
       if (binfo->extra && binfo->extra->damp_info)
        bgp_damp_info_vty (vty, binfo, json_path);
 
+      /* Label information */
       if ((bgp_labeled_safi(safi) && binfo->extra) ||
           (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LABEL_INDEX))))
         {
-          if (!json_paths)
-            vty_out (vty, "%s      ", VTY_NEWLINE);
-
           if (bgp_labeled_safi(safi) && binfo->extra)
             {
               uint32_t label = label_pton(binfo->extra->tag);
               if (json_paths)
-                json_object_int_add(json_path, "remote-label", label);
+                json_object_int_add(json_path, "remoteLabel", label);
               else
-                vty_out(vty, "Remote label: %d, ", label);
+                vty_out(vty, "      Remote label: %d%s", label, VTY_NEWLINE);
             }
 
           if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LABEL_INDEX)))
             {
               if (json_paths)
-                json_object_int_add(json_path, "label-index", attr->extra->label_index);
+                json_object_int_add(json_path, "labelIndex", attr->extra->label_index);
               else
-                vty_out(vty, "Label Index: %d", attr->extra->label_index);
+                vty_out(vty, "      Label Index: %d%s", attr->extra->label_index, VTY_NEWLINE);
             }
         }
 
-      if (!json_paths)
-        vty_out (vty, "%s", VTY_NEWLINE);
-
       /* Line 8 display Addpath IDs */
       if (binfo->addpath_rx_id || binfo->addpath_tx_id)
         {