]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: remove some deep nesting
authorDavid Lamparter <equinox@opensourcerouting.org>
Sun, 27 Aug 2017 20:51:35 +0000 (22:51 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 29 Aug 2017 06:36:03 +0000 (08:36 +0200)
Some of this was so egregiously stupid, I couldn't look at it without
gouging my eyes out...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
bgpd/bgp_evpn_vty.c
bgpd/bgp_route.c
bgpd/bgp_vty.c

index 1467083c01d3f9adef839846262f2d6f529ec810..809ffa72ce7cf3f0a999a08be8632994684600bc 100644 (file)
@@ -375,155 +375,150 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
                if (prd && memcmp(rn->p.u.val, prd->val, 8) != 0)
                        continue;
 
-               if ((table = rn->info) != NULL) {
-                       rd_header = 1;
-
-                       for (rm = bgp_table_top(table); rm;
-                            rm = bgp_route_next(rm))
-                               for (ri = rm->info; ri; ri = ri->next) {
-                                       total_count++;
-                                       if (type == bgp_show_type_neighbor) {
-                                               union sockunion *su =
-                                                       output_arg;
-
-                                               if (ri->peer->su_remote == NULL
-                                                   || !sockunion_same(
-                                                              ri->peer->su_remote,
-                                                              su))
-                                                       continue;
-                                       }
-                                       if (header == 0) {
-                                               if (use_json) {
-                                                       if (option
-                                                           == SHOW_DISPLAY_TAGS) {
-                                                               json_object_int_add(
-                                                                       json,
-                                                                       "bgpTableVersion",
-                                                                       0);
-                                                               json_object_string_add(
-                                                                       json,
-                                                                       "bgpLocalRouterId",
-                                                                       inet_ntoa(
-                                                                               bgp->router_id));
-                                                               json_object_object_add(
-                                                                       json,
-                                                                       "bgpStatusCodes",
-                                                                       json_scode);
-                                                               json_object_object_add(
-                                                                       json,
-                                                                       "bgpOriginCodes",
-                                                                       json_ocode);
-                                                       }
-                                               } else {
-                                                       if (option
-                                                           == SHOW_DISPLAY_TAGS)
-                                                               vty_out(vty,
-                                                                       V4_HEADER_TAG);
-                                                       else if (
-                                                               option
-                                                               == SHOW_DISPLAY_OVERLAY)
-                                                               vty_out(vty,
-                                                                       V4_HEADER_OVERLAY);
-                                                       else {
-                                                               vty_out(vty,
-                                                                       "BGP table version is 0, local router ID is %s\n",
-                                                                       inet_ntoa(
-                                                                               bgp->router_id));
-                                                               vty_out(vty,
-                                                                       "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal\n");
-                                                               vty_out(vty,
-                                                                       "Origin codes: i - IGP, e - EGP, ? - incomplete\n\n");
-                                                               vty_out(vty,
-                                                                       V4_HEADER);
-                                                       }
-                                               }
-                                               header = 0;
-                                       }
-                                       if (rd_header) {
-                                               u_int16_t type;
-                                               struct rd_as rd_as;
-                                               struct rd_ip rd_ip;
-                                               u_char *pnt;
+               if ((table = rn->info) == NULL)
+                       continue;
 
-                                               pnt = rn->p.u.val;
+               rd_header = 1;
 
-                                               /* Decode RD type. */
-                                               type = decode_rd_type(pnt);
-                                               /* Decode RD value. */
-                                               if (type == RD_TYPE_AS)
-                                                       decode_rd_as(pnt + 2,
-                                                                    &rd_as);
-                                               else if (type == RD_TYPE_AS4)
-                                                       decode_rd_as4(pnt + 2,
-                                                                     &rd_as);
-                                               else if (type == RD_TYPE_IP)
-                                                       decode_rd_ip(pnt + 2,
-                                                                    &rd_ip);
-                                               if (use_json) {
-                                                       char buffer[BUFSIZ];
-                                                       if (type == RD_TYPE_AS
-                                                           || type == RD_TYPE_AS4)
-                                                               sprintf(buffer,
-                                                                       "%u:%d",
-                                                                       rd_as.as,
-                                                                       rd_as.val);
-                                                       else if (type
-                                                                == RD_TYPE_IP)
-                                                               sprintf(buffer,
-                                                                       "%s:%d",
-                                                                       inet_ntoa(
-                                                                               rd_ip.ip),
-                                                                       rd_ip.val);
+               for (rm = bgp_table_top(table); rm;
+                    rm = bgp_route_next(rm))
+                       for (ri = rm->info; ri; ri = ri->next) {
+                               total_count++;
+                               if (type == bgp_show_type_neighbor) {
+                                       union sockunion *su =
+                                               output_arg;
+
+                                       if (ri->peer->su_remote == NULL
+                                           || !sockunion_same(
+                                                      ri->peer->su_remote,
+                                                      su))
+                                               continue;
+                               }
+                               if (header == 0) {
+                                       if (use_json) {
+                                               if (option
+                                                   == SHOW_DISPLAY_TAGS) {
+                                                       json_object_int_add(
+                                                               json,
+                                                               "bgpTableVersion",
+                                                               0);
                                                        json_object_string_add(
-                                                               json_nroute,
-                                                               "routeDistinguisher",
-                                                               buffer);
-                                               } else {
+                                                               json,
+                                                               "bgpLocalRouterId",
+                                                               inet_ntoa(
+                                                                       bgp->router_id));
+                                                       json_object_object_add(
+                                                               json,
+                                                               "bgpStatusCodes",
+                                                               json_scode);
+                                                       json_object_object_add(
+                                                               json,
+                                                               "bgpOriginCodes",
+                                                               json_ocode);
+                                               }
+                                       } else {
+                                               if (option
+                                                   == SHOW_DISPLAY_TAGS)
+                                                       vty_out(vty,
+                                                               V4_HEADER_TAG);
+                                               else if (
+                                                       option
+                                                       == SHOW_DISPLAY_OVERLAY)
+                                                       vty_out(vty,
+                                                               V4_HEADER_OVERLAY);
+                                               else {
+                                                       vty_out(vty,
+                                                               "BGP table version is 0, local router ID is %s\n",
+                                                               inet_ntoa(
+                                                                       bgp->router_id));
+                                                       vty_out(vty,
+                                                               "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal\n");
                                                        vty_out(vty,
-                                                               "Route Distinguisher: ");
-                                                       if (type == RD_TYPE_AS)
-                                                               vty_out(vty,
-                                                                       "as2 %u:%d",
-                                                                       rd_as.as,
-                                                                       rd_as.val);
-                                                       else if (type
-                                                                == RD_TYPE_AS4)
-                                                               vty_out(vty,
-                                                                       "as4 %u:%d",
-                                                                       rd_as.as,
-                                                                       rd_as.val);
-                                                       else if (type
-                                                                == RD_TYPE_IP)
-                                                               vty_out(vty,
-                                                                       "ip %s:%d",
-                                                                       inet_ntoa(
-                                                                               rd_ip.ip),
-                                                                       rd_ip.val);
-                                                       vty_out(vty, "\n\n");
+                                                               "Origin codes: i - IGP, e - EGP, ? - incomplete\n\n");
+                                                       vty_out(vty,
+                                                               V4_HEADER);
                                                }
-                                               rd_header = 0;
                                        }
-                                       if (use_json)
-                                               json_array =
-                                                       json_object_new_array();
-                                       else
-                                               json_array = NULL;
-                                       if (option == SHOW_DISPLAY_TAGS)
-                                               route_vty_out_tag(
-                                                       vty, &rm->p, ri, 0,
-                                                       SAFI_EVPN, json_array);
-                                       else if (option == SHOW_DISPLAY_OVERLAY)
-                                               route_vty_out_overlay(
-                                                       vty, &rm->p, ri, 0,
-                                                       json_array);
-                                       else
-                                               route_vty_out(vty, &rm->p, ri,
-                                                             0, SAFI_EVPN,
-                                                             json_array);
-                                       output_count++;
+                                       header = 0;
                                }
-                       /* XXX json */
-               }
+                               if (rd_header) {
+                                       u_int16_t type;
+                                       struct rd_as rd_as;
+                                       struct rd_ip rd_ip;
+                                       u_char *pnt;
+
+                                       pnt = rn->p.u.val;
+
+                                       /* Decode RD type. */
+                                       type = decode_rd_type(pnt);
+                                       /* Decode RD value. */
+                                       if (type == RD_TYPE_AS)
+                                               decode_rd_as(pnt + 2, &rd_as);
+                                       else if (type == RD_TYPE_AS4)
+                                               decode_rd_as4(pnt + 2, &rd_as);
+                                       else if (type == RD_TYPE_IP)
+                                               decode_rd_ip(pnt + 2, &rd_ip);
+                                       if (use_json) {
+                                               char buffer[BUFSIZ];
+                                               if (type == RD_TYPE_AS
+                                                   || type == RD_TYPE_AS4)
+                                                       sprintf(buffer,
+                                                               "%u:%d",
+                                                               rd_as.as,
+                                                               rd_as.val);
+                                               else if (type
+                                                        == RD_TYPE_IP)
+                                                       sprintf(buffer,
+                                                               "%s:%d",
+                                                               inet_ntoa(
+                                                                       rd_ip.ip),
+                                                               rd_ip.val);
+                                               json_object_string_add(
+                                                       json_nroute,
+                                                       "routeDistinguisher",
+                                                       buffer);
+                                       } else {
+                                               vty_out(vty,
+                                                       "Route Distinguisher: ");
+                                               if (type == RD_TYPE_AS)
+                                                       vty_out(vty,
+                                                               "as2 %u:%d",
+                                                               rd_as.as,
+                                                               rd_as.val);
+                                               else if (type
+                                                        == RD_TYPE_AS4)
+                                                       vty_out(vty,
+                                                               "as4 %u:%d",
+                                                               rd_as.as,
+                                                               rd_as.val);
+                                               else if (type
+                                                        == RD_TYPE_IP)
+                                                       vty_out(vty,
+                                                               "ip %s:%d",
+                                                               inet_ntoa(
+                                                                       rd_ip.ip),
+                                                               rd_ip.val);
+                                               vty_out(vty, "\n\n");
+                                       }
+                                       rd_header = 0;
+                               }
+                               if (use_json)
+                                       json_array = json_object_new_array();
+                               else
+                                       json_array = NULL;
+                               if (option == SHOW_DISPLAY_TAGS)
+                                       route_vty_out_tag(vty, &rm->p, ri, 0,
+                                                         SAFI_EVPN,
+                                                         json_array);
+                               else if (option == SHOW_DISPLAY_OVERLAY)
+                                       route_vty_out_overlay(vty, &rm->p, ri,
+                                                             0, json_array);
+                               else
+                                       route_vty_out(vty, &rm->p, ri, 0,
+                                                     SAFI_EVPN, json_array);
+                               output_count++;
+                       }
+               /* XXX json */
        }
        if (output_count == 0)
                vty_out(vty, "No prefixes displayed, %ld exist\n", total_count);
index 814efdb4e6b0483d422d8fcf5cc7d5fcc0c7eaf6..a2097f461e646400c94d8ee7a154711a67a048de 100644 (file)
@@ -3391,21 +3391,22 @@ static void bgp_soft_reconfig_table(struct peer *peer, afi_t afi, safi_t safi,
 
        for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn))
                for (ain = rn->adj_in; ain; ain = ain->next) {
-                       if (ain->peer == peer) {
-                               struct bgp_info *ri = rn->info;
-                               mpls_label_t label =
-                                       (ri && ri->extra) ? ri->extra->label
-                                                         : MPLS_INVALID_LABEL;
+                       if (ain->peer != peer)
+                               continue;
 
-                               ret = bgp_update(
-                                       peer, &rn->p, ain->addpath_rx_id,
-                                       ain->attr, afi, safi, ZEBRA_ROUTE_BGP,
-                                       BGP_ROUTE_NORMAL, prd, &label, 1, NULL);
+                       struct bgp_info *ri = rn->info;
+                       mpls_label_t label =
+                               (ri && ri->extra) ? ri->extra->label
+                                                 : MPLS_INVALID_LABEL;
 
-                               if (ret < 0) {
-                                       bgp_unlock_node(rn);
-                                       return;
-                               }
+                       ret = bgp_update(peer, &rn->p, ain->addpath_rx_id,
+                                        ain->attr, afi, safi, ZEBRA_ROUTE_BGP,
+                                        BGP_ROUTE_NORMAL, prd, &label, 1,
+                                        NULL);
+
+                       if (ret < 0) {
+                               bgp_unlock_node(rn);
+                               return;
                        }
                }
 }
