summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_mplsvpn.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/bgp_mplsvpn.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/bgp_mplsvpn.c')
-rw-r--r--bgpd/bgp_mplsvpn.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index f72104dd3..6c26ba782 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -33,6 +33,7 @@
#include "bgpd/bgpd.h"
#include "bgpd/bgp_debug.h"
+#include "bgpd/bgp_errors.h"
#include "bgpd/bgp_table.h"
#include "bgpd/bgp_route.h"
#include "bgpd/bgp_attr.h"
@@ -150,7 +151,8 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr,
psize = PSIZE(prefixlen);
if (prefixlen < VPN_PREFIXLEN_MIN_BYTES * 8) {
- zlog_err(
+ zlog_ferr(
+ BGP_ERR_UPDATE_RCV,
"%s [Error] Update packet error / VPN (prefix length %d less than VPN min length)",
peer->host, prefixlen);
return -1;
@@ -158,7 +160,8 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr,
/* sanity check against packet data */
if ((pnt + psize) > lim) {
- zlog_err(
+ zlog_ferr(
+ BGP_ERR_UPDATE_RCV,
"%s [Error] Update packet error / VPN (prefix length %d exceeds packet size %u)",
peer->host, prefixlen, (uint)(lim - pnt));
return -1;
@@ -166,7 +169,8 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr,
/* sanity check against storage for the IP address portion */
if ((psize - VPN_PREFIXLEN_MIN_BYTES) > (ssize_t)sizeof(p.u)) {
- zlog_err(
+ zlog_ferr(
+ BGP_ERR_UPDATE_RCV,
"%s [Error] Update packet error / VPN (psize %d exceeds storage size %zu)",
peer->host,
prefixlen - VPN_PREFIXLEN_MIN_BYTES * 8,
@@ -176,7 +180,8 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr,
/* Sanity check against max bitlen of the address family */
if ((psize - VPN_PREFIXLEN_MIN_BYTES) > prefix_blen(&p)) {
- zlog_err(
+ zlog_ferr(
+ BGP_ERR_UPDATE_RCV,
"%s [Error] Update packet error / VPN (psize %d exceeds family (%u) max byte len %u)",
peer->host,
prefixlen - VPN_PREFIXLEN_MIN_BYTES * 8,
@@ -213,7 +218,8 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr,
#endif
default:
- zlog_err("Unknown RD type %d", type);
+ zlog_ferr(BGP_ERR_UPDATE_RCV, "Unknown RD type %d",
+ type);
break; /* just report */
}
@@ -235,7 +241,8 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr,
}
/* Packet length consistency check. */
if (pnt != lim) {
- zlog_err(
+ zlog_ferr(
+ BGP_ERR_UPDATE_RCV,
"%s [Error] Update packet error / VPN (%zu data remaining after parsing)",
peer->host, lim - pnt);
return -1;
@@ -359,8 +366,10 @@ int vpn_leak_label_callback(
return 0;
}
/* Shouldn't happen: different label allocation */
- zlog_err("%s: %s had label %u but got new assignment %u",
- __func__, vp->bgp->name_pretty, vp->tovpn_label, label);
+ zlog_ferr(BGP_ERR_LABEL,
+ "%s: %s had label %u but got new assignment %u",
+ __func__, vp->bgp->name_pretty, vp->tovpn_label,
+ label);
/* use new one */
}