{
uint8_t val;
if ((val = stream_getc(s)))
- zlog_warn(
- "%s sent non-zero value, %u, for defunct SNPA-length field",
- peer->host, val);
+ flog_warn(BGP_WARN_DEFUNCT_SNPA_LEN,
+ "%s sent non-zero value, %u, for defunct SNPA-length field",
+ peer->host, val);
}
/* must have nrli_len, what is left of the attribute */
type = BGP_ATTR_LOCAL_PREF;
if (type) {
- zlog_warn("%s Missing well-known attribute %s.", peer->host,
+ flog_warn(BGP_WARN_MISSING_ATTRIBUTE,
+ "%s Missing well-known attribute %s.", peer->host,
lookup_msg(attr_str, type, NULL));
bgp_notify_send_with_data(peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MISS_ATTR, &type,
/* Check remaining length check.*/
if (endp - BGP_INPUT_PNT(peer) < BGP_ATTR_MIN_LEN) {
/* XXX warning: long int format, int arg (arg 5) */
- zlog_warn(
- "%s: error BGP attribute length %lu is smaller than min len",
- peer->host,
- (unsigned long)(endp
- - stream_pnt(BGP_INPUT(peer))));
+ flog_warn(BGP_WARN_ATTRIBUTE_TOO_SMALL,
+ "%s: error BGP attribute length %lu is smaller than min len",
+ peer->host,
+ (unsigned long)(endp
+ - stream_pnt(BGP_INPUT(peer))));
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR);
/* Check whether Extended-Length applies and is in bounds */
if (CHECK_FLAG(flag, BGP_ATTR_FLAG_EXTLEN)
&& ((endp - startp) < (BGP_ATTR_MIN_LEN + 1))) {
- zlog_warn(
- "%s: Extended length set, but just %lu bytes of attr header",
- peer->host,
- (unsigned long)(endp
- - stream_pnt(BGP_INPUT(peer))));
+ flog_warn(BGP_WARN_EXT_ATTRIBUTE_TOO_SMALL,
+ "%s: Extended length set, but just %lu bytes of attr header",
+ peer->host,
+ (unsigned long)(endp
+ - stream_pnt(BGP_INPUT(peer))));
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR);
List. */
if (CHECK_BITMAP(seen, type)) {
- zlog_warn(
- "%s: error BGP attribute type %d appears twice in a message",
- peer->host, type);
+ flog_warn(BGP_WARN_ATTRIBUTE_REPEATED,
+ "%s: error BGP attribute type %d appears twice in a message",
+ peer->host, type);
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MAL_ATTR);
attr_endp = BGP_INPUT_PNT(peer) + length;
if (attr_endp > endp) {
- zlog_warn(
- "%s: BGP type %d length %d is too large, attribute total length is %d. attr_endp is %p. endp is %p",
- peer->host, type, length, size, attr_endp,
- endp);
+ flog_warn(BGP_WARN_ATTRIBUTE_TOO_LARGE,
+ "%s: BGP type %d length %d is too large, attribute total length is %d. attr_endp is %p. endp is %p",
+ peer->host, type, length, size, attr_endp,
+ endp);
/*
* RFC 4271 6.3
* If any recognized attribute has an Attribute
/* If hard error occured immediately return to the caller. */
if (ret == BGP_ATTR_PARSE_ERROR) {
- zlog_warn("%s: Attribute %s, parse error", peer->host,
+ flog_warn(BGP_WARN_ATTRIBUTE_PARSE_ERROR,
+ "%s: Attribute %s, parse error", peer->host,
lookup_msg(attr_str, type, NULL));
if (as4_path)
aspath_unintern(&as4_path);
}
if (ret == BGP_ATTR_PARSE_WITHDRAW) {
- zlog_warn(
+ flog_warn(BGP_WARN_ATTRIBUTE_PARSE_WITHDRAW,
"%s: Attribute %s, parse error - treating as withdrawal",
peer->host, lookup_msg(attr_str, type, NULL));
if (as4_path)
/* Check the fetched length. */
if (BGP_INPUT_PNT(peer) != attr_endp) {
- zlog_warn("%s: BGP attribute %s, fetch error",
+ flog_warn(BGP_WARN_ATTRIBUTE_FETCH_ERROR,
+ "%s: BGP attribute %s, fetch error",
peer->host, lookup_msg(attr_str, type, NULL));
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR);
/* Check final read pointer is same as end pointer. */
if (BGP_INPUT_PNT(peer) != endp) {
- zlog_warn("%s: BGP attribute %s, length mismatch", peer->host,
+ flog_warn(BGP_WARN_ATTRIBUTES_MISMATCH,
+ "%s: BGP attribute %s, length mismatch", peer->host,
lookup_msg(attr_str, type, NULL));
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR);
#include "bgp_errors.h"
/* clang-format off */
+static struct log_ref ferr_bgp_warn[] = {
+ {
+ .code = BGP_WARN_ASPATH_FEWER_HOPS,
+ .title = "BGP AS-path conversion has failed",
+ .description = "BGP has attempted to convert a AS2 to AS4 path and has failed",
+ .suggestion = "Open an Issue with all relevant log files and restart FRR"
+ },
+ {
+ .code = BGP_WARN_DEFUNCT_SNPA_LEN,
+ .title = "BGP has received a value in a reserved field",
+ .description = "BGP has received a non-zero value in a reserved field that was used for SNPA-length at one point in time",
+ .suggestion = "BGP has peered with either a router that is attempting to send SNPA data or it has received a corrupted packet. If we are peering with a SNPA aware router(unlikely) upgrade that router, else open an Issue after gathering relevant log files",
+ },
+ {
+ .code = BGP_WARN_MISSING_ATTRIBUTE,
+ .title = "BGP has received an update with missing a missing attribute",
+ .description = "BGP received update packets must have some minimum attribute information within them",
+ .suggestion = "Gather log data from this and remote peer and open an Issue with this data",
+ },
+ {
+ .code = BGP_WARN_ATTRIBUTE_TOO_SMALL,
+ .title = "BGP udate packet with attribute data that is too small",
+ .description = "BGP has received an update packet that is too small to parse a given attribute. This typically means that something has gone wrong between us and the remote peer",
+ .suggestion = "Gather log data from this and remote peer and open an Issue with this data",
+ },
+ {
+ .code = BGP_WARN_EXT_ATTRIBUTE_TOO_SMALL,
+ .title = "BGP udate packet with extended attribute data that is too small",
+ .description = "BGP has received an update packet that is too small to parse a given extended attribute. This typically means that something has gone wrong between us and the remote peer",
+ .suggestion = "Gather log data from this and remote peer and open an Issue with this data",
+ },
+ {
+ .code = BGP_WARN_ATTRIBUTE_REPEATED,
+ .title = "BGP update packet received with a repeated attribute",
+ .description = "BGP has received an update packet with a attribute that is repeated more than one time for a particular route. This typically means that something has gone wrong between us and the remote peer",
+ .suggestion = "Gather log data from this and remote peer and open an Issue with this data",
+ },
+ {
+ .code = BGP_WARN_ATTRIBUTE_TOO_LARGE,
+ .title = "BGP udate packet with attribute data that is too large",
+ .description = "BGP has received an update packet that has too much data in a particular attribute. This typically means that something has gone wrong between us and the remote peer",
+ .suggestion = "Gather log data from this and remote peer and open an Issue with this data",
+ },
+ {
+ .code = BGP_WARN_ATTRIBUTE_PARSE_ERROR,
+ .title = "BGP update packet with attribute data has a parse error, specific to the attribute",
+ .description = "BGP has received an update packet with an attribute that when parsed does not make sense in some manner",
+ .suggestion = "Gather log data from this and remote peer and open an Issue with this data",
+ },
+ {
+ .code = BGP_WARN_ATTRIBUTE_PARSE_WITHDRAW,
+ .title = "BGP update packet with a broken optional attribute has caused a withdraw of associated routes",
+ .description = "BGP has received a update packet with optional attributes that did not parse correctly, instead of resetting the peer, withdraw associated routes and note that this has happened",
+ .suggestion = "Gather log data from this and remote peer and open an Issue with this data",
+ },
+ {
+ .code = BGP_WARN_ATTRIBUTE_FETCH_ERROR,
+ .title = "BGP update packet with a broken length",
+ .description = "BGP has received a update packet with an attribute that has an incorrect length",
+ .suggestion = "Gather log data from this and remote peer and open an Issue with this data",
+ },
+ {
+ .code = BGP_WARN_ATTRIBUTES_MISMATCH,
+ .title = "BGP update packet with a length different than attribute data length",
+ .description = "BGP has received a update packet with attributes that when parsed do not correctly add up to packet data length",
+ .suggestion = "Gather log data from this and remote peer and open an Issue with this data",
+ },
+ {
+ .code = END_FERR,
+ }
+};
+
static struct log_ref ferr_bgp_err[] = {
{
.code = BGP_ERR_ATTR_FLAG,
void bgp_error_init(void)
{
+ log_ref_add(ferr_bgp_warn);
log_ref_add(ferr_bgp_err);
}