@@ -3454,24 +3455,25 @@ static wq_item_status bgp_clear_route_node(struct work_queue *wq, void *data)
        /* It is possible that we have multiple paths for a prefix from a peer
         * if that peer is using AddPath.
         */
-       for (ri = rn->info; ri; ri = ri->next)
-               if (ri->peer == peer) {
-                       /* graceful restart STALE flag set. */
-                       if (CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT)
-                           && peer->nsf[afi][safi]
-                           && !CHECK_FLAG(ri->flags, BGP_INFO_STALE)
-                           && !CHECK_FLAG(ri->flags, BGP_INFO_UNUSEABLE))
-                               bgp_info_set_flag(rn, ri, BGP_INFO_STALE);
-                       else {
-                               /* If this is an EVPN route, process for
-                                * un-import. */
-                               if (safi == SAFI_EVPN)
-                                       bgp_evpn_unimport_route(peer->bgp, afi,
-                                                               safi, &rn->p,
-                                                               ri);
-                               bgp_rib_remove(rn, ri, peer, afi, safi);
-                       }
+       for (ri = rn->info; ri; ri = ri->next) {
+               if (ri->peer != peer)
+                       continue;
+
+               /* graceful restart STALE flag set. */
+               if (CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT)
+                   && peer->nsf[afi][safi]
+                   && !CHECK_FLAG(ri->flags, BGP_INFO_STALE)
+                   && !CHECK_FLAG(ri->flags, BGP_INFO_UNUSEABLE))
+                       bgp_info_set_flag(rn, ri, BGP_INFO_STALE);
+               else {
+                       /* If this is an EVPN route, process for
+                        * un-import. */
+                       if (safi == SAFI_EVPN)
+                               bgp_evpn_unimport_route(peer->bgp, afi, safi,
+                                                       &rn->p, ri);
+                       bgp_rib_remove(rn, ri, peer, afi, safi);
                }
+       }
        return WQ_SUCCESS;
 }
 
@@ -3705,34 +3707,33 @@ void bgp_clear_stale_route(struct peer *peer, afi_t afi, safi_t safi)
                        struct bgp_info *ri;
 
                        /* look for neighbor in tables */
-                       if ((table = rn->info) != NULL) {
-                               for (rm = bgp_table_top(table); rm;
-                                    rm = bgp_route_next(rm))
-                                       for (ri = rm->info; ri; ri = ri->next)
-                                               if (ri->peer == peer) {
-                                                       if (CHECK_FLAG(
-                                                                   ri->flags,
-                                                                   BGP_INFO_STALE))
-                                                               bgp_rib_remove(
-                                                                       rm, ri,
-                                                                       peer,
-                                                                       afi,
-                                                                       safi);
-                                                       break;
-                                               }
-                       }
+                       if ((table = rn->info) == NULL)
+                               continue;
+
+                       for (rm = bgp_table_top(table); rm;
+                            rm = bgp_route_next(rm))
+                               for (ri = rm->info; ri; ri = ri->next) {
+                                       if (ri->peer != peer)
+                                               continue;
+                                       if (!CHECK_FLAG(ri->flags,
+                                                       BGP_INFO_STALE))
+                                               break;
+
+                                       bgp_rib_remove(rm, ri, peer, afi, safi);
+                                       break;
+                               }
                }
        } else {
                for (rn = bgp_table_top(peer->bgp->rib[afi][safi]); rn;
                     rn = bgp_route_next(rn))
-                       for (ri = rn->info; ri; ri = ri->next)
-                               if (ri->peer == peer) {
-                                       if (CHECK_FLAG(ri->flags,
-                                                      BGP_INFO_STALE))
-                                               bgp_rib_remove(rn, ri, peer,
-                                                              afi, safi);
+                       for (ri = rn->info; ri; ri = ri->next) {
+                               if (ri->peer != peer)
+                                       continue;
+                               if (!CHECK_FLAG(ri->flags, BGP_INFO_STALE))
                                        break;
-                               }
+                               bgp_rib_remove(rn, ri, peer, afi, safi);
+                               break;
+                       }
        }
 }
 
