]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: fix vni table output broken by 8304dabfab906
authorStephen Worley <sworley@nvidia.com>
Fri, 7 Oct 2022 21:04:39 +0000 (17:04 -0400)
committerStephen Worley <sworley@nvidia.com>
Tue, 11 Oct 2022 20:18:21 +0000 (16:18 -0400)
Fix vni table output broken by 8304dabfab9063fe5720e8e714476ed2e9127540

The "Imported from" output was not getting delimitted by a newline
after the mentioned commit. This fixes that and retains the output
wanted by the original change.

Before:

'''
  Route [2]:[0]:[48]:[b6:3a:cc:d5:a1:cd]:[128]:[fe80::b43a:ccff:fed5:a1cd] VNI 30/10  Imported from 2.2.2.2:4:[2]:[0]:[48]:[b6:3a:cc:d5:a1:cd]:[128]:[fe80::b43a:ccff:fed5:a1cd], VNI 30/10

  2
    2.2.2.2(alfred) from alfred(veth1) (2.2.2.2)
      Origin IGP, valid, external, bestpath-from-AS 2, best (First path received)
      Extended Community: RT:2:30 ET:8
      Last update: Fri Oct  7 16:04:59 2022
'''

After:

'''
  Route [2]:[0]:[48]:[b2:cf:96:70:4f:b6]:[128]:[fe80::b0cf:96ff:fe70:4fb6] VNI 30/10
  Imported from 2.2.2.2:4:[2]:[0]:[48]:[b2:cf:96:70:4f:b6]:[128]:[fe80::b0cf:96ff:fe70:4fb6], VNI 30/10
  2
    2.2.2.2(alfred) from alfred(veth1) (2.2.2.2)
      Origin IGP, valid, external, bestpath-from-AS 2, best (First path received)
      Extended Community: RT:2:30 ET:8
      Last update: Fri Oct  7 17:02:28 2022
'''

Signed-off-by: Stephen Worley <sworley@nvidia.com>
bgpd/bgp_route.c

index 7ec24845726ded81a93dd7501eb896abada81fc4..839d3fb1e4dc4138c75546215ee140d63b9d900a 100644 (file)
@@ -10010,6 +10010,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
 {
        char buf[INET6_ADDRSTRLEN];
        char buf1[BUFSIZ];
+       char tag_buf[30];
        struct attr *attr = path->attr;
        time_t tbuf;
        json_object *json_bestpath = NULL;
@@ -10040,6 +10041,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
        uint32_t bos = 0;
        uint32_t exp = 0;
        mpls_label_t label = MPLS_INVALID_LABEL;
+       tag_buf[0] = '\0';
 
        if (json_paths) {
                json_path = json_object_new_object();
@@ -10053,9 +10055,6 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
        }
 
        if (path->extra) {
-               char tag_buf[30];
-
-               tag_buf[0] = '\0';
                if (path->extra && path->extra->num_labels) {
                        bgp_evpn_label2str(path->extra->label,
                                           path->extra->num_labels, tag_buf,
@@ -10074,44 +10073,6 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
                                }
                        }
                }
-
-               if (path->extra && path->extra->parent && !json_paths) {
-                       struct bgp_path_info *parent_ri;
-                       struct bgp_dest *dest, *pdest;
-
-                       parent_ri = (struct bgp_path_info *)path->extra->parent;
-                       dest = parent_ri->net;
-                       if (dest && dest->pdest) {
-                               pdest = dest->pdest;
-                               if (is_pi_family_evpn(parent_ri)) {
-                                       vty_out(vty,
-                                               "  Imported from %pRD:%pFX, VNI %s",
-                                               (struct prefix_rd *)
-                                                       bgp_dest_get_prefix(
-                                                               pdest),
-                                               (struct prefix_evpn *)
-                                                       bgp_dest_get_prefix(
-                                                               dest),
-                                               tag_buf);
-                                       if (attr->es_flags & ATTR_ES_L3_NHG)
-                                               vty_out(vty, ", L3NHG %s",
-                                                       (attr->es_flags
-                                                        & ATTR_ES_L3_NHG_ACTIVE)
-                                                               ? "active"
-                                                               : "inactive");
-                                       vty_out(vty, "\n");
-
-                               } else
-                                       vty_out(vty,
-                                               "  Imported from %pRD:%pFX\n",
-                                               (struct prefix_rd *)
-                                                       bgp_dest_get_prefix(
-                                                               pdest),
-                                               (struct prefix_evpn *)
-                                                       bgp_dest_get_prefix(
-                                                               dest));
-                       }
-               }
        }
 
        if (safi == SAFI_EVPN
@@ -10131,6 +10092,40 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
        if (safi == SAFI_EVPN && !json_path)
                vty_out(vty, "\n");
 
+
+       if (path->extra && path->extra->parent && !json_paths) {
+               struct bgp_path_info *parent_ri;
+               struct bgp_dest *dest, *pdest;
+
+               parent_ri = (struct bgp_path_info *)path->extra->parent;
+               dest = parent_ri->net;
+               if (dest && dest->pdest) {
+                       pdest = dest->pdest;
+                       if (is_pi_family_evpn(parent_ri)) {
+                               vty_out(vty,
+                                       "  Imported from %pRD:%pFX, VNI %s",
+                                       (struct prefix_rd *)bgp_dest_get_prefix(
+                                               pdest),
+                                       (struct prefix_evpn *)
+                                               bgp_dest_get_prefix(dest),
+                                       tag_buf);
+                               if (attr->es_flags & ATTR_ES_L3_NHG)
+                                       vty_out(vty, ", L3NHG %s",
+                                               (attr->es_flags &
+                                                ATTR_ES_L3_NHG_ACTIVE)
+                                                       ? "active"
+                                                       : "inactive");
+                               vty_out(vty, "\n");
+
+                       } else
+                               vty_out(vty, "  Imported from %pRD:%pFX\n",
+                                       (struct prefix_rd *)bgp_dest_get_prefix(
+                                               pdest),
+                                       (struct prefix_evpn *)
+                                               bgp_dest_get_prefix(dest));
+               }
+       }
+
        /* Line1 display AS-path, Aggregator */
        if (attr->aspath) {
                if (json_paths) {