summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_snmp_bgp4v2.c
diff options
context:
space:
mode:
authorFrancois Dumontet <francois.dumontet@6wind.com>2023-08-30 17:35:32 +0200
committerFrancois Dumontet <francois.dumontet@6wind.com>2023-10-24 17:16:47 +0200
commite6de67f1e5b2658067fa834be575bcdb20a6dd89 (patch)
tree27da4bc1104899f6f174d1b03857909387d804b7 /bgpd/bgp_snmp_bgp4v2.c
parentbgpd: add snmp traps for bgp4-mibv2 (diff)
downloadfrr-e6de67f1e5b2658067fa834be575bcdb20a6dd89.tar.xz
frr-e6de67f1e5b2658067fa834be575bcdb20a6dd89.zip
bgpd: add [no] bgp snmp traps bgp4-mibv2 command
There is no command to choose to send or not the bgp4-mibv2 traps. Since the MIB bgp4-mibv2 notification are redundant with MIB RFC4273 we added a command: - [no] bgp snmp traps bgp4-mibv2 By default, the bgp4-mibv2 traps will be disabled, to prevent from redundancy. Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
Diffstat (limited to 'bgpd/bgp_snmp_bgp4v2.c')
-rw-r--r--bgpd/bgp_snmp_bgp4v2.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/bgpd/bgp_snmp_bgp4v2.c b/bgpd/bgp_snmp_bgp4v2.c
index 768cd3a03..b7a5f94a3 100644
--- a/bgpd/bgp_snmp_bgp4v2.c
+++ b/bgpd/bgp_snmp_bgp4v2.c
@@ -825,7 +825,6 @@ static struct trap_object bgpv2TrapBackListv6[] = {
{ 6, { 1, 3, 1, BGP4V2_PEER_LAST_ERROR_RECEIVED_TEXT, 1, 2 } }
};
-
static struct variable bgpv2_variables[] = {
/* bgp4V2PeerEntry */
{BGP4V2_PEER_INSTANCE,
@@ -1450,6 +1449,9 @@ int bgpv2TrapEstablished(struct peer *peer)
oid index[sizeof(oid) * IN6_ADDR_SIZE];
size_t length;
+ if (!CHECK_FLAG(bm->options, BGP_OPT_TRAPS_BGP4MIBV2))
+ return 0;
+
/* Check if this peer just went to Established */
if ((peer->connection->ostatus != OpenConfirm) ||
!(peer_established(peer->connection)))
@@ -1475,8 +1477,7 @@ int bgpv2TrapEstablished(struct peer *peer)
BGP4V2ESTABLISHED);
break;
default:
- return 0;
- ;
+ break;
}
return 0;
@@ -1487,6 +1488,9 @@ int bgpv2TrapBackwardTransition(struct peer *peer)
oid index[sizeof(oid) * IN6_ADDR_SIZE];
size_t length;
+ if (!CHECK_FLAG(bm->options, BGP_OPT_TRAPS_BGP4MIBV2))
+ return 0;
+
switch (sockunion_family(&peer->connection->su)) {
case AF_INET:
oid_copy_in_addr(index, &peer->connection->su.sin.sin_addr);
@@ -1507,14 +1511,12 @@ int bgpv2TrapBackwardTransition(struct peer *peer)
BGP4V2BACKWARDTRANSITION);
break;
default:
- return 0;
- ;
+ break;
}
return 0;
}
-
int bgp_snmp_bgp4v2_init(struct event_loop *tm)
{
REGISTER_MIB("mibII/bgpv2", bgpv2_variables, variable, bgpv2_oid);