@@ -4556,28 +4557,30 @@ void bgp_static_add(struct bgp *bgp)
        for (afi = AFI_IP; afi < AFI_MAX; afi++)
                for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
                        for (rn = bgp_table_top(bgp->route[afi][safi]); rn;
-                            rn = bgp_route_next(rn))
-                               if (rn->info != NULL) {
-                                       if ((safi == SAFI_MPLS_VPN)
-                                           || (safi == SAFI_ENCAP)
-                                           || (safi == SAFI_EVPN)) {
-                                               table = rn->info;
-
-                                               for (rm = bgp_table_top(table);
-                                                    rm;
-                                                    rm = bgp_route_next(rm)) {
-                                                       bgp_static = rm->info;
-                                                       bgp_static_update_safi(
-                                                               bgp, &rm->p,
-                                                               bgp_static, afi,
-                                                               safi);
-                                               }
-                                       } else {
-                                               bgp_static_update(bgp, &rn->p,
-                                                                 rn->info, afi,
-                                                                 safi);
+                            rn = bgp_route_next(rn)) {
+                               if (rn->info == NULL)
+                                       continue;
+
+                               if ((safi == SAFI_MPLS_VPN)
+                                   || (safi == SAFI_ENCAP)
+                                   || (safi == SAFI_EVPN)) {
+                                       table = rn->info;
+
+                                       for (rm = bgp_table_top(table);
+                                            rm;
+                                            rm = bgp_route_next(rm)) {
+                                               bgp_static = rm->info;
+                                               bgp_static_update_safi(
+                                                       bgp, &rm->p,
+                                                       bgp_static, afi,
+                                                       safi);
                                        }
+                               } else {
+                                       bgp_static_update(bgp, &rn->p,
+                                                         rn->info, afi,
+                                                         safi);
                                }
+                       }
 }
 
 /* Called from bgp_delete().  Delete all static routes from the BGP
@@ -4594,37 +4597,38 @@ void bgp_static_delete(struct bgp *bgp)
        for (afi = AFI_IP; afi < AFI_MAX; afi++)
                for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
                        for (rn = bgp_table_top(bgp->route[afi][safi]); rn;
-                            rn = bgp_route_next(rn))
-                               if (rn->info != NULL) {
-                                       if ((safi == SAFI_MPLS_VPN)
-                                           || (safi == SAFI_ENCAP)
-                                           || (safi == SAFI_EVPN)) {
-                                               table = rn->info;
-
-                                               for (rm = bgp_table_top(table);
-                                                    rm;
-                                                    rm = bgp_route_next(rm)) {
-                                                       bgp_static = rm->info;
-                                                       bgp_static_withdraw_safi(
-                                                               bgp, &rm->p,
-                                                               AFI_IP, safi,
-                                                               (struct
-                                                                prefix_rd *)&rn
-                                                                       ->p);
-                                                       bgp_static_free(
-                                                               bgp_static);
-                                                       rn->info = NULL;
-                                                       bgp_unlock_node(rn);
-                                               }
-                                       } else {
-                                               bgp_static = rn->info;
-                                               bgp_static_withdraw(bgp, &rn->p,
-                                                                   afi, safi);
+                            rn = bgp_route_next(rn)) {
+                               if (rn->info == NULL)
+                                       continue;
+
+                               if ((safi == SAFI_MPLS_VPN)
+                                   || (safi == SAFI_ENCAP)
+                                   || (safi == SAFI_EVPN)) {
+                                       table = rn->info;
+
+                                       for (rm = bgp_table_top(table);
+                                            rm;
+                                            rm = bgp_route_next(rm)) {
+                                               bgp_static = rm->info;
+                                               bgp_static_withdraw_safi(
+                                                       bgp, &rm->p,
+                                                       AFI_IP, safi,
+                                                       (struct
+                                                        prefix_rd *)&rn
+                                                               ->p);
                                                bgp_static_free(bgp_static);
                                                rn->info = NULL;
                                                bgp_unlock_node(rn);
                                        }
+                               } else {
+                                       bgp_static = rn->info;
+                                       bgp_static_withdraw(bgp, &rn->p,
+                                                           afi, safi);
+                                       bgp_static_free(bgp_static);
+                                       rn->info = NULL;
+                                       bgp_unlock_node(rn);
                                }
+                       }
 }
 
 void bgp_static_redo_import_check(struct bgp *bgp)
@@ -4641,29 +4645,31 @@ void bgp_static_redo_import_check(struct bgp *bgp)
        for (afi = AFI_IP; afi < AFI_MAX; afi++)
                for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
                        for (rn = bgp_table_top(bgp->route[afi][safi]); rn;
-                            rn = bgp_route_next(rn))
-                               if (rn->info != NULL) {
-                                       if ((safi == SAFI_MPLS_VPN)
-                                           || (safi == SAFI_ENCAP)
-                                           || (safi == SAFI_EVPN)) {
-                                               table = rn->info;
-
-                                               for (rm = bgp_table_top(table);
-                                                    rm;
-                                                    rm = bgp_route_next(rm)) {
-                                                       bgp_static = rm->info;
-                                                       bgp_static_update_safi(
-                                                               bgp, &rm->p,
-                                                               bgp_static, afi,
-                                                               safi);
-                                               }
-                                       } else {
-                                               bgp_static = rn->info;
-                                               bgp_static_update(bgp, &rn->p,
-                                                                 bgp_static,
-                                                                 afi, safi);
+                            rn = bgp_route_next(rn)) {
+                               if (rn->info == NULL)
+                                       continue;
+
+                               if ((safi == SAFI_MPLS_VPN)
+                                   || (safi == SAFI_ENCAP)
+                                   || (safi == SAFI_EVPN)) {
+                                       table = rn->info;
+
+                                       for (rm = bgp_table_top(table);
+                                            rm;
+                                            rm = bgp_route_next(rm)) {
+                                               bgp_static = rm->info;
+                                               bgp_static_update_safi(
+                                                       bgp, &rm->p,
+                                                       bgp_static, afi,
+                                                       safi);
                                        }
+                               } else {
+                                       bgp_static = rn->info;
+                                       bgp_static_update(bgp, &rn->p,
+                                                         bgp_static,
+                                                         afi, safi);
                                }
+                       }
        bgp_flag_unset(bgp, BGP_FLAG_FORCE_STATIC_PROCESS);
 }
 
@@ -5684,83 +5690,76 @@ static void bgp_aggregate_add(struct bgp *bgp, struct prefix *p, afi_t afi,
        /* If routes exists below this node, generate aggregate routes. */
        top = bgp_node_get(table, p);
        for (rn = bgp_node_get(table, p); rn;
-            rn = bgp_route_next_until(rn, top))
-               if (rn->p.prefixlen > p->prefixlen) {
-                       match = 0;
+            rn = bgp_route_next_until(rn, top)) {
+               if (rn->p.prefixlen <= p->prefixlen)
+                       continue;
 
-                       for (ri = rn->info; ri; ri = ri->next) {
-                               if (BGP_INFO_HOLDDOWN(ri))
-                                       continue;
+               match = 0;
 
-                               if (ri->attr->flag
-                                   & ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE))
-                                       atomic_aggregate = 1;
+               for (ri = rn->info; ri; ri = ri->next) {
+                       if (BGP_INFO_HOLDDOWN(ri))
+                               continue;
 
-                               if (ri->sub_type != BGP_ROUTE_AGGREGATE) {
-                                       /* summary-only aggregate route suppress
-                                          aggregated
-                                          route announcement.  */
-                                       if (aggregate->summary_only) {
-                                               (bgp_info_extra_get(ri))
-                                                       ->suppress++;
-                                               bgp_info_set_flag(
-                                                       rn, ri,
-                                                       BGP_INFO_ATTR_CHANGED);
-                                               match++;
-                                       }
+                       if (ri->attr->flag
+                           & ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE))
+                               atomic_aggregate = 1;
 
-                                       /* If at least one route among routes
-                                        * that are aggregated has
-                                        * ORIGIN with the value INCOMPLETE,
-                                        * then the aggregated route
-                                        * MUST have the ORIGIN attribute with
-                                        * the value INCOMPLETE.
-                                        * Otherwise, if at least one route
-                                        * among routes that are
-                                        * aggregated has ORIGIN with the value
-                                        * EGP, then the aggregated
-                                        * route MUST have the ORIGIN attribute
-                                        * with the value EGP.
-                                        */
-                                       if (origin < ri->attr->origin)
-                                               origin = ri->attr->origin;
+                       if (ri->sub_type == BGP_ROUTE_AGGREGATE)
+                               continue;
 
-                                       /* as-set aggregate route generate
-                                          origin, as path,
-                                          community aggregation.  */
-                                       if (aggregate->as_set) {
-                                               if (aspath) {
-                                                       asmerge = aspath_aggregate(
-                                                               aspath,
-                                                               ri->attr->aspath);
-                                                       aspath_free(aspath);
-                                                       aspath = asmerge;
-                                               } else
-                                                       aspath = aspath_dup(
-                                                               ri->attr->aspath);
+                       /* summary-only aggregate route suppress
+                        * aggregated route announcement.  */
+                       if (aggregate->summary_only) {
+                               (bgp_info_extra_get(ri))->suppress++;
+                               bgp_info_set_flag(rn, ri,
+                                                 BGP_INFO_ATTR_CHANGED);
+                               match++;
+                       }
 
-                                               if (ri->attr->community) {
-                                                       if (community) {
-                                                               commerge = community_merge(
-                                                                       community,
-                                                                       ri->attr->community);
-                                                               community = community_uniq_sort(
-                                                                       commerge);
-                                                               community_free(
-                                                                       commerge);
-                                                       } else
-                                                               community = community_dup(
-                                                                       ri->attr->community);
-                                               }
-                                       }
-                                       aggregate->count++;
+                       /* If at least one route among routes that are
+                        * aggregated has ORIGIN with the value INCOMPLETE,
+                        * then the aggregated route MUST have the ORIGIN
+                        * attribute with the value INCOMPLETE.  Otherwise, if
+                        * at least one route among routes that are aggregated
+                        * has ORIGIN with the value EGP, then the aggregated
+                        * route MUST have the ORIGIN attribute with the value
+                        * EGP.
+                        */
+                       if (origin < ri->attr->origin)
+                               origin = ri->attr->origin;
+
+                       /* as-set aggregate route generate origin, as path,
+                        * community aggregation.  */
+                       if (aggregate->as_set) {
+                               if (aspath) {
+                                       asmerge = aspath_aggregate(aspath,
+                                                       ri->attr->aspath);
+                                       aspath_free(aspath);
+                                       aspath = asmerge;
+                               } else
+                                       aspath = aspath_dup(ri->attr->aspath);
+
+                               if (ri->attr->community) {
+                                       if (community) {
+                                               commerge = community_merge(
+                                                       community,
+                                                       ri->attr->community);
+                                               community = community_uniq_sort(
+                                                       commerge);
+                                               community_free(
+                                                       commerge);
+                                       } else
+                                               community = community_dup(
+                                                       ri->attr->community);
                                }
                        }
-
-                       /* If this node is suppressed, process the change. */
-                       if (match)
-                               bgp_process(bgp, rn, afi, safi);
+                       aggregate->count++;
                }
+
+               /* If this node is suppressed, process the change. */
+               if (match)
+                       bgp_process(bgp, rn, afi, safi);
+       }
        bgp_unlock_node(top);
 
        /* Add aggregate route to BGP table. */
