diff options
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/bgp_msg_read.c | 2 | ||||
-rw-r--r-- | bgpd/bgp_packet.c | 131 | ||||
-rw-r--r-- | bgpd/bgp_packet.h | 3 | ||||
-rw-r--r-- | bgpd/bgp_peer.c | 7 | ||||
-rw-r--r-- | bgpd/bgp_peer.h | 15 | ||||
-rw-r--r-- | bgpd/bgp_session.c | 44 | ||||
-rw-r--r-- | bgpd/bgp_session.h | 25 | ||||
-rw-r--r-- | bgpd/bgp_snmp.c | 17 | ||||
-rw-r--r-- | bgpd/bgp_vty.c | 37 | ||||
-rw-r--r-- | bgpd/bgpd.c | 9 |
10 files changed, 199 insertions, 91 deletions
diff --git a/bgpd/bgp_msg_read.c b/bgpd/bgp_msg_read.c index 640126e0..7b56e9de 100644 --- a/bgpd/bgp_msg_read.c +++ b/bgpd/bgp_msg_read.c @@ -1508,7 +1508,7 @@ bgp_msg_route_refresh_receive(bgp_connection connection, bgp_size_t body_size) return ; } - bgp_session_route_refresh_recv(connection, rr) ; + bgp_session_route_refresh_recv(connection->session, rr) ; return ; } ; diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 4f1b3f04..f54c9f1f 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -652,13 +652,10 @@ bgp_write (bgp_peer peer) switch (type) { case BGP_MSG_OPEN: - peer->open_out++; break; case BGP_MSG_UPDATE: - peer->update_out++; break; case BGP_MSG_NOTIFY: - peer->notify_out++; /* Double start timer. */ peer->v_start *= 2; @@ -669,14 +666,11 @@ bgp_write (bgp_peer peer) assert(0); /* shouldn't get notifies through here */ return 0; case BGP_MSG_KEEPALIVE: - peer->keepalive_out++; break; case BGP_MSG_ROUTE_REFRESH_NEW: case BGP_MSG_ROUTE_REFRESH_OLD: - peer->refresh_out++; break; case BGP_MSG_CAPABILITY: - peer->dynamic_cap_out++; break; } @@ -867,13 +861,12 @@ bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi, bgp_route_refresh rr = NULL; struct bgp_filter *filter = NULL; bgp_session session = peer->session; - struct orf_prefix *orfpe = NULL; + bgp_orf_entry orfpe = NULL; struct prefix_list *plist = NULL; struct orf_prefix orfp; vector_index i; int orf_refresh = 0; enum prefix_list_type pe_type; - bgp_form_t form; if (DISABLE_BGP_ANNOUNCE) return; @@ -884,11 +877,6 @@ bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi, if (safi == SAFI_MPLS_VPN) safi = BGP_SAFI_VPNV4; - /* Make BGP update packet. */ - form = (CHECK_FLAG (peer->cap, PEER_CAP_REFRESH_NEW_RCV)) - ? bgp_form_rfc - : bgp_form_pre; - rr = bgp_route_refresh_new(afi, safi, 1); rr->defer = (when_to_refresh == REFRESH_DEFER); @@ -900,11 +888,14 @@ bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi, if (remove) { UNSET_FLAG (peer->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND); - bgp_orf_add_remove_all(rr, orf_type, form); + bgp_orf_add_remove_all(rr, BGP_ORF_T_PREFIX, bgp_form_none); if (BGP_DEBUG (normal, NORMAL)) - zlog_debug ("%s sending REFRESH_REQ to remove ORF(%d) (%s) for afi/safi: %d/%d", + zlog_debug ("%s sending REFRESH_REQ to remove ORF(%d) (%s)" + " for afi/safi: %d/%d", peer->host, orf_type, - (when_to_refresh == REFRESH_DEFER ? "defer" : "immediate"), + (when_to_refresh == REFRESH_DEFER) + ? "defer" + : "immediate", afi, safi); } else @@ -913,13 +904,17 @@ bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi, plist = prefix_list_ref_plist(filter->plist[FILTER_IN].ref) ; for (i = 0; prefix_bgp_orf_get(plist, i, &orfp, &pe_type); ++i) { - orfpe = bgp_orf_add(rr, orf_type, form, 0, pe_type == PREFIX_DENY); - *orfpe = orfp; + orfpe = bgp_orf_add(rr, BGP_ORF_T_PREFIX, bgp_form_none, 0, + pe_type == PREFIX_DENY); + orfpe->body.orf_prefix = orfp; } if (BGP_DEBUG (normal, NORMAL)) - zlog_debug ("%s sending REFRESH_REQ with pfxlist ORF(%d) (%s) for afi/safi: %d/%d", + zlog_debug ("%s sending REFRESH_REQ with pfxlist ORF(%d)" + " (%s) for afi/safi: %d/%d", peer->host, orf_type, - (when_to_refresh == REFRESH_DEFER ? "defer" : "immediate"), + (when_to_refresh == REFRESH_DEFER) + ? "defer" + : "immediate", afi, safi); } } @@ -1683,7 +1678,8 @@ bgp_update_receive (struct peer *peer, bgp_size_t size) bgp_clear_stale_route (peer, AFI_IP, SAFI_UNICAST); if (BGP_DEBUG (normal, NORMAL)) - zlog (peer->log, LOG_DEBUG, "rcvd End-of-RIB for IPv4 Unicast from %s", + zlog (peer->log, LOG_DEBUG, + "rcvd End-of-RIB for IPv4 Unicast from %s", peer->host); } } @@ -1713,7 +1709,8 @@ bgp_update_receive (struct peer *peer, bgp_size_t size) bgp_clear_stale_route (peer, AFI_IP, SAFI_MULTICAST); if (BGP_DEBUG (normal, NORMAL)) - zlog (peer->log, LOG_DEBUG, "rcvd End-of-RIB for IPv4 Multicast from %s", + zlog (peer->log, LOG_DEBUG, + "rcvd End-of-RIB for IPv4 Multicast from %s", peer->host); } } @@ -1735,14 +1732,16 @@ bgp_update_receive (struct peer *peer, bgp_size_t size) && mp_withdraw.length == 0) { /* End-of-RIB received */ - SET_FLAG (peer->af_sflags[AFI_IP6][SAFI_UNICAST], PEER_STATUS_EOR_RECEIVED); + SET_FLAG (peer->af_sflags[AFI_IP6][SAFI_UNICAST], + PEER_STATUS_EOR_RECEIVED); /* NSF delete stale route */ if (peer->nsf[AFI_IP6][SAFI_UNICAST]) bgp_clear_stale_route (peer, AFI_IP6, SAFI_UNICAST); if (BGP_DEBUG (normal, NORMAL)) - zlog (peer->log, LOG_DEBUG, "rcvd End-of-RIB for IPv6 Unicast from %s", + zlog (peer->log, LOG_DEBUG, + "rcvd End-of-RIB for IPv6 Unicast from %s", peer->host); } } @@ -1770,7 +1769,8 @@ bgp_update_receive (struct peer *peer, bgp_size_t size) bgp_clear_stale_route (peer, AFI_IP6, SAFI_MULTICAST); if (BGP_DEBUG (update, UPDATE_IN)) - zlog (peer->log, LOG_DEBUG, "rcvd End-of-RIB for IPv6 Multicast from %s", + zlog (peer->log, LOG_DEBUG, + "rcvd End-of-RIB for IPv6 Multicast from %s", peer->host); } } @@ -1794,7 +1794,8 @@ bgp_update_receive (struct peer *peer, bgp_size_t size) /* End-of-RIB received */ if (BGP_DEBUG (update, UPDATE_IN)) - zlog (peer->log, LOG_DEBUG, "rcvd End-of-RIB for VPNv4 Unicast from %s", + zlog (peer->log, LOG_DEBUG, + "rcvd End-of-RIB for VPNv4 Unicast from %s", peer->host); } } @@ -1821,10 +1822,6 @@ bgp_update_receive (struct peer *peer, bgp_size_t size) if (peer->state != bgp_peer_sEstablished) return 0; - /* Increment packet counter. */ - peer->update_in++; - peer->update_time = time (NULL); - /* Generate BGP event. */ /* TODO: is this needed? */ #if 0 @@ -1928,6 +1925,80 @@ bgp_keepalive_receive (struct peer *peer, bgp_size_t size) } #endif +/* Process incoming route refresh */ +void +bgp_route_refresh_recv(bgp_peer peer, bgp_route_refresh rr) +{ + afi_t afi; + safi_t safi; + vector_index i; + char name[BUFSIZ]; + int ret; + + afi = rr->afi; + safi = rr->safi; + + /* Adjust safi code. */ + if (safi == BGP_SAFI_VPNV4) + safi = SAFI_MPLS_VPN; + + /* ORF prefix-list name */ + ret = snprintf (name, BUFSIZ, "%s.%d.%d", peer->host, afi, safi); + assert(ret < BUFSIZ); + + if (rr->entries.end > 0) + { + for (i = 0; i < rr->entries.end; ++i) + { + bgp_orf_entry orfep = vector_slot(&rr->entries, i); + + /* ignore unknown */ + if (orfep->unknown) + continue; + + if (orfep->orf_type == BGP_ORF_T_PREFIX) + { + if (orfep->remove_all) + { + if (BGP_DEBUG (normal, NORMAL)) + zlog_debug ("%s rcvd Remove-All pfxlist ORF request", + peer->host); + prefix_bgp_orf_remove_all (name); + break; + } + + ret = prefix_bgp_orf_set (name, afi, &orfep->body.orf_prefix, + orfep->deny, orfep->remove); + + if (ret != CMD_SUCCESS) + { + if (BGP_DEBUG (normal, NORMAL)) + zlog_debug ("%s Received misformatted prefixlist ORF." + "Remove All pfxlist", peer->host); + prefix_bgp_orf_remove_all (name); + break; + } + + peer->orf_plist[afi][safi] = + prefix_list_lookup (AFI_ORF_PREFIX, name); + } + } + + if (BGP_DEBUG (normal, NORMAL)) + zlog_debug ("%s rcvd Refresh %s ORF request", peer->host, + rr->defer ? "Defer" : "Immediate"); + if (rr->defer) + return; + } + + /* First update is deferred until ORF or ROUTE-REFRESH is received */ + if (CHECK_FLAG (peer->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) + UNSET_FLAG (peer->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH); + + /* Perform route refreshment to the peer */ + bgp_announce_route (peer, afi, safi); +} + #if 0 /* Route refresh message is received. */ static void diff --git a/bgpd/bgp_packet.h b/bgpd/bgp_packet.h index c60bcf04..81937522 100644 --- a/bgpd/bgp_packet.h +++ b/bgpd/bgp_packet.h @@ -22,6 +22,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #define _QUAGGA_BGP_PACKET_H #include "bgpd/bgp_attr.h" +#include "bgpd/bgp_route_refresh.h" #define BGP_NLRI_LENGTH 1U #define BGP_TOTAL_ATTR_LEN 2U @@ -60,4 +61,6 @@ extern int bgp_capability_receive (struct peer *, bgp_size_t); extern int bgp_update_receive (struct peer *peer, bgp_size_t size); +extern void bgp_route_refresh_recv(bgp_peer peer, bgp_route_refresh rr); + #endif /* _QUAGGA_BGP_PACKET_H */ diff --git a/bgpd/bgp_peer.c b/bgpd/bgp_peer.c index 3dec683a..1a1d95de 100644 --- a/bgpd/bgp_peer.c +++ b/bgpd/bgp_peer.c @@ -424,18 +424,12 @@ bgp_peer_stop (struct peer *peer) peer->v_holdtime = peer->bgp->default_holdtime; } - peer->update_time = 0; - - /* Until we are sure that there is no problem about prefix count - this should be commented out.*/ -#if 0 /* Reset prefix count */ peer->pcount[AFI_IP][SAFI_UNICAST] = 0; peer->pcount[AFI_IP][SAFI_MULTICAST] = 0; peer->pcount[AFI_IP][SAFI_MPLS_VPN] = 0; peer->pcount[AFI_IP6][SAFI_UNICAST] = 0; peer->pcount[AFI_IP6][SAFI_MULTICAST] = 0; -#endif /* 0 */ return 0; } @@ -509,6 +503,7 @@ bgp_timer_set (struct peer *peer) case bgp_peer_sClearing: BGP_TIMER_OFF (peer->t_asorig); BGP_TIMER_OFF (peer->t_routeadv); + break; default: assert(0); } diff --git a/bgpd/bgp_peer.h b/bgpd/bgp_peer.h index 7d0bc76b..39a90a4e 100644 --- a/bgpd/bgp_peer.h +++ b/bgpd/bgp_peer.h @@ -304,21 +304,6 @@ struct peer /* workqueues */ struct work_queue *clear_node_queue; - /* Statistics field */ - u_int32_t open_in; /* Open message input count */ - u_int32_t open_out; /* Open message output count */ - u_int32_t update_in; /* Update message input count */ - u_int32_t update_out; /* Update message ouput count */ - time_t update_time; /* Update message received time. */ - u_int32_t keepalive_in; /* Keepalive input count */ - u_int32_t keepalive_out; /* Keepalive output count */ - u_int32_t notify_in; /* Notify input count */ - u_int32_t notify_out; /* Notify output count */ - u_int32_t refresh_in; /* Route Refresh input count */ - u_int32_t refresh_out; /* Route Refresh output count */ - u_int32_t dynamic_cap_in; /* Dynamic Capability input count. */ - u_int32_t dynamic_cap_out; /* Dynamic Capability output count. */ - /* BGP state count */ u_int32_t established; /* Established */ u_int32_t dropped; /* Dropped */ diff --git a/bgpd/bgp_session.c b/bgpd/bgp_session.c index 406e5a59..dcc338bf 100644 --- a/bgpd/bgp_session.c +++ b/bgpd/bgp_session.c @@ -794,8 +794,8 @@ bgp_session_do_update_recv(mqueue_block mqb, mqb_flag_t flag) /*============================================================================== * BGP Engine: received Route Refresh to peer * - * The Peering Engine takes care of discarding the bgp_route_refresh once it's been - * dealt with. + * The Peering Engine takes care of discarding the bgp_route_refresh once + * it's been dealt with. */ extern void bgp_session_route_refresh_recv(bgp_session session, bgp_route_refresh rr) @@ -813,8 +813,8 @@ bgp_session_route_refresh_recv(bgp_session session, bgp_route_refresh rr) } ; /*------------------------------------------------------------------------------ - * Peering Engine: receive given BGP route refresh message -- mqb action function. - * + * Peering Engine: receive given BGP route refresh message -- mqb action + * function. */ static void bgp_session_do_route_refresh_recv(mqueue_block mqb, mqb_flag_t flag) @@ -823,14 +823,11 @@ bgp_session_do_route_refresh_recv(mqueue_block mqb, mqb_flag_t flag) bgp_session session = mqb_get_arg0(mqb) ; if (flag == mqb_action) - { + bgp_route_refresh_recv(session->peer, args->rr); - /* TODO pricess route_refresh */ - } ; - - bgp_route_refresh_free(args->rr) ; - mqb_free(mqb) ; -} ; + bgp_route_refresh_free(args->rr); + mqb_free(mqb); +} /*============================================================================== * BGP Engine: send XON message to Peering Engine @@ -867,7 +864,7 @@ bgp_session_do_XON(mqueue_block mqb, mqb_flag_t flag) mqb_free(mqb) ; } /*============================================================================== - * Routing Engine: send ttl message to Peering Engine + * Peering Engine: send set ttl message to BGP Engine * */ void @@ -885,7 +882,7 @@ bgp_session_set_ttl(bgp_session session, int ttl) } /*------------------------------------------------------------------------------ - * BGP Engine: process incoming ttl message -- mqb action function. + * BGP Engine: process set ttl message -- mqb action function. */ static void bgp_session_do_set_ttl(mqueue_block mqb, mqb_flag_t flag) @@ -961,3 +958,24 @@ bgp_session_defer_if_limping(bgp_session session) return defer_enable ; } ; + +/* Get a copy of the session statistics, copied all at once so + * forms a consistent snapshot + * + */ +void +bgp_session_get_stats(bgp_session session, struct bgp_session_stats *stats) +{ + if (!session) + { + memset(stats, 0, sizeof(struct bgp_session_stats)) ; + return; + } + + BGP_SESSION_LOCK(session) ; /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ + + *stats = session->stats; + + BGP_SESSION_UNLOCK(session) ; /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ + +} diff --git a/bgpd/bgp_session.h b/bgpd/bgp_session.h index 52f22f49..e19b68b2 100644 --- a/bgpd/bgp_session.h +++ b/bgpd/bgp_session.h @@ -67,6 +67,24 @@ * */ +/* Statistics */ +struct bgp_session_stats +{ + u_int32_t open_in; /* Open message input count */ + u_int32_t open_out; /* Open message output count */ + u_int32_t update_in; /* Update message input count */ + u_int32_t update_out; /* Update message ouput count */ + time_t update_time; /* Update message received time. */ + u_int32_t keepalive_in; /* Keepalive input count */ + u_int32_t keepalive_out; /* Keepalive output count */ + u_int32_t notify_in; /* Notify input count */ + u_int32_t notify_out; /* Notify output count */ + u_int32_t refresh_in; /* Route Refresh input count */ + u_int32_t refresh_out; /* Route Refresh output count */ + u_int32_t dynamic_cap_in; /* Dynamic Capability input count. */ + u_int32_t dynamic_cap_out; /* Dynamic Capability output count. */ +}; + struct bgp_session { @@ -176,6 +194,9 @@ struct bgp_session union sockunion* su_local ; /* set when session Established */ union sockunion* su_remote ; /* set when session Established */ + /* Statistics */ + struct bgp_session_stats stats; + /* These values are are private to the BGP Engine. * * They must be cleared before the session is enabled, but may not be @@ -196,6 +217,7 @@ struct bgp_session flag_t active ; } ; + /*============================================================================== * Mqueue messages related to sessions * @@ -327,6 +349,9 @@ bgp_session_is_XON(bgp_peer peer); extern void bgp_session_set_ttl(bgp_session session, int ttl); +extern void +bgp_session_get_stats(bgp_session session, struct bgp_session_stats *stats); + /*============================================================================== * Session data access functions. * diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c index 0b0ef83b..ea934ea0 100644 --- a/bgpd/bgp_snmp.c +++ b/bgpd/bgp_snmp.c @@ -460,6 +460,7 @@ bgpPeerTable (struct variable *v, oid name[], size_t *length, { static struct in_addr addr; struct peer *peer; + struct bgp_session_stats stats; *write_method = NULL; memset (&addr, 0, sizeof (struct in_addr)); @@ -468,6 +469,8 @@ bgpPeerTable (struct variable *v, oid name[], size_t *length, if (! peer) return NULL; + bgp_session_get_stats(p->session, &stats); + switch (v->magic) { case BGPPEERIDENTIFIER: @@ -522,14 +525,14 @@ bgpPeerTable (struct variable *v, oid name[], size_t *length, return SNMP_INTEGER (peer->update_out); break; case BGPPEERINTOTALMESSAGES: - return SNMP_INTEGER (peer->open_in + peer->update_in - + peer->keepalive_in + peer->notify_in - + peer->refresh_in + peer->dynamic_cap_in); + return SNMP_INTEGER (stats.open_in + stats.update_in + + stats.keepalive_in + stats.notify_in + + stats.refresh_in + stats.dynamic_cap_in); break; case BGPPEEROUTTOTALMESSAGES: - return SNMP_INTEGER (peer->open_out + peer->update_out - + peer->keepalive_out + peer->notify_out - + peer->refresh_out + peer->dynamic_cap_out); + return SNMP_INTEGER (stats.open_out + stats.update_out + + stats.keepalive_out + stats.notify_out + + stats.refresh_out + stats.dynamic_cap_out); break; case BGPPEERLASTERROR: { @@ -547,7 +550,7 @@ bgpPeerTable (struct variable *v, oid name[], size_t *length, if (peer->uptime == 0) return SNMP_INTEGER (0); else - return SNMP_INTEGER (time (NULL) - peer->uptime); + return SNMP_INTEGER (time (NULL) - stats.uptime); break; case BGPPEERCONNECTRETRYINTERVAL: *write_method = write_bgpPeerTable; diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 05353bc8..1f29f6c2 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -49,6 +49,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "bgpd/bgp_zebra.h" #include "bgpd/bgp_table.h" #include "bgpd/bgp_vty.h" +#include "bgpd/bgp_session.h" extern struct in_addr router_id_zebra; @@ -6694,12 +6695,15 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi) unsigned int count = 0; char timebuf[BGP_UPTIME_LEN]; int len; + struct bgp_session_stats stats; /* Header string for each address family. */ static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) { + bgp_session_get_stats(peer->session, &stats); + if (peer->afc[afi][safi]) { if (!count) @@ -6758,11 +6762,11 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi) vty_out (vty, "%5u %7d %7d %8d %4d %4lu ", 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, + stats.open_in + stats.update_in + stats.keepalive_in + + stats.notify_in + stats.refresh_in + stats.dynamic_cap_in, + stats.open_out + stats.update_out + stats.keepalive_out + + stats.notify_out + stats.refresh_out + + stats.dynamic_cap_out, 0, 0, (unsigned long) peer->obuf->count); vty_out (vty, "%8s", @@ -7261,6 +7265,9 @@ bgp_show_peer (struct vty *vty, struct peer *p) char timebuf[BGP_UPTIME_LEN]; afi_t afi; safi_t safi; + struct bgp_session_stats stats; + + bgp_session_get_stats(p->session, &stats); bgp = p->bgp; @@ -7492,16 +7499,16 @@ bgp_show_peer (struct vty *vty, struct peer *p) vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE); vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); - vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); - vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); - vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); - vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); - vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); - vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); - vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + - p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, - p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + - p->dynamic_cap_in, VTY_NEWLINE); + vty_out (vty, " Opens: %10d %10d%s", stats.open_out, stats.open_in, VTY_NEWLINE); + vty_out (vty, " Notifications: %10d %10d%s", stats.notify_out, stats.notify_in, VTY_NEWLINE); + vty_out (vty, " Updates: %10d %10d%s", stats.update_out, stats.update_in, VTY_NEWLINE); + vty_out (vty, " Keepalives: %10d %10d%s", stats.keepalive_out, stats.keepalive_in, VTY_NEWLINE); + vty_out (vty, " Route Refresh: %10d %10d%s", stats.refresh_out, stats.refresh_in, VTY_NEWLINE); + vty_out (vty, " Capability: %10d %10d%s", stats.dynamic_cap_out, stats.dynamic_cap_in, VTY_NEWLINE); + vty_out (vty, " Total: %10d %10d%s", stats.open_out + stats.notify_out + + stats.update_out + stats.keepalive_out + stats.refresh_out + stats.dynamic_cap_out, + stats.open_in + stats.notify_in + stats.update_in + stats.keepalive_in + stats.refresh_in + + stats.dynamic_cap_in, VTY_NEWLINE); /* advertisement-interval */ vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index a5d73fdd..56358b97 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -4703,16 +4703,17 @@ bgp_terminate (int terminating, int retain_mode) struct listnode *mnode, *mnnode; bgp_notify notification = NULL; - if (!retain_mode) - notification = bgp_notify_new(BGP_NOTIFY_CEASE, - BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN, 0); - program_terminating = terminating; /* Disable all peers */ for (ALL_LIST_ELEMENTS (bm->bgp, mnode, mnnode, bgp)) for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) { + notification = (retain_mode) + ? NULL + : bgp_notify_new(BGP_NOTIFY_CEASE, + BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN, 0); + if (terminating) bgp_peer_disable(peer, notification); else |