summaryrefslogtreecommitdiffstats
path: root/bgpd/bgpd.c
diff options
context:
space:
mode:
authorDon Slice <dslice@cumulusnetworks.com>2018-06-15 23:08:53 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2018-08-14 22:02:05 +0200
commit14454c9fdd59340bbd71766b925f3ebb8fba13ba (patch)
tree2a0c20b157a40891e4f96fa2720887ebf6004ab4 /bgpd/bgpd.c
parentldpd: Convert to using LIB_ERR_XXX and zlog_ferr (diff)
downloadfrr-14454c9fdd59340bbd71766b925f3ebb8fba13ba.tar.xz
frr-14454c9fdd59340bbd71766b925f3ebb8fba13ba.zip
bgpd: implement zlog_ferr facility for enhance error messages in bgp
Signed-off-by: Don Slice <dslice@cumulusnetworks.com<
Diffstat (limited to 'bgpd/bgpd.c')
-rw-r--r--bgpd/bgpd.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 82da0245b..9d44b148c 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -52,6 +52,7 @@
#include "bgpd/bgp_route.h"
#include "bgpd/bgp_dump.h"
#include "bgpd/bgp_debug.h"
+#include "bgpd/bgp_errors.h"
#include "bgpd/bgp_community.h"
#include "bgpd/bgp_attr.h"
#include "bgpd/bgp_regex.h"
@@ -683,12 +684,6 @@ struct peer_af *peer_af_create(struct peer *peer, afi_t afi, safi_t safi)
/* Allocate new peer af */
af = XCALLOC(MTYPE_BGP_PEER_AF, sizeof(struct peer_af));
- if (af == NULL) {
- zlog_err("Could not create af structure for peer %s",
- peer->host);
- return NULL;
- }
-
peer->peer_af_array[afid] = af;
af->afi = afi;
af->safi = safi;
@@ -1809,8 +1804,8 @@ static int peer_activate_af(struct peer *peer, afi_t afi, safi_t safi)
int active;
if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) {
- zlog_err("%s was called for peer-group %s", __func__,
- peer->host);
+ zlog_ferr(BGP_ERR_PEER_GROUP, "%s was called for peer-group %s",
+ __func__, peer->host);
return 1;
}
@@ -1923,8 +1918,8 @@ static int non_peergroup_deactivate_af(struct peer *peer, afi_t afi,
safi_t safi)
{
if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) {
- zlog_err("%s was called for peer-group %s", __func__,
- peer->host);
+ zlog_ferr(BGP_ERR_PEER_GROUP, "%s was called for peer-group %s",
+ __func__, peer->host);
return 1;
}
@@ -1936,8 +1931,9 @@ static int non_peergroup_deactivate_af(struct peer *peer, afi_t afi,
peer->afc[afi][safi] = 0;
if (peer_af_delete(peer, afi, safi) != 0) {
- zlog_err("couldn't delete af structure for peer %s",
- peer->host);
+ zlog_ferr(BGP_ERR_PEER_DELETE,
+ "couldn't delete af structure for peer %s",
+ peer->host);
return 1;
}
@@ -1986,8 +1982,9 @@ int peer_deactivate(struct peer *peer, afi_t afi, safi_t safi)
group = peer->group;
if (peer_af_delete(peer, afi, safi) != 0) {
- zlog_err("couldn't delete af structure for peer %s",
- peer->host);
+ zlog_ferr(BGP_ERR_PEER_DELETE,
+ "couldn't delete af structure for peer %s",
+ peer->host);
}
for (ALL_LIST_ELEMENTS(group->peer, node, nnode, tmp_peer)) {