@@ -5806,34 +5805,34 @@ void bgp_aggregate_delete(struct bgp *bgp, struct prefix *p, afi_t afi,
        /* If routes exists below this node, generate aggregate routes. */
        top = bgp_node_get(table, p);
        for (rn = bgp_node_get(table, p); rn;
-            rn = bgp_route_next_until(rn, top))
-               if (rn->p.prefixlen > p->prefixlen) {
-                       match = 0;
+            rn = bgp_route_next_until(rn, top)) {
+               if (rn->p.prefixlen <= p->prefixlen)
+                       continue;
+               match = 0;
 
-                       for (ri = rn->info; ri; ri = ri->next) {
-                               if (BGP_INFO_HOLDDOWN(ri))
-                                       continue;
+               for (ri = rn->info; ri; ri = ri->next) {
+                       if (BGP_INFO_HOLDDOWN(ri))
+                               continue;
 
-                               if (ri->sub_type != BGP_ROUTE_AGGREGATE) {
-                                       if (aggregate->summary_only
-                                           && ri->extra) {
-                                               ri->extra->suppress--;
-
-                                               if (ri->extra->suppress == 0) {
-                                                       bgp_info_set_flag(
-                                                               rn, ri,
-                                                               BGP_INFO_ATTR_CHANGED);
-                                                       match++;
-                                               }
-                                       }
-                                       aggregate->count--;
+                       if (ri->sub_type == BGP_ROUTE_AGGREGATE)
+                               continue;
+
+                       if (aggregate->summary_only && ri->extra) {
+                               ri->extra->suppress--;
+
+                               if (ri->extra->suppress == 0) {
+                                       bgp_info_set_flag(rn, ri,
+                                               BGP_INFO_ATTR_CHANGED);
+                                       match++;
                                }
                        }
-
-                       /* If this node was suppressed, process the change. */
-                       if (match)
-                               bgp_process(bgp, rn, afi, safi);
+                       aggregate->count--;
                }
+
+               /* If this node was suppressed, process the change. */
+               if (match)
+                       bgp_process(bgp, rn, afi, safi);
+       }
        bgp_unlock_node(top);
 
        /* Delete aggregate route from BGP table. */
@@ -8561,55 +8560,44 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp,
                        if (prd && memcmp(rn->p.u.val, prd->val, 8) != 0)
                                continue;
 
-                       if ((table = rn->info) != NULL) {
-                               header = 1;
-
-                               if ((rm = bgp_node_match(table, &match))
-                                   != NULL) {
-                                       if (prefix_check
-                                           && rm->p.prefixlen
-                                                      != match.prefixlen) {
-                                               bgp_unlock_node(rm);
-                                               continue;
-                                       }
+                       if ((table = rn->info) == NULL)
+                               continue;
 
-                                       for (ri = rm->info; ri; ri = ri->next) {
-                                               if (header) {
-                                                       route_vty_out_detail_header(
-                                                               vty, bgp, rm,
-                                                               (struct
-                                                                prefix_rd *)&rn
-                                                                       ->p,
-                                                               AFI_IP, safi,
-                                                               json);
-                                                       header = 0;
-                                               }
-                                               display++;
-
-                                               if (pathtype == BGP_PATH_ALL
-                                                   || (pathtype
-                                                               == BGP_PATH_BESTPATH
-                                                       && CHECK_FLAG(
-                                                                  ri->flags,
-                                                                  BGP_INFO_SELECTED))
-                                                   || (pathtype
-                                                               == BGP_PATH_MULTIPATH
-                                                       && (CHECK_FLAG(
-                                                                   ri->flags,
-                                                                   BGP_INFO_MULTIPATH)
-                                                           || CHECK_FLAG(
-                                                                      ri->flags,
-                                                                      BGP_INFO_SELECTED))))
-                                                       route_vty_out_detail(
-                                                               vty, bgp,
-                                                               &rm->p, ri,
-                                                               AFI_IP, safi,
-                                                               json_paths);
-                                       }
+                       header = 1;
+
+                       if ((rm = bgp_node_match(table, &match)) == NULL)
+                               continue;
 
-                                       bgp_unlock_node(rm);
+                       if (prefix_check
+                           && rm->p.prefixlen != match.prefixlen) {
+                               bgp_unlock_node(rm);
+                               continue;
+                       }
+
+                       for (ri = rm->info; ri; ri = ri->next) {
+                               if (header) {
+                                       route_vty_out_detail_header(vty, bgp,
+                                               rm, (struct prefix_rd *)&rn->p,
+                                               AFI_IP, safi, json);
+                                       header = 0;
                                }
+                               display++;
+
+                               if (pathtype == BGP_PATH_ALL
+                                   || (pathtype == BGP_PATH_BESTPATH
+                                       && CHECK_FLAG(ri->flags,
+                                                     BGP_INFO_SELECTED))
+                                   || (pathtype == BGP_PATH_MULTIPATH
+                                       && (CHECK_FLAG(ri->flags,
+                                                      BGP_INFO_MULTIPATH)
+                                           || CHECK_FLAG(ri->flags,
+                                                         BGP_INFO_SELECTED))))
+                                       route_vty_out_detail(vty, bgp, &rm->p,
+                                                            ri, AFI_IP, safi,
+                                                            json_paths);
                        }
+
+                       bgp_unlock_node(rm);
                }
        } else {
                header = 1;
@@ -9995,60 +9983,55 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi,
        for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
                if (in) {
                        for (ain = rn->adj_in; ain; ain = ain->next) {
-                               if (ain->peer == peer) {
-                                       if (header1) {
-                                               if (use_json) {
-                                                       json_object_int_add(
-                                                               json,
-                                                               "bgpTableVersion",
-                                                               0);
-                                                       json_object_string_add(
-                                                               json,
-                                                               "bgpLocalRouterId",
-                                                               inet_ntoa(
-                                                                       bgp->router_id));
-                                                       json_object_object_add(
-                                                               json,
-                                                               "bgpStatusCodes",
-                                                               json_scode);
-                                                       json_object_object_add(
-                                                               json,
-                                                               "bgpOriginCodes",
-                                                               json_ocode);
-                                               } else {
-                                                       vty_out(vty,
-                                                               "BGP table version is 0, local router ID is %s\n",
-                                                               inet_ntoa(
-                                                                       bgp->router_id));
-                                                       vty_out(vty,
-                                                               BGP_SHOW_SCODE_HEADER);
-                                                       vty_out(vty,
-                                                               BGP_SHOW_OCODE_HEADER);
-                                               }
-                                               header1 = 0;
-                                       }
-                                       if (header2) {
-                                               if (!use_json)
-                                                       vty_out(vty,
-                                                               BGP_SHOW_HEADER);
-                                               header2 = 0;
-                                       }
-                                       if (ain->attr) {
-                                               bgp_attr_dup(&attr, ain->attr);
-                                               if (bgp_input_modifier(
-                                                           peer, &rn->p, &attr,
-                                                           afi, safi,
-                                                           rmap_name)
-                                                   != RMAP_DENY) {
-                                                       route_vty_out_tmp(
-                                                               vty, &rn->p,
-                                                               &attr, safi,
-                                                               use_json,
-                                                               json_ar);
-                                                       output_count++;
-                                               } else
-                                                       filtered_count++;
+                               if (ain->peer != peer)
+                                       continue;
+                               if (header1) {
+                                       if (use_json) {
+                                               json_object_int_add(
+                                                       json,
+                                                       "bgpTableVersion",
+                                                       0);
+                                               json_object_string_add(
+                                                       json,
+                                                       "bgpLocalRouterId",
+                                                       inet_ntoa(
+                                                               bgp->router_id));
+                                               json_object_object_add(
+                                                       json,
+                                                       "bgpStatusCodes",
+                                                       json_scode);
+                                               json_object_object_add(
+                                                       json,
+                                                       "bgpOriginCodes",
+                                                       json_ocode);
+                                       } else {
+                                               vty_out(vty,
+                                                       "BGP table version is 0, local router ID is %s\n",
+                                                       inet_ntoa(
+                                                               bgp->router_id));
+                                               vty_out(vty,
+                                                       BGP_SHOW_SCODE_HEADER);
+                                               vty_out(vty,
+                                                       BGP_SHOW_OCODE_HEADER);
                                        }
+                                       header1 = 0;
+                               }
+                               if (header2) {
+                                       if (!use_json)
+                                               vty_out(vty, BGP_SHOW_HEADER);
+                                       header2 = 0;
+                               }
+                               if (ain->attr) {
+                                       bgp_attr_dup(&attr, ain->attr);
+                                       if (bgp_input_modifier(peer, &rn->p,
+                                               &attr, afi, safi, rmap_name)
+                                           != RMAP_DENY) {
+                                               route_vty_out_tmp(vty, &rn->p,
+                                                       &attr, safi, use_json,
+                                                       json_ar);
+                                               output_count++;
+                                       } else
+                                               filtered_count++;
                                }
                        }
                } else {
@@ -10856,32 +10839,27 @@ static int bgp_clear_damp_route(struct vty *vty, const char *view_name,
                     rn = bgp_route_next(rn)) {
                        if (prd && memcmp(rn->p.u.val, prd->val, 8) != 0)
                                continue;
+                       if ((table = rn->info) == NULL)
+                               continue;
+                       if ((rm = bgp_node_match(table, &match)) == NULL)
+                               continue;
 
-                       if ((table = rn->info) != NULL)
-                               if ((rm = bgp_node_match(table, &match))
-                                   != NULL) {
-                                       if (!prefix_check
-                                           || rm->p.prefixlen
-                                                      == match.prefixlen) {
-                                               ri = rm->info;
-                                               while (ri) {
-                                                       if (ri->extra
-                                                           && ri->extra
-                                                                      ->damp_info) {
-                                                               ri_temp =
-                                                                       ri->next;
-                                                               bgp_damp_info_free(
-                                                                       ri->extra
-                                                                               ->damp_info,
-                                                                       1);
-                                                               ri = ri_temp;
-                                                       } else
-                                                               ri = ri->next;
-                                               }
-                                       }
-
-                                       bgp_unlock_node(rm);
+                       if (!prefix_check
+                           || rm->p.prefixlen == match.prefixlen) {
+                               ri = rm->info;
+                               while (ri) {
+                                       if (ri->extra
+                                           && ri->extra->damp_info) {
+                                               ri_temp = ri->next;
+                                               bgp_damp_info_free(
+                                                       ri->extra->damp_info, 1);
+                                               ri = ri_temp;
+                                       } else
+                                               ri = ri->next;
                                }
+                       }
+
+                       bgp_unlock_node(rm);
                }
        } else {
                if ((rn = bgp_node_match(bgp->rib[afi][safi], &match))
@@ -10990,39 +10968,39 @@ static void bgp_config_write_network_vpn(struct vty *vty, struct bgp *bgp,
 
        /* Network configuration. */
        for (prn = bgp_table_top(bgp->route[afi][safi]); prn;
-            prn = bgp_route_next(prn))
-               if ((table = prn->info) != NULL)
-                       for (rn = bgp_table_top(table); rn;
-                            rn = bgp_route_next(rn))
-                               if ((bgp_static = rn->info) != NULL) {
-                                       p = &rn->p;
-                                       prd = (struct prefix_rd *)&prn->p;
+            prn = bgp_route_next(prn)) {
+               if ((table = prn->info) == NULL)
+                       continue;
 
-                                       /* "network" configuration display.  */
-                                       prefix_rd2str(prd, rdbuf,
-                                                     RD_ADDRSTRLEN);
-                                       label = decode_label(
-                                               &bgp_static->label);
+               for (rn = bgp_table_top(table); rn;
+                    rn = bgp_route_next(rn)) {
+                       if ((bgp_static = rn->info) == NULL)
+                               continue;
 
-                                       vty_out(vty, "  network %s/%d rd %s",
-                                               inet_ntop(p->family,
-                                                         &p->u.prefix, buf,
-                                                         SU_ADDRSTRLEN),
-                                               p->prefixlen, rdbuf);
-                                       if (safi == SAFI_MPLS_VPN)
-                                               vty_out(vty, " label %u",
-                                                       label);
-
-                                       if (bgp_static->rmap.name)
-                                               vty_out(vty, " route-map %s",
-                                                       bgp_static->rmap.name);
-                                       else {
-                                               if (bgp_static->backdoor)
-                                                       vty_out(vty,
-                                                               " backdoor");
-                                       }
-                                       vty_out(vty, "\n");
-                               }
+                       p = &rn->p;
+                       prd = (struct prefix_rd *)&prn->p;
+
+                       /* "network" configuration display.  */
+                       prefix_rd2str(prd, rdbuf, RD_ADDRSTRLEN);
+                       label = decode_label(&bgp_static->label);
+
+                       vty_out(vty, "  network %s/%d rd %s",
+                               inet_ntop(p->family, &p->u.prefix, buf,
+                                         SU_ADDRSTRLEN),
+                               p->prefixlen, rdbuf);
+                       if (safi == SAFI_MPLS_VPN)
+                               vty_out(vty, " label %u", label);
+
+                       if (bgp_static->rmap.name)
+                               vty_out(vty, " route-map %s",
+                                       bgp_static->rmap.name);
+                       else {
+                               if (bgp_static->backdoor)
+                                       vty_out(vty, " backdoor");
+                       }
+                       vty_out(vty, "\n");
+               }
+       }
 }
 
 static void bgp_config_write_network_evpn(struct vty *vty, struct bgp *bgp,
@@ -11040,48 +11018,45 @@ static void bgp_config_write_network_evpn(struct vty *vty, struct bgp *bgp,
 
        /* Network configuration. */
        for (prn = bgp_table_top(bgp->route[afi][safi]); prn;
-            prn = bgp_route_next(prn))
-               if ((table = prn->info) != NULL)
-                       for (rn = bgp_table_top(table); rn;
-                            rn = bgp_route_next(rn))
-                               if ((bgp_static = rn->info) != NULL) {
-                                       char *macrouter = NULL;
-                                       char *esi = NULL;
-
-                                       if (bgp_static->router_mac)
-                                               macrouter = prefix_mac2str(
-                                                       bgp_static->router_mac,
-                                                       NULL, 0);
-                                       if (bgp_static->eth_s_id)
-                                               esi = esi2str(
-                                                       bgp_static->eth_s_id);
-                                       p = &rn->p;
-                                       prd = (struct prefix_rd *)&prn->p;
+            prn = bgp_route_next(prn)) {
+               if ((table = prn->info) == NULL)
+                       continue;
 
-                                       /* "network" configuration display.  */
-                                       prefix_rd2str(prd, rdbuf,
-                                                     RD_ADDRSTRLEN);
+               for (rn = bgp_table_top(table); rn;
+                    rn = bgp_route_next(rn)) {
+                       if ((bgp_static = rn->info) == NULL)
+                               continue;
 
-                                       inet_ntop(AF_INET,
-                                                 &bgp_static->igpnexthop, buf2,
-                                                 SU_ADDRSTRLEN);
+                       char *macrouter = NULL;
+                       char *esi = NULL;
 
-                                       prefix2str(p, buf, sizeof(buf)),
-                                               vty_out(vty,
-                                                       " network %s rd %s ethtag %u tag %u esi %s gwip %s routermac %s",
-                                                       buf, rdbuf,
-                                                       p->u.prefix_evpn
-                                                               .eth_tag,
-                                                       decode_label(
-                                                               &bgp_static
-                                                                        ->label),
-                                                       esi, buf2, macrouter);
-                                       vty_out(vty, "\n");
-                                       if (macrouter)
-                                               XFREE(MTYPE_TMP, macrouter);
-                                       if (esi)
-                                               XFREE(MTYPE_TMP, esi);
-                               }
+                       if (bgp_static->router_mac)
+                               macrouter = prefix_mac2str(
+                                       bgp_static->router_mac, NULL, 0);
+                       if (bgp_static->eth_s_id)
+                               esi = esi2str(bgp_static->eth_s_id);
+                       p = &rn->p;
+                       prd = (struct prefix_rd *)&prn->p;
+
+                       /* "network" configuration display.  */
+                       prefix_rd2str(prd, rdbuf, RD_ADDRSTRLEN);
+
+                       inet_ntop(AF_INET, &bgp_static->igpnexthop, buf2,
+                                 SU_ADDRSTRLEN);
+
+                       prefix2str(p, buf, sizeof(buf));
+                       vty_out(vty,
+                               " network %s rd %s ethtag %u tag %u esi %s gwip %s routermac %s\n",
+                               buf, rdbuf, p->u.prefix_evpn .eth_tag,
+                               decode_label(&bgp_static ->label), esi, buf2,
+                               macrouter);
+
+                       if (macrouter)
+                               XFREE(MTYPE_TMP, macrouter);
+                       if (esi)
+                               XFREE(MTYPE_TMP, esi);
+               }
+       }
 }
 
 /* Configuration of static route announcement and aggregate
@@ -11107,85 +11082,83 @@ void bgp_config_write_network(struct vty *vty, struct bgp *bgp, afi_t afi,
 
        /* Network configuration. */
        for (rn = bgp_table_top(bgp->route[afi][safi]); rn;
-            rn = bgp_route_next(rn))
-               if ((bgp_static = rn->info) != NULL) {
-                       p = &rn->p;
-
-                       /* "network" configuration display.  */
-                       if (bgp_option_check(BGP_OPT_CONFIG_CISCO)
-                           && afi == AFI_IP) {
-                               u_int32_t destination;
-                               struct in_addr netmask;
-
-                               destination = ntohl(p->u.prefix4.s_addr);
-                               masklen2ip(p->prefixlen, &netmask);
-                               vty_out(vty, "  network %s",
-                                       inet_ntop(p->family, &p->u.prefix, buf,
-                                                 SU_ADDRSTRLEN));
-
-                               if ((IN_CLASSC(destination)
-                                    && p->prefixlen == 24)
-                                   || (IN_CLASSB(destination)
-                                       && p->prefixlen == 16)
-                                   || (IN_CLASSA(destination)
-                                       && p->prefixlen == 8)
-                                   || p->u.prefix4.s_addr == 0) {
-                                       /* Natural mask is not display. */
-                               } else
-                                       vty_out(vty, " mask %s",
-                                               inet_ntoa(netmask));
-                       } else {
-                               vty_out(vty, "  network %s/%d",
-                                       inet_ntop(p->family, &p->u.prefix, buf,
-                                                 SU_ADDRSTRLEN),
-                                       p->prefixlen);
-                       }
+            rn = bgp_route_next(rn)) {
+               if ((bgp_static = rn->info) == NULL)
+                       continue;
 
-                       if (bgp_static->label_index != BGP_INVALID_LABEL_INDEX)
-                               vty_out(vty, " label-index %u",
-                                       bgp_static->label_index);
+               p = &rn->p;
+
+               /* "network" configuration display.  */
+               if (bgp_option_check(BGP_OPT_CONFIG_CISCO)
+                   && afi == AFI_IP) {
+                       u_int32_t destination;
+                       struct in_addr netmask;
+
+                       destination = ntohl(p->u.prefix4.s_addr);
+                       masklen2ip(p->prefixlen, &netmask);
+                       vty_out(vty, "  network %s",
+                               inet_ntop(p->family, &p->u.prefix, buf,
+                                         SU_ADDRSTRLEN));
+
+                       if ((IN_CLASSC(destination) && p->prefixlen == 24)
+                           || (IN_CLASSB(destination) && p->prefixlen == 16)
+                           || (IN_CLASSA(destination) && p->prefixlen == 8)
+                           || p->u.prefix4.s_addr == 0) {
+                               /* Natural mask is not display. */
+                       } else
+                               vty_out(vty, " mask %s", inet_ntoa(netmask));
+               } else {
+                       vty_out(vty, "  network %s/%d",
+                               inet_ntop(p->family, &p->u.prefix, buf,
+                                         SU_ADDRSTRLEN),
+                               p->prefixlen);
+               }
 
-                       if (bgp_static->rmap.name)
-                               vty_out(vty, " route-map %s",
-                                       bgp_static->rmap.name);
-                       else {
-                               if (bgp_static->backdoor)
-                                       vty_out(vty, " backdoor");
-                       }
+               if (bgp_static->label_index != BGP_INVALID_LABEL_INDEX)
+                       vty_out(vty, " label-index %u",
+                               bgp_static->label_index);
 
-                       vty_out(vty, "\n");
+               if (bgp_static->rmap.name)
+                       vty_out(vty, " route-map %s", bgp_static->rmap.name);
+               else {
+                       if (bgp_static->backdoor)
+                               vty_out(vty, " backdoor");
                }
 
+               vty_out(vty, "\n");
+       }
+
        /* Aggregate-address configuration. */
        for (rn = bgp_table_top(bgp->aggregate[afi][safi]); rn;
-            rn = bgp_route_next(rn))
-               if ((bgp_aggregate = rn->info) != NULL) {
-                       p = &rn->p;
+            rn = bgp_route_next(rn)) {
+               if ((bgp_aggregate = rn->info) == NULL)
+                       continue;
 
-                       if (bgp_option_check(BGP_OPT_CONFIG_CISCO)
-                           && afi == AFI_IP) {
-                               struct in_addr netmask;
+               p = &rn->p;
 
-                               masklen2ip(p->prefixlen, &netmask);
-                               vty_out(vty, "  aggregate-address %s %s",
-                                       inet_ntop(p->family, &p->u.prefix, buf,
-                                                 SU_ADDRSTRLEN),
-                                       inet_ntoa(netmask));
-                       } else {
-                               vty_out(vty, "  aggregate-address %s/%d",
-                                       inet_ntop(p->family, &p->u.prefix, buf,
-                                                 SU_ADDRSTRLEN),
-                                       p->prefixlen);
-                       }
+               if (bgp_option_check(BGP_OPT_CONFIG_CISCO) && afi == AFI_IP) {
+                       struct in_addr netmask;
 
-                       if (bgp_aggregate->as_set)
-                               vty_out(vty, " as-set");
+                       masklen2ip(p->prefixlen, &netmask);
+                       vty_out(vty, "  aggregate-address %s %s",
+                               inet_ntop(p->family, &p->u.prefix, buf,
+                                         SU_ADDRSTRLEN),
+                               inet_ntoa(netmask));
+               } else {
+                       vty_out(vty, "  aggregate-address %s/%d",
+                               inet_ntop(p->family, &p->u.prefix, buf,
+                                         SU_ADDRSTRLEN),
+                               p->prefixlen);
+               }
 
-                       if (bgp_aggregate->summary_only)
-                               vty_out(vty, " summary-only");
+               if (bgp_aggregate->as_set)
+                       vty_out(vty, " as-set");
 
-                       vty_out(vty, "\n");
-               }
+               if (bgp_aggregate->summary_only)
+                       vty_out(vty, " summary-only");
+
+               vty_out(vty, "\n");
+       }
 }
 
 void bgp_config_write_distance(struct vty *vty, struct bgp *bgp, afi_t afi,
index fafa005d0e8adad7d3490b329036d3cbc15b6aad..359451fcc41043108b91f0f0dd774418c970646f 100644 (file)
@@ -6610,367 +6610,368 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
                if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE))
                        continue;
 
-               if (peer->afc[afi][safi]) {
-                       if (!count) {
-                               unsigned long ents;
-                               char memstrbuf[MTYPE_MEMSTR_LEN];
-                               int vrf_id_ui;
+               if (!peer->afc[afi][safi])
+                       continue;
 
-                               vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN)
-                                                   ? -1
-                                                   : bgp->vrf_id;
+               if (!count) {
+                       unsigned long ents;
+                       char memstrbuf[MTYPE_MEMSTR_LEN];
+                       int vrf_id_ui;
+
+                       vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN)
+                                           ? -1
+                                           : bgp->vrf_id;
 
-                               /* Usage summary and header */
+                       /* Usage summary and header */
+                       if (use_json) {
+                               json_object_string_add(
+                                       json, "routerId",
+                                       inet_ntoa(bgp->router_id));
+                               json_object_int_add(json, "as",
+                                                   bgp->as);
+                               json_object_int_add(json, "vrfId",
+                                                   vrf_id_ui);
+                               json_object_string_add(
+                                       json, "vrfName",
+                                       (bgp->inst_type
+                                        == BGP_INSTANCE_TYPE_DEFAULT)
+                                               ? "Default"
+                                               : bgp->name);
+                       } else {
+                               vty_out(vty,
+                                       "BGP router identifier %s, local AS number %u vrf-id %d",
+                                       inet_ntoa(bgp->router_id),
+                                       bgp->as, vrf_id_ui);
+                               vty_out(vty, "\n");
+                       }
+
+                       if (bgp_update_delay_configured(bgp)) {
                                if (use_json) {
-                                       json_object_string_add(
-                                               json, "routerId",
-                                               inet_ntoa(bgp->router_id));
-                                       json_object_int_add(json, "as",
-                                                           bgp->as);
-                                       json_object_int_add(json, "vrfId",
-                                                           vrf_id_ui);
-                                       json_object_string_add(
-                                               json, "vrfName",
-                                               (bgp->inst_type
-                                                == BGP_INSTANCE_TYPE_DEFAULT)
-                                                       ? "Default"
-                                                       : bgp->name);
-                               } else {
-                                       vty_out(vty,
-                                               "BGP router identifier %s, local AS number %u vrf-id %d",
-                                               inet_ntoa(bgp->router_id),
-                                               bgp->as, vrf_id_ui);
-                                       vty_out(vty, "\n");
-                               }
+                                       json_object_int_add(
+                                               json,
+                                               "updateDelayLimit",
+                                               bgp->v_update_delay);
 
-                               if (bgp_update_delay_configured(bgp)) {
-                                       if (use_json) {
+                                       if (bgp->v_update_delay
+                                           != bgp->v_establish_wait)
                                                json_object_int_add(
                                                        json,
-                                                       "updateDelayLimit",
-                                                       bgp->v_update_delay);
+                                                       "updateDelayEstablishWait",
+                                                       bgp->v_establish_wait);
 
-                                               if (bgp->v_update_delay
-                                                   != bgp->v_establish_wait)
-                                                       json_object_int_add(
-                                                               json,
-                                                               "updateDelayEstablishWait",
-                                                               bgp->v_establish_wait);
-
-                                               if (bgp_update_delay_active(
-                                                           bgp)) {
+                                       if (bgp_update_delay_active(
+                                                   bgp)) {
+                                               json_object_string_add(
+                                                       json,
+                                                       "updateDelayFirstNeighbor",
+                                                       bgp->update_delay_begin_time);
+                                               json_object_boolean_true_add(
+                                                       json,
+                                                       "updateDelayInProgress");
+                                       } else {
+                                               if (bgp->update_delay_over) {
                                                        json_object_string_add(
                                                                json,
                                                                "updateDelayFirstNeighbor",
                                                                bgp->update_delay_begin_time);
-                                                       json_object_boolean_true_add(
+                                                       json_object_string_add(
                                                                json,
-                                                               "updateDelayInProgress");
-                                               } else {
-                                                       if (bgp->update_delay_over) {
-                                                               json_object_string_add(
-                                                                       json,
-                                                                       "updateDelayFirstNeighbor",
-                                                                       bgp->update_delay_begin_time);
-                                                               json_object_string_add(
-                                                                       json,
-                                                                       "updateDelayBestpathResumed",
-                                                                       bgp->update_delay_end_time);
-                                                               json_object_string_add(
-                                                                       json,
-                                                                       "updateDelayZebraUpdateResume",
-                                                                       bgp->update_delay_zebra_resume_time);
-                                                               json_object_string_add(
-                                                                       json,
-                                                                       "updateDelayPeerUpdateResume",
-                                                                       bgp->update_delay_peers_resume_time);
-                                                       }
+                                                               "updateDelayBestpathResumed",
+                                                               bgp->update_delay_end_time);
+                                                       json_object_string_add(
+                                                               json,
+                                                               "updateDelayZebraUpdateResume",
+                                                               bgp->update_delay_zebra_resume_time);
+                                                       json_object_string_add(
+                                                               json,
+                                                               "updateDelayPeerUpdateResume",
+                                                               bgp->update_delay_peers_resume_time);
                                                }
-                                       } else {
+                                       }
+                               } else {
+                                       vty_out(vty,
+                                               "Read-only mode update-delay limit: %d seconds\n",
+                                               bgp->v_update_delay);
+                                       if (bgp->v_update_delay
+                                           != bgp->v_establish_wait)
                                                vty_out(vty,
-                                                       "Read-only mode update-delay limit: %d seconds\n",
-                                                       bgp->v_update_delay);
-                                               if (bgp->v_update_delay
-                                                   != bgp->v_establish_wait)
-                                                       vty_out(vty,
-                                                               "                   Establish wait: %d seconds\n",
-                                                               bgp->v_establish_wait);
+                                                       "                   Establish wait: %d seconds\n",
+                                                       bgp->v_establish_wait);
 
-                                               if (bgp_update_delay_active(
-                                                           bgp)) {
+                                       if (bgp_update_delay_active(
+                                                   bgp)) {
+                                               vty_out(vty,
+                                                       "  First neighbor established: %s\n",
+                                                       bgp->update_delay_begin_time);
+                                               vty_out(vty,
+                                                       "  Delay in progress\n");
+                                       } else {
+                                               if (bgp->update_delay_over) {
                                                        vty_out(vty,
                                                                "  First neighbor established: %s\n",
                                                                bgp->update_delay_begin_time);
                                                        vty_out(vty,
-                                                               "  Delay in progress\n");
-                                               } else {
-                                                       if (bgp->update_delay_over) {
-                                                               vty_out(vty,
-                                                                       "  First neighbor established: %s\n",
-                                                                       bgp->update_delay_begin_time);
-                                                               vty_out(vty,
-                                                                       "          Best-paths resumed: %s\n",
-                                                                       bgp->update_delay_end_time);
-                                                               vty_out(vty,
-                                                                       "        zebra update resumed: %s\n",
-                                                                       bgp->update_delay_zebra_resume_time);
-                                                               vty_out(vty,
-                                                                       "        peers update resumed: %s\n",
-                                                                       bgp->update_delay_peers_resume_time);
-                                                       }
+                                                               "          Best-paths resumed: %s\n",
+                                                               bgp->update_delay_end_time);
+                                                       vty_out(vty,
+                                                               "        zebra update resumed: %s\n",
+                                                               bgp->update_delay_zebra_resume_time);
+                                                       vty_out(vty,
+                                                               "        peers update resumed: %s\n",
+                                                               bgp->update_delay_peers_resume_time);
                                                }
                                        }
                                }
+                       }
 
-                               if (use_json) {
-                                       if (bgp_maxmed_onstartup_configured(bgp)
-                                           && bgp->maxmed_active)
-                                               json_object_boolean_true_add(
-                                                       json,
-                                                       "maxMedOnStartup");
-                                       if (bgp->v_maxmed_admin)
-                                               json_object_boolean_true_add(
-                                                       json,
-                                                       "maxMedAdministrative");
-
-                                       json_object_int_add(
-                                               json, "tableVersion",
-                                               bgp_table_version(
-                                                       bgp->rib[afi][safi]));
-
-                                       ents = bgp_table_count(
-                                               bgp->rib[afi][safi]);
-                                       json_object_int_add(json, "ribCount",
-                                                           ents);
-                                       json_object_int_add(
-                                               json, "ribMemory",
-                                               ents * sizeof(struct bgp_node));
+                       if (use_json) {
+                               if (bgp_maxmed_onstartup_configured(bgp)
+                                   && bgp->maxmed_active)
+                                       json_object_boolean_true_add(
+                                               json,
+                                               "maxMedOnStartup");
+                               if (bgp->v_maxmed_admin)
+                                       json_object_boolean_true_add(
+                                               json,
+                                               "maxMedAdministrative");
 
-                                       ents = listcount(bgp->peer);
-                                       json_object_int_add(json, "peerCount",
-                                                           ents);
-                                       json_object_int_add(
-                                               json, "peerMemory",
-                                               ents * sizeof(struct peer));
+                               json_object_int_add(
+                                       json, "tableVersion",
+                                       bgp_table_version(
+                                               bgp->rib[afi][safi]));
+
+                               ents = bgp_table_count(
+                                       bgp->rib[afi][safi]);
+                               json_object_int_add(json, "ribCount",
+                                                   ents);
+                               json_object_int_add(
+                                       json, "ribMemory",
+                                       ents * sizeof(struct bgp_node));
 
-                                       if ((ents = listcount(bgp->group))) {
-                                               json_object_int_add(
-                                                       json, "peerGroupCount",
-                                                       ents);
-                                               json_object_int_add(
-                                                       json, "peerGroupMemory",
-                                                       ents * sizeof(struct
-                                                                     peer_group));
-                                       }
+                               ents = listcount(bgp->peer);
+                               json_object_int_add(json, "peerCount",
+                                                   ents);
+                               json_object_int_add(
+                                       json, "peerMemory",
+                                       ents * sizeof(struct peer));
 
-                                       if (CHECK_FLAG(bgp->af_flags[afi][safi],
-                                                      BGP_CONFIG_DAMPENING))
-                                               json_object_boolean_true_add(
-                                                       json,
-                                                       "dampeningEnabled");
-                               } else {
-                                       if (bgp_maxmed_onstartup_configured(bgp)
-                                           && bgp->maxmed_active)
-                                               vty_out(vty,
-                                                       "Max-med on-startup active\n");
-                                       if (bgp->v_maxmed_admin)
-                                               vty_out(vty,
-                                                       "Max-med administrative active\n");
+                               if ((ents = listcount(bgp->group))) {
+                                       json_object_int_add(
+                                               json, "peerGroupCount",
+                                               ents);
+                                       json_object_int_add(
+                                               json, "peerGroupMemory",
+                                               ents * sizeof(struct
+                                                             peer_group));
+                               }
 
+                               if (CHECK_FLAG(bgp->af_flags[afi][safi],
+                                              BGP_CONFIG_DAMPENING))
+                                       json_object_boolean_true_add(
+                                               json,
+                                               "dampeningEnabled");
+                       } else {
+                               if (bgp_maxmed_onstartup_configured(bgp)
+                                   && bgp->maxmed_active)
                                        vty_out(vty,
-                                               "BGP table version %" PRIu64
-                                               "\n",
-                                               bgp_table_version(
-                                                       bgp->rib[afi][safi]));
-
-                                       ents = bgp_table_count(
-                                               bgp->rib[afi][safi]);
+                                               "Max-med on-startup active\n");
+                               if (bgp->v_maxmed_admin)
                                        vty_out(vty,
-                                               "RIB entries %ld, using %s of memory\n",
-                                               ents,
-                                               mtype_memstr(
-                                                       memstrbuf,
-                                                       sizeof(memstrbuf),
-                                                       ents * sizeof(struct
-                                                                     bgp_node)));
+                                               "Max-med administrative active\n");
 
-                                       /* Peer related usage */
-                                       ents = listcount(bgp->peer);
+                               vty_out(vty,
+                                       "BGP table version %" PRIu64
+                                       "\n",
+                                       bgp_table_version(
+                                               bgp->rib[afi][safi]));
+
+                               ents = bgp_table_count(
+                                       bgp->rib[afi][safi]);
+                               vty_out(vty,
+                                       "RIB entries %ld, using %s of memory\n",
+                                       ents,
+                                       mtype_memstr(
+                                               memstrbuf,
+                                               sizeof(memstrbuf),
+                                               ents * sizeof(struct
+                                                             bgp_node)));
+
+                               /* Peer related usage */
+                               ents = listcount(bgp->peer);
+                               vty_out(vty,
+                                       "Peers %ld, using %s of memory\n",
+                                       ents,
+                                       mtype_memstr(
+                                               memstrbuf,
+                                               sizeof(memstrbuf),
+                                               ents * sizeof(struct
+                                                             peer)));
+
+                               if ((ents = listcount(bgp->group)))
                                        vty_out(vty,
-                                               "Peers %ld, using %s of memory\n",
+                                               "Peer groups %ld, using %s of memory\n",
                                                ents,
                                                mtype_memstr(
                                                        memstrbuf,
                                                        sizeof(memstrbuf),
                                                        ents * sizeof(struct
-                                                                     peer)));
+                                                                     peer_group)));
 
-                                       if ((ents = listcount(bgp->group)))
-                                               vty_out(vty,
-                                                       "Peer groups %ld, using %s of memory\n",
-                                                       ents,
-                                                       mtype_memstr(
-                                                               memstrbuf,
-                                                               sizeof(memstrbuf),
-                                                               ents * sizeof(struct
-                                                                             peer_group)));
-
-                                       if (CHECK_FLAG(bgp->af_flags[afi][safi],
-                                                      BGP_CONFIG_DAMPENING))
-                                               vty_out(vty,
-                                                       "Dampening enabled.\n");
-                                       vty_out(vty, "\n");
-
-                                       /* Subtract 8 here because 'Neighbor' is
-                                        * 8 characters */
-                                       vty_out(vty, "Neighbor");
-                                       vty_out(vty, "%*s",
-                                               max_neighbor_width - 8, " ");
+                               if (CHECK_FLAG(bgp->af_flags[afi][safi],
+                                              BGP_CONFIG_DAMPENING))
                                        vty_out(vty,
-                                               "V         AS MsgRcvd MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd\n");
-                               }
+                                               "Dampening enabled.\n");
+                               vty_out(vty, "\n");
+
+                               /* Subtract 8 here because 'Neighbor' is
+                                * 8 characters */
+                               vty_out(vty, "Neighbor");
+                               vty_out(vty, "%*s",
+                                       max_neighbor_width - 8, " ");
+                               vty_out(vty,
+                                       "V         AS MsgRcvd MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd\n");
                        }
