mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 06:50:17 +00:00
bgpd: count some per-peer stats (for BMP)
These counters are accessible through BMP and may be useful to monitor bgpd. A CLI to show them could also be added if people are interested. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
1a1f453436
commit
b4d46cc9b1
@ -1518,6 +1518,8 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
|
||||
|| BGP_DEBUG(update, UPDATE_PREFIX)) {
|
||||
ret = bgp_dump_attr(&attr, peer->rcvd_attr_str, BUFSIZ);
|
||||
|
||||
peer->stat_upd_7606++;
|
||||
|
||||
if (attr_parse_ret == BGP_ATTR_PARSE_WITHDRAW)
|
||||
flog_err(
|
||||
EC_BGP_UPDATE_RCV,
|
||||
|
@ -3068,6 +3068,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
|
||||
|
||||
if (aspath_loop_check(attr->aspath, peer->change_local_as)
|
||||
> aspath_loop_count) {
|
||||
peer->stat_pfx_aspath_loop++;
|
||||
reason = "as-path contains our own AS;";
|
||||
goto filtered;
|
||||
}
|
||||
@ -3088,6 +3089,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
|
||||
|| (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)
|
||||
&& aspath_loop_check(attr->aspath, bgp->confed_id)
|
||||
> peer->allowas_in[afi][safi])) {
|
||||
peer->stat_pfx_aspath_loop++;
|
||||
reason = "as-path contains our own AS;";
|
||||
goto filtered;
|
||||
}
|
||||
@ -3096,18 +3098,21 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
|
||||
/* Route reflector originator ID check. */
|
||||
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID)
|
||||
&& IPV4_ADDR_SAME(&bgp->router_id, &attr->originator_id)) {
|
||||
peer->stat_pfx_originator_loop++;
|
||||
reason = "originator is us;";
|
||||
goto filtered;
|
||||
}
|
||||
|
||||
/* Route reflector cluster ID check. */
|
||||
if (bgp_cluster_filter(peer, attr)) {
|
||||
peer->stat_pfx_cluster_loop++;
|
||||
reason = "reflected from the same cluster;";
|
||||
goto filtered;
|
||||
}
|
||||
|
||||
/* Apply incoming filter. */
|
||||
if (bgp_input_filter(peer, p, attr, afi, safi) == FILTER_DENY) {
|
||||
peer->stat_pfx_filter++;
|
||||
reason = "filter;";
|
||||
goto filtered;
|
||||
}
|
||||
@ -3138,6 +3143,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
|
||||
* the attr (which takes over the memory references) */
|
||||
if (bgp_input_modifier(peer, p, &new_attr, afi, safi, NULL)
|
||||
== RMAP_DENY) {
|
||||
peer->stat_pfx_filter++;
|
||||
reason = "route-map;";
|
||||
bgp_attr_flush(&new_attr);
|
||||
goto filtered;
|
||||
@ -3163,12 +3169,14 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
|
||||
/* next hop check. */
|
||||
if (!CHECK_FLAG(peer->flags, PEER_FLAG_IS_RFAPI_HD)
|
||||
&& bgp_update_martian_nexthop(bgp, afi, safi, &new_attr)) {
|
||||
peer->stat_pfx_nh_invalid++;
|
||||
reason = "martian or self next-hop;";
|
||||
bgp_attr_flush(&new_attr);
|
||||
goto filtered;
|
||||
}
|
||||
|
||||
if (bgp_mac_entry_exists(p) || bgp_mac_exist(&attr->rmac)) {
|
||||
peer->stat_pfx_nh_invalid++;
|
||||
reason = "self mac;";
|
||||
goto filtered;
|
||||
}
|
||||
@ -3727,6 +3735,8 @@ int bgp_withdraw(struct peer *peer, struct prefix *p, uint32_t addpath_id,
|
||||
if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)
|
||||
&& peer != bgp->peer_self)
|
||||
if (!bgp_adj_in_unset(rn, peer, addpath_id)) {
|
||||
peer->stat_pfx_dup_withdraw++;
|
||||
|
||||
if (bgp_debug_update(peer, p, NULL, 1)) {
|
||||
bgp_debug_rdpfxpath2str(
|
||||
afi, safi, prd, p, label, num_labels,
|
||||
|
@ -1077,6 +1077,14 @@ struct peer {
|
||||
_Atomic uint32_t dynamic_cap_in; /* Dynamic Capability input count. */
|
||||
_Atomic uint32_t dynamic_cap_out; /* Dynamic Capability output count. */
|
||||
|
||||
uint32_t stat_pfx_filter;
|
||||
uint32_t stat_pfx_aspath_loop;
|
||||
uint32_t stat_pfx_originator_loop;
|
||||
uint32_t stat_pfx_cluster_loop;
|
||||
uint32_t stat_pfx_nh_invalid;
|
||||
uint32_t stat_pfx_dup_withdraw;
|
||||
uint32_t stat_upd_7606; /* RFC7606: treat-as-withdraw */
|
||||
|
||||
/* BGP state count */
|
||||
uint32_t established; /* Established */
|
||||
uint32_t dropped; /* Dropped */
|
||||
|
Loading…
Reference in New Issue
Block a user