+               }
 
-                       count++;
+               count++;
 
-                       if (use_json) {
-                               json_peer = json_object_new_object();
+               if (use_json) {
+                       json_peer = json_object_new_object();
 
-                               if (peer_dynamic_neighbor(peer))
-                                       json_object_boolean_true_add(
-                                               json_peer, "dynamicPeer");
+                       if (peer_dynamic_neighbor(peer))
+                               json_object_boolean_true_add(
+                                       json_peer, "dynamicPeer");
 
-                               if (peer->hostname)
-                                       json_object_string_add(json_peer,
-                                                              "hostname",
-                                                              peer->hostname);
+                       if (peer->hostname)
+                               json_object_string_add(json_peer,
+                                                      "hostname",
+                                                      peer->hostname);
 
-                               if (peer->domainname)
-                                       json_object_string_add(
-                                               json_peer, "domainname",
-                                               peer->domainname);
+                       if (peer->domainname)
+                               json_object_string_add(
+                                       json_peer, "domainname",
+                                       peer->domainname);
 
-                               json_object_int_add(json_peer, "remoteAs",
-                                                   peer->as);
-                               json_object_int_add(json_peer, "version", 4);
-                               json_object_int_add(
-                                       json_peer, "msgRcvd",
-                                       peer->open_in + peer->update_in
-                                               + peer->keepalive_in
-                                               + peer->notify_in
-                                               + peer->refresh_in
-                                               + peer->dynamic_cap_in);
-                               json_object_int_add(
-                                       json_peer, "msgSent",
-                                       peer->open_out + peer->update_out
-                                               + peer->keepalive_out
-                                               + peer->notify_out
-                                               + peer->refresh_out
-                                               + peer->dynamic_cap_out);
-
-                               json_object_int_add(json_peer, "tableVersion",
-                                                   peer->version[afi][safi]);
-                               json_object_int_add(json_peer, "outq",
-                                                   peer->obuf->count);
-                               json_object_int_add(json_peer, "inq", 0);
-                               peer_uptime(peer->uptime, timebuf,
-                                           BGP_UPTIME_LEN, use_json,
-                                           json_peer);
-                               json_object_int_add(
-                                       json_peer, "prefixReceivedCount",
-                                       peer->pcount[afi][pfx_rcd_safi]);
-
-                               if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN))
-                                       json_object_string_add(json_peer,
-                                                              "state",
-                                                              "Idle (Admin)");
-                               else if (CHECK_FLAG(
-                                                peer->sflags,
-                                                PEER_STATUS_PREFIX_OVERFLOW))
-                                       json_object_string_add(json_peer,
-                                                              "state",
-                                                              "Idle (PfxCt)");
-                               else
-                                       json_object_string_add(
-                                               json_peer, "state",
-                                               lookup_msg(bgp_status_msg,
-                                                          peer->status, NULL));
-
-                               if (peer->conf_if)
-                                       json_object_string_add(json_peer,
-                                                              "idType",
-                                                              "interface");
-                               else if (peer->su.sa.sa_family == AF_INET)
-                                       json_object_string_add(
-                                               json_peer, "idType", "ipv4");
-                               else if (peer->su.sa.sa_family == AF_INET6)
-                                       json_object_string_add(
-                                               json_peer, "idType", "ipv6");
+                       json_object_int_add(json_peer, "remoteAs",
+                                           peer->as);
+                       json_object_int_add(json_peer, "version", 4);
+                       json_object_int_add(
+                               json_peer, "msgRcvd",
+                               peer->open_in + peer->update_in
+                                       + peer->keepalive_in
+                                       + peer->notify_in
+                                       + peer->refresh_in
+                                       + peer->dynamic_cap_in);
+                       json_object_int_add(
+                               json_peer, "msgSent",
+                               peer->open_out + peer->update_out
+                                       + peer->keepalive_out
+                                       + peer->notify_out
+                                       + peer->refresh_out
+                                       + peer->dynamic_cap_out);
+
+                       json_object_int_add(json_peer, "tableVersion",
+                                           peer->version[afi][safi]);
+                       json_object_int_add(json_peer, "outq",
+                                           peer->obuf->count);
+                       json_object_int_add(json_peer, "inq", 0);
+                       peer_uptime(peer->uptime, timebuf,
+                                   BGP_UPTIME_LEN, use_json,
+                                   json_peer);
+                       json_object_int_add(
+                               json_peer, "prefixReceivedCount",
+                               peer->pcount[afi][pfx_rcd_safi]);
 
-                               json_object_object_add(json_peers, peer->host,
-                                                      json_peer);
-                       } else {
-                               memset(dn_flag, '\0', sizeof(dn_flag));
-                               if (peer_dynamic_neighbor(peer)) {
-                                       dn_count++;
-                                       dn_flag[0] = '*';
-                               }
+                       if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN))
+                               json_object_string_add(json_peer,
+                                                      "state",
+                                                      "Idle (Admin)");
+                       else if (CHECK_FLAG(
+                                        peer->sflags,
+                                        PEER_STATUS_PREFIX_OVERFLOW))
+                               json_object_string_add(json_peer,
+                                                      "state",
+                                                      "Idle (PfxCt)");
+                       else
+                               json_object_string_add(
+                                       json_peer, "state",
+                                       lookup_msg(bgp_status_msg,
+                                                  peer->status, NULL));
+
+                       if (peer->conf_if)
+                               json_object_string_add(json_peer,
+                                                      "idType",
+                                                      "interface");
+                       else if (peer->su.sa.sa_family == AF_INET)
+                               json_object_string_add(
+                                       json_peer, "idType", "ipv4");
+                       else if (peer->su.sa.sa_family == AF_INET6)
+                               json_object_string_add(
+                                       json_peer, "idType", "ipv6");
 
-                               if (peer->hostname
-                                   && bgp_flag_check(bgp,
-                                                     BGP_FLAG_SHOW_HOSTNAME))
-                                       len = vty_out(vty, "%s%s(%s)", dn_flag,
-                                                     peer->hostname,
-                                                     peer->host);
+                       json_object_object_add(json_peers, peer->host,
+                                              json_peer);
+               } else {
+                       memset(dn_flag, '\0', sizeof(dn_flag));
+                       if (peer_dynamic_neighbor(peer)) {
+                               dn_count++;
+                               dn_flag[0] = '*';
+                       }
+
+                       if (peer->hostname
+                           && bgp_flag_check(bgp,
+                                             BGP_FLAG_SHOW_HOSTNAME))
+                               len = vty_out(vty, "%s%s(%s)", dn_flag,
+                                             peer->hostname,
+                                             peer->host);
+                       else
+                               len = vty_out(vty, "%s%s", dn_flag,
+                                             peer->host);
+
+                       /* pad the neighbor column with spaces */
+                       if (len < max_neighbor_width)
+                               vty_out(vty, "%*s",
+                                       max_neighbor_width - len, " ");
+
+                       vty_out(vty, "4 %10u %7d %7d %8" PRIu64
+                                    " %4d %4zd %8s",
+                               peer->as,
+                               peer->open_in + peer->update_in
+                                       + peer->keepalive_in
+                                       + peer->notify_in
+                                       + peer->refresh_in
+                                       + peer->dynamic_cap_in,
+                               peer->open_out + peer->update_out
+                                       + peer->keepalive_out
+                                       + peer->notify_out
+                                       + peer->refresh_out
+                                       + peer->dynamic_cap_out,
+                               peer->version[afi][safi], 0,
+                               peer->obuf->count,
+                               peer_uptime(peer->uptime, timebuf,
+                                           BGP_UPTIME_LEN, 0, NULL));
+
+                       if (peer->status == Established)
+                               vty_out(vty, " %12ld",
+                                       peer->pcount[afi]
+                                                   [pfx_rcd_safi]);
+                       else {
+                               if (CHECK_FLAG(peer->flags,
+                                              PEER_FLAG_SHUTDOWN))
+                                       vty_out(vty, " Idle (Admin)");
+                               else if (
+                                       CHECK_FLAG(
+                                               peer->sflags,
+                                               PEER_STATUS_PREFIX_OVERFLOW))
+                                       vty_out(vty, " Idle (PfxCt)");
                                else
-                                       len = vty_out(vty, "%s%s", dn_flag,
-                                                     peer->host);
-
-                               /* pad the neighbor column with spaces */
-                               if (len < max_neighbor_width)
-                                       vty_out(vty, "%*s",
-                                               max_neighbor_width - len, " ");
-
-                               vty_out(vty, "4 %10u %7d %7d %8" PRIu64
-                                            " %4d %4zd %8s",
-                                       peer->as,
-                                       peer->open_in + peer->update_in
-                                               + peer->keepalive_in
-                                               + peer->notify_in
-                                               + peer->refresh_in
-                                               + peer->dynamic_cap_in,
-                                       peer->open_out + peer->update_out
-                                               + peer->keepalive_out
-                                               + peer->notify_out
-                                               + peer->refresh_out
-                                               + peer->dynamic_cap_out,
-                                       peer->version[afi][safi], 0,
-                                       peer->obuf->count,
-                                       peer_uptime(peer->uptime, timebuf,
-                                                   BGP_UPTIME_LEN, 0, NULL));
-
-                               if (peer->status == Established)
-                                       vty_out(vty, " %12ld",
-                                               peer->pcount[afi]
-                                                           [pfx_rcd_safi]);
-                               else {
-                                       if (CHECK_FLAG(peer->flags,
-                                                      PEER_FLAG_SHUTDOWN))
-                                               vty_out(vty, " Idle (Admin)");
-                                       else if (
-                                               CHECK_FLAG(
-                                                       peer->sflags,
-                                                       PEER_STATUS_PREFIX_OVERFLOW))
-                                               vty_out(vty, " Idle (PfxCt)");
-                                       else
-                                               vty_out(vty, " %12s",
-                                                       lookup_msg(
-                                                               bgp_status_msg,
-                                                               peer->status,
-                                                               NULL));
-                               }
-                               vty_out(vty, "\n");
+                                       vty_out(vty, " %12s",
+                                               lookup_msg(
+                                                       bgp_status_msg,
+                                                       peer->status,
+                                                       NULL));
                        }
+                       vty_out(vty, "\n");
                }
        }