From e50f7cfdbd6d085cef2e2b60a213af8b971c4c93 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 13 Sep 2018 18:23:42 +0000 Subject: bgpd: BGP_[WARN|ERR] -> EC_BGP Signed-off-by: Quentin Young --- bgpd/bgp_aspath.c | 2 +- bgpd/bgp_attr.c | 74 ++++++++++++------------ bgpd/bgp_dump.c | 4 +- bgpd/bgp_errors.c | 144 ++++++++++++++++++++++----------------------- bgpd/bgp_errors.h | 148 +++++++++++++++++++++++------------------------ bgpd/bgp_evpn.c | 92 ++++++++++++++--------------- bgpd/bgp_evpn_vty.c | 4 +- bgpd/bgp_flowspec.c | 8 +-- bgpd/bgp_flowspec_util.c | 8 +-- bgpd/bgp_fsm.c | 20 +++---- bgpd/bgp_io.c | 2 +- bgpd/bgp_label.c | 14 ++--- bgpd/bgp_labelpool.c | 6 +- bgpd/bgp_main.c | 2 +- bgpd/bgp_mplsvpn.c | 14 ++--- bgpd/bgp_network.c | 6 +- bgpd/bgp_nht.c | 4 +- bgpd/bgp_open.c | 26 ++++----- bgpd/bgp_packet.c | 46 +++++++-------- bgpd/bgp_pbr.c | 6 +- bgpd/bgp_route.c | 14 ++--- bgpd/bgp_updgrp.c | 2 +- bgpd/bgp_updgrp_packet.c | 6 +- bgpd/bgp_vty.c | 2 +- bgpd/bgp_zebra.c | 10 ++-- bgpd/bgpd.c | 8 +-- 26 files changed, 336 insertions(+), 336 deletions(-) diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index b156cda86..1f8a910f2 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -1640,7 +1640,7 @@ struct aspath *aspath_reconcile_as4(struct aspath *aspath, if (hops < 0) { if (BGP_DEBUG(as4, AS4)) flog_warn( - BGP_WARN_ASPATH_FEWER_HOPS, + EC_BGP_ASPATH_FEWER_HOPS, "[AS4] Fewer hops in AS_PATH than NEW_AS_PATH"); /* Something's gone wrong. The RFC says we should now ignore * AS4_PATH, diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index a603bbcd8..8536561ef 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -998,7 +998,7 @@ bgp_attr_flags_diagnose(struct bgp_attr_parser_args *args, if (CHECK_FLAG(desired_flags, attr_flag_str[i].key) != CHECK_FLAG(real_flags, attr_flag_str[i].key)) { flog_err( - BGP_ERR_ATTR_FLAG, + EC_BGP_ATTR_FLAG, "%s attribute must%s be flagged as \"%s\"", lookup_msg(attr_str, attr_code, NULL), CHECK_FLAG(desired_flags, attr_flag_str[i].key) @@ -1063,7 +1063,7 @@ static int bgp_attr_flag_invalid(struct bgp_attr_parser_args *args) if (!CHECK_FLAG(BGP_ATTR_FLAG_OPTIONAL, flags) && !CHECK_FLAG(BGP_ATTR_FLAG_TRANS, flags)) { flog_err( - BGP_ERR_ATTR_FLAG, + EC_BGP_ATTR_FLAG, "%s well-known attributes must have transitive flag set (%x)", lookup_msg(attr_str, attr_code, NULL), flags); return 1; @@ -1075,7 +1075,7 @@ static int bgp_attr_flag_invalid(struct bgp_attr_parser_args *args) */ if (CHECK_FLAG(flags, BGP_ATTR_FLAG_PARTIAL)) { if (!CHECK_FLAG(flags, BGP_ATTR_FLAG_OPTIONAL)) { - flog_err(BGP_ERR_ATTR_FLAG, + flog_err(EC_BGP_ATTR_FLAG, "%s well-known attribute " "must NOT have the partial flag set (%x)", lookup_msg(attr_str, attr_code, NULL), flags); @@ -1083,7 +1083,7 @@ static int bgp_attr_flag_invalid(struct bgp_attr_parser_args *args) } if (CHECK_FLAG(flags, BGP_ATTR_FLAG_OPTIONAL) && !CHECK_FLAG(flags, BGP_ATTR_FLAG_TRANS)) { - flog_err(BGP_ERR_ATTR_FLAG, + flog_err(EC_BGP_ATTR_FLAG, "%s optional + transitive attribute " "must NOT have the partial flag set (%x)", lookup_msg(attr_str, attr_code, NULL), flags); @@ -1118,7 +1118,7 @@ static bgp_attr_parse_ret_t bgp_attr_origin(struct bgp_attr_parser_args *args) field contains the erroneous attribute (type, length and value). */ if (length != 1) { - flog_err(BGP_ERR_ATTR_LEN, + flog_err(EC_BGP_ATTR_LEN, "Origin attribute length is not one %d", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, args->total); @@ -1132,7 +1132,7 @@ static bgp_attr_parse_ret_t bgp_attr_origin(struct bgp_attr_parser_args *args) contains the unrecognized attribute (type, length and value). */ if ((attr->origin != BGP_ORIGIN_IGP) && (attr->origin != BGP_ORIGIN_EGP) && (attr->origin != BGP_ORIGIN_INCOMPLETE)) { - flog_err(BGP_ERR_ATTR_ORIGIN, + flog_err(EC_BGP_ATTR_ORIGIN, "Origin attribute value is invalid %d", attr->origin); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_INVAL_ORIGIN, args->total); @@ -1161,7 +1161,7 @@ static int bgp_attr_aspath(struct bgp_attr_parser_args *args) /* In case of IBGP, length will be zero. */ if (!attr->aspath) { - flog_err(BGP_ERR_ATTR_MAL_AS_PATH, + flog_err(EC_BGP_ATTR_MAL_AS_PATH, "Malformed AS path from %s, length is %d", peer->host, length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_MAL_AS_PATH, @@ -1191,7 +1191,7 @@ static bgp_attr_parse_ret_t bgp_attr_aspath_check(struct peer *const peer, && !aspath_left_confed_check(attr->aspath)) || (peer->sort == BGP_PEER_EBGP && aspath_confed_check(attr->aspath))) { - flog_err(BGP_ERR_ATTR_MAL_AS_PATH, "Malformed AS path from %s", + flog_err(EC_BGP_ATTR_MAL_AS_PATH, "Malformed AS path from %s", peer->host); bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_MAL_AS_PATH); @@ -1202,7 +1202,7 @@ static bgp_attr_parse_ret_t bgp_attr_aspath_check(struct peer *const peer, if (CHECK_FLAG(peer->flags, PEER_FLAG_ENFORCE_FIRST_AS)) { if (peer->sort == BGP_PEER_EBGP && !aspath_firstas_check(attr->aspath, peer->as)) { - flog_err(BGP_ERR_ATTR_FIRST_AS, + flog_err(EC_BGP_ATTR_FIRST_AS, "%s incorrect first AS (must be %u)", peer->host, peer->as); bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, @@ -1236,7 +1236,7 @@ static int bgp_attr_as4_path(struct bgp_attr_parser_args *args, /* In case of IBGP, length will be zero. */ if (!*as4_path) { - flog_err(BGP_ERR_ATTR_MAL_AS_PATH, + flog_err(EC_BGP_ATTR_MAL_AS_PATH, "Malformed AS4 path from %s, length is %d", peer->host, length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_MAL_AS_PATH, @@ -1260,7 +1260,7 @@ static bgp_attr_parse_ret_t bgp_attr_nexthop(struct bgp_attr_parser_args *args) /* Check nexthop attribute length. */ if (length != 4) { - flog_err(BGP_ERR_ATTR_LEN, + flog_err(EC_BGP_ATTR_LEN, "Nexthop attribute length isn't four [%d]", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, @@ -1285,7 +1285,7 @@ static bgp_attr_parse_ret_t bgp_attr_nexthop(struct bgp_attr_parser_args *args) { char buf[INET_ADDRSTRLEN]; inet_ntop(AF_INET, &nexthop_n, buf, INET_ADDRSTRLEN); - flog_err(BGP_ERR_ATTR_MARTIAN_NH, "Martian nexthop %s", buf); + flog_err(EC_BGP_ATTR_MARTIAN_NH, "Martian nexthop %s", buf); return bgp_attr_malformed( args, BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP, args->total); } @@ -1305,7 +1305,7 @@ static bgp_attr_parse_ret_t bgp_attr_med(struct bgp_attr_parser_args *args) /* Length check. */ if (length != 4) { - flog_err(BGP_ERR_ATTR_LEN, + flog_err(EC_BGP_ATTR_LEN, "MED attribute length isn't four [%d]", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, @@ -1329,7 +1329,7 @@ bgp_attr_local_pref(struct bgp_attr_parser_args *args) /* Length check. */ if (length != 4) { - flog_err(BGP_ERR_ATTR_LEN, + flog_err(EC_BGP_ATTR_LEN, "LOCAL_PREF attribute length isn't 4 [%u]", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, args->total); @@ -1359,7 +1359,7 @@ static int bgp_attr_atomic(struct bgp_attr_parser_args *args) /* Length check. */ if (length != 0) { - flog_err(BGP_ERR_ATTR_LEN, + flog_err(EC_BGP_ATTR_LEN, "ATOMIC_AGGREGATE attribute length isn't 0 [%u]", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, @@ -1386,7 +1386,7 @@ static int bgp_attr_aggregator(struct bgp_attr_parser_args *args) wantedlen = 8; if (length != wantedlen) { - flog_err(BGP_ERR_ATTR_LEN, + flog_err(EC_BGP_ATTR_LEN, "AGGREGATOR attribute length isn't %u [%u]", wantedlen, length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, @@ -1416,7 +1416,7 @@ bgp_attr_as4_aggregator(struct bgp_attr_parser_args *args, const bgp_size_t length = args->length; if (length != 8) { - flog_err(BGP_ERR_ATTR_LEN, + flog_err(EC_BGP_ATTR_LEN, "New Aggregator length is not 8 [%d]", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, 0); @@ -1576,7 +1576,7 @@ bgp_attr_originator_id(struct bgp_attr_parser_args *args) /* Length check. */ if (length != 4) { - flog_err(BGP_ERR_ATTR_LEN, "Bad originator ID length %d", + flog_err(EC_BGP_ATTR_LEN, "Bad originator ID length %d", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, @@ -1600,7 +1600,7 @@ bgp_attr_cluster_list(struct bgp_attr_parser_args *args) /* Check length. */ if (length % 4) { - flog_err(BGP_ERR_ATTR_LEN, "Bad cluster list length %d", + flog_err(EC_BGP_ATTR_LEN, "Bad cluster list length %d", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, @@ -1761,7 +1761,7 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args, uint8_t val; if ((val = stream_getc(s))) flog_warn( - BGP_WARN_DEFUNCT_SNPA_LEN, + EC_BGP_DEFUNCT_SNPA_LEN, "%s sent non-zero value, %u, for defunct SNPA-length field", peer->host, val); } @@ -2072,7 +2072,7 @@ static bgp_attr_parse_ret_t bgp_attr_psid_sub(int32_t type, if (type == BGP_PREFIX_SID_LABEL_INDEX) { if (length != BGP_PREFIX_SID_LABEL_INDEX_LENGTH) { flog_err( - BGP_ERR_ATTR_LEN, + EC_BGP_ATTR_LEN, "Prefix SID label index length is %d instead of %d", length, BGP_PREFIX_SID_LABEL_INDEX_LENGTH); return bgp_attr_malformed(args, @@ -2107,7 +2107,7 @@ static bgp_attr_parse_ret_t bgp_attr_psid_sub(int32_t type, /* Placeholder code for the IPv6 SID type */ else if (type == BGP_PREFIX_SID_IPV6) { if (length != BGP_PREFIX_SID_IPV6_LENGTH) { - flog_err(BGP_ERR_ATTR_LEN, + flog_err(EC_BGP_ATTR_LEN, "Prefix SID IPv6 length is %d instead of %d", length, BGP_PREFIX_SID_IPV6_LENGTH); return bgp_attr_malformed(args, @@ -2131,7 +2131,7 @@ static bgp_attr_parse_ret_t bgp_attr_psid_sub(int32_t type, if (length % BGP_PREFIX_SID_ORIGINATOR_SRGB_LENGTH) { flog_err( - BGP_ERR_ATTR_LEN, + EC_BGP_ATTR_LEN, "Prefix SID Originator SRGB length is %d, it must be a multiple of %d ", length, BGP_PREFIX_SID_ORIGINATOR_SRGB_LENGTH); return bgp_attr_malformed( @@ -2181,7 +2181,7 @@ bgp_attr_prefix_sid(int32_t tlength, struct bgp_attr_parser_args *args, if (tlength < 0) { flog_err( - BGP_ERR_ATTR_LEN, + EC_BGP_ATTR_LEN, "Prefix SID internal length %d causes us to read beyond the total Prefix SID length", length); return bgp_attr_malformed(args, @@ -2208,7 +2208,7 @@ bgp_attr_pmsi_tunnel(struct bgp_attr_parser_args *args) * can only support that. */ if (length < 2) { - flog_err(BGP_ERR_ATTR_LEN, + flog_err(EC_BGP_ATTR_LEN, "Bad PMSI tunnel attribute length %d", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, args->total); @@ -2216,14 +2216,14 @@ bgp_attr_pmsi_tunnel(struct bgp_attr_parser_args *args) stream_getc(peer->curr); /* Flags */ tnl_type = stream_getc(peer->curr); if (tnl_type > PMSI_TNLTYPE_MAX) { - flog_err(BGP_ERR_ATTR_PMSI_TYPE, + flog_err(EC_BGP_ATTR_PMSI_TYPE, "Invalid PMSI tunnel attribute type %d", tnl_type); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_OPT_ATTR_ERR, args->total); } if (tnl_type == PMSI_TNLTYPE_INGR_REPL) { if (length != 9) { - flog_err(BGP_ERR_ATTR_PMSI_LEN, + flog_err(EC_BGP_ATTR_PMSI_LEN, "Bad PMSI tunnel attribute length %d for IR", length); return bgp_attr_malformed( @@ -2337,7 +2337,7 @@ static int bgp_attr_check(struct peer *peer, struct attr *attr) type = BGP_ATTR_LOCAL_PREF; if (type) { - flog_warn(BGP_WARN_MISSING_ATTRIBUTE, + flog_warn(EC_BGP_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, @@ -2380,7 +2380,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, if (endp - BGP_INPUT_PNT(peer) < BGP_ATTR_MIN_LEN) { /* XXX warning: long int format, int arg (arg 5) */ flog_warn( - BGP_WARN_ATTRIBUTE_TOO_SMALL, + EC_BGP_ATTRIBUTE_TOO_SMALL, "%s: error BGP attribute length %lu is smaller than min len", peer->host, (unsigned long)(endp @@ -2403,7 +2403,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, if (CHECK_FLAG(flag, BGP_ATTR_FLAG_EXTLEN) && ((endp - startp) < (BGP_ATTR_MIN_LEN + 1))) { flog_warn( - BGP_WARN_EXT_ATTRIBUTE_TOO_SMALL, + EC_BGP_EXT_ATTRIBUTE_TOO_SMALL, "%s: Extended length set, but just %lu bytes of attr header", peer->host, (unsigned long)(endp @@ -2426,7 +2426,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, if (CHECK_BITMAP(seen, type)) { flog_warn( - BGP_WARN_ATTRIBUTE_REPEATED, + EC_BGP_ATTRIBUTE_REPEATED, "%s: error BGP attribute type %d appears twice in a message", peer->host, type); @@ -2445,7 +2445,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, if (attr_endp > endp) { flog_warn( - BGP_WARN_ATTRIBUTE_TOO_LARGE, + EC_BGP_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); @@ -2602,7 +2602,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, /* If hard error occured immediately return to the caller. */ if (ret == BGP_ATTR_PARSE_ERROR) { - flog_warn(BGP_WARN_ATTRIBUTE_PARSE_ERROR, + flog_warn(EC_BGP_ATTRIBUTE_PARSE_ERROR, "%s: Attribute %s, parse error", peer->host, lookup_msg(attr_str, type, NULL)); if (as4_path) @@ -2612,7 +2612,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, if (ret == BGP_ATTR_PARSE_WITHDRAW) { flog_warn( - BGP_WARN_ATTRIBUTE_PARSE_WITHDRAW, + EC_BGP_ATTRIBUTE_PARSE_WITHDRAW, "%s: Attribute %s, parse error - treating as withdrawal", peer->host, lookup_msg(attr_str, type, NULL)); if (as4_path) @@ -2622,7 +2622,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, /* Check the fetched length. */ if (BGP_INPUT_PNT(peer) != attr_endp) { - flog_warn(BGP_WARN_ATTRIBUTE_FETCH_ERROR, + flog_warn(EC_BGP_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, @@ -2635,7 +2635,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, /* Check final read pointer is same as end pointer. */ if (BGP_INPUT_PNT(peer) != endp) { - flog_warn(BGP_WARN_ATTRIBUTES_MISMATCH, + flog_warn(EC_BGP_ATTRIBUTES_MISMATCH, "%s: BGP attribute %s, length mismatch", peer->host, lookup_msg(attr_str, type, NULL)); bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, @@ -2831,7 +2831,7 @@ size_t bgp_packet_mpattr_start(struct stream *s, struct peer *peer, afi_t afi, default: if (safi != SAFI_FLOWSPEC) flog_err( - BGP_ERR_ATTR_NH_SEND_LEN, + EC_BGP_ATTR_NH_SEND_LEN, "Bad nexthop when sending to %s, AFI %u SAFI %u nhlen %d", peer->host, afi, safi, attr->mp_nexthop_len); break; diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 49f27d298..ef746597a 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -120,7 +120,7 @@ static FILE *bgp_dump_open_file(struct bgp_dump *bgp_dump) ret = strftime(realpath, MAXPATHLEN, bgp_dump->filename, tm); if (ret == 0) { - flog_warn(BGP_WARN_DUMP, "bgp_dump_open_file: strftime error"); + flog_warn(EC_BGP_DUMP, "bgp_dump_open_file: strftime error"); return NULL; } @@ -132,7 +132,7 @@ static FILE *bgp_dump_open_file(struct bgp_dump *bgp_dump) bgp_dump->fp = fopen(realpath, "w"); if (bgp_dump->fp == NULL) { - flog_warn(BGP_WARN_DUMP, "bgp_dump_open_file: %s: %s", realpath, + flog_warn(EC_BGP_DUMP, "bgp_dump_open_file: %s: %s", realpath, strerror(errno)); umask(oldumask); return NULL; diff --git a/bgpd/bgp_errors.c b/bgpd/bgp_errors.c index 827927f1b..bd42901c2 100644 --- a/bgpd/bgp_errors.c +++ b/bgpd/bgp_errors.c @@ -26,163 +26,163 @@ /* clang-format off */ static struct log_ref ferr_bgp_warn[] = { { - .code = BGP_WARN_ASPATH_FEWER_HOPS, + .code = EC_BGP_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, + .code = EC_BGP_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, + .code = EC_BGP_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, + .code = EC_BGP_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, + .code = EC_BGP_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, + .code = EC_BGP_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, + .code = EC_BGP_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, + .code = EC_BGP_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, + .code = EC_BGP_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, + .code = EC_BGP_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, + .code = EC_BGP_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 = BGP_WARN_DUMP, + .code = EC_BGP_DUMP, .title = "BGP MRT dump subsystem has encountered an issue", .description = "BGP has found that the attempted write of MRT data to a dump file has failed", .suggestion = "Ensure BGP has permissions to write the specified file", }, { - .code = BGP_WARN_UPDATE_PACKET_SHORT, + .code = EC_BGP_UPDATE_PACKET_SHORT, .title = "BGP Update Packet is to Small", .description = "The update packet received from a peer is to small", .suggestion = "Determine the source of the update packet and examine that peer for what has gone wrong", }, { - .code = BGP_WARN_UPDATE_PACKET_LONG, + .code = EC_BGP_UPDATE_PACKET_LONG, .title = "BGP Update Packet is to large", .description = "The update packet received from a peer is to large", .suggestion = "Determine the source of the update packet and examine that peer for what has gone wrong", }, { - .code = BGP_WARN_UNRECOGNIZED_CAPABILITY, + .code = EC_BGP_UNRECOGNIZED_CAPABILITY, .title = "Unknown BGP Capability Received", .description = "The negotiation of capabilities has received a capability that we do not know what to do with", .suggestion = "Determine the source of the capability and remove the capability from what is sent", }, { - .code = BGP_WARN_NO_TCP_MD5, + .code = EC_BGP_NO_TCP_MD5, .title = "Unable to set TCP MD5 option on socket", .description = "BGP attempted to setup TCP MD5 configuration on the socket as per configuration but was unable to", .suggestion = "Please collect log files and open Issue", }, { - .code = BGP_WARN_NO_SOCKOPT_MARK, + .code = EC_BGP_NO_SOCKOPT_MARK, .title = "Unable to set socket MARK option", .description = "BGP attempted to set the SO_MARK option for a socket and was unable to do so", .suggestion = "Please collect log files and open Issue", }, { - .code = BGP_WARN_EVPN_PMSI_PRESENT, + .code = EC_BGP_EVPN_PMSI_PRESENT, .title = "BGP Received a EVPN NLRI with PMSI included", .description = "BGP has received a type-3 NLRI with PMSI information. At this time FRR is not capable of properly handling this NLRI type", .suggestion = "Setup peer to not send this type of data to FRR" }, { - .code = BGP_WARN_EVPN_VPN_VNI, + .code = EC_BGP_EVPN_VPN_VNI, .title = "BGP has received a local macip and cannot properly handle it", .description = "BGP has received a local macip from zebra and has no way to properly handle the macip because the vni is not setup properly", .suggestion = "Ensure proper setup of BGP EVPN", }, { - .code = BGP_WARN_EVPN_ESI, + .code = EC_BGP_EVPN_ESI, .title = "BGP has received a local ESI for deletion", .description = "BGP has received a local ESI for deletion but when attempting to find the stored data internally was unable to find the information for deletion", .suggestion = "Gather logging and open an Issue", }, { - .code = BGP_WARN_INVALID_LABEL_STACK, + .code = EC_BGP_INVALID_LABEL_STACK, .title = "BGP has received a label stack in a NLRI that does not have the BOS marked", .description = "BGP when it receives a NLRI with a label stack should have the BOS marked, this received packet does not have this", .suggestion = "Gather log information from here and remote peer and open an Issue", }, { - .code = BGP_WARN_ZEBRA_SEND, + .code = EC_BGP_ZEBRA_SEND, .title = "BGP has attempted to send data to zebra and has failed to do so", .description = "BGP has attempted to send data to zebra but has been unable to do so", .suggestion = "Gather log data, open an Issue and restart FRR" }, { - .code = BGP_WARN_CAPABILITY_INVALID_LENGTH, + .code = EC_BGP_CAPABILITY_INVALID_LENGTH, .title = "BGP has received a capability with an invalid length", .description = "BGP has received a capability from it's peer who's size is wrong", .suggestion = "Gather log files from here and from peer and open an Issue", }, { - .code = BGP_WARN_CAPABILITY_INVALID_DATA, + .code = EC_BGP_CAPABILITY_INVALID_DATA, .title = "BGP has received capability data with invalid information", .description = "BGP has noticed that during processing of capability information that data was wrong", .suggestion = "Gather log files from here and from peer and open an Issue", }, { - .code = BGP_WARN_CAPABILITY_VENDOR, + .code = EC_BGP_CAPABILITY_VENDOR, .title = "BGP has recieved capability data specific to a particular vendor", .description = "BGP has received a capability that is vendor specific and as such we have no knowledge of how to use this capability in FRR", .suggestion = "On peer turn off this feature" }, { - .code = BGP_WARN_CAPABILITY_UNKNOWN, + .code = EC_BGP_CAPABILITY_UNKNOWN, .title = "BGP has received capability data for a unknown capability", .description = "BGP has received a capability that it does not know how to decode. This may be due to a new feature that has not been coded into FRR or it may be a bug in the remote peer", .suggestion = "Gather log files from here and from peer and open an Issue", }, { - .code = BGP_WARN_INVALID_NEXTHOP_LENGTH, + .code = EC_BGP_INVALID_NEXTHOP_LENGTH, .title = "BGP is attempting to write an invalid nexthop length value", .description = "BGP is in the process of building NLRI information for a peer and has discovered an inconsistent internal state", .suggestion = "Gather log files and open an Issue, restart FRR", @@ -194,270 +194,270 @@ static struct log_ref ferr_bgp_warn[] = { static struct log_ref ferr_bgp_err[] = { { - .code = BGP_ERR_ATTR_FLAG, + .code = EC_BGP_ATTR_FLAG, .title = "BGP attribute flag is incorrect", .description = "BGP attribute flag is set to the wrong value (Optional/Transitive/Partial)", .suggestion = "Determine the soure of the attribute and determine why the attribute flag has been set incorrectly" }, { - .code = BGP_ERR_ATTR_LEN, + .code = EC_BGP_ATTR_LEN, .title = "BGP attribute length is incorrect", .description = "BGP attribute length is incorrect", .suggestion = "Determine the soure of the attribute and determine why the attribute length has been set incorrectly" }, { - .code = BGP_ERR_ATTR_ORIGIN, + .code = EC_BGP_ATTR_ORIGIN, .title = "BGP attribute origin value invalid", .description = "BGP attribute origin value is invalid", .suggestion = "Determine the soure of the attribute and determine why the origin attribute has been set incorrectly" }, { - .code = BGP_ERR_ATTR_MAL_AS_PATH, + .code = EC_BGP_ATTR_MAL_AS_PATH, .title = "BGP as path is invalid", .description = "BGP as path has been malformed", .suggestion = "Determine the soure of the update and determine why the as path has been set incorrectly" }, { - .code = BGP_ERR_ATTR_FIRST_AS, + .code = EC_BGP_ATTR_FIRST_AS, .title = "BGP as path first as is invalid", .description = "BGP update has invalid first as in as path", .suggestion = "Determine the soure of the update and determine why the as path first as value has been set incorrectly" }, { - .code = BGP_ERR_ATTR_PMSI_TYPE, + .code = EC_BGP_ATTR_PMSI_TYPE, .title = "BGP PMSI tunnel attribute type is invalid", .description = "BGP update has invalid type for PMSI tunnel", .suggestion = "Determine the soure of the update and determine why the PMSI tunnel attribute type has been set incorrectly" }, { - .code = BGP_ERR_ATTR_PMSI_LEN, + .code = EC_BGP_ATTR_PMSI_LEN, .title = "BGP PMSI tunnel attribute length is invalid", .description = "BGP update has invalid length for PMSI tunnel", .suggestion = "Determine the soure of the update and determine why the PMSI tunnel attribute length has been set incorrectly" }, { - .code = BGP_ERR_PEER_GROUP, + .code = EC_BGP_PEER_GROUP, .title = "BGP peergroup operated on in error", .description = "BGP operating on peer-group instead of peers included", .suggestion = "Ensure the config doesn't contain peergroups contained within peergroups" }, { - .code = BGP_ERR_PEER_DELETE, + .code = EC_BGP_PEER_DELETE, .title = "BGP failed to delete peer structure", .description = "BGP was unable to delete peer structure when address-family removed", .suggestion = "Determine if all expected peers are removed and restart FRR if not. Most likely a bug" }, { - .code = BGP_ERR_TABLE_CHUNK, + .code = EC_BGP_TABLE_CHUNK, .title = "BGP failed to get table chunk memory", .description = "BGP unable to get chunk memory for table manager", .suggestion = "Ensure there is adequate memory on the device to support the table requirements" }, { - .code = BGP_ERR_MACIP_LEN, + .code = EC_BGP_MACIP_LEN, .title = "BGP received MACIP with invalid IP addr len", .description = "BGP received MACIP with invalid IP addr len from Zebra", .suggestion = "Verify MACIP entries inserted in Zebra are correct. Most likely a bug" }, { - .code = BGP_ERR_LM_ERROR, + .code = EC_BGP_LM_ERROR, .title = "BGP received invalid label manager message", .description = "BGP received invalid label manager message from label manager", .suggestion = "Label manager sent invalid essage to BGP for wrong protocol, instance, etc. Most likely a bug" }, { - .code = BGP_ERR_JSON_MEM_ERROR, + .code = EC_BGP_JSON_MEM_ERROR, .title = "BGP unable to allocate memory for JSON output", .description = "BGP attempted to generate JSON output and was unable to allocate the memory required", .suggestion = "Ensure that the device has adequate memory to suport the required functions" }, { - .code = BGP_ERR_UPDGRP_ATTR_LEN, + .code = EC_BGP_UPDGRP_ATTR_LEN, .title = "BGP update had attributes too long to send", .description = "BGP attempted to send an update but the attributes were too long to fit", .suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting" }, { - .code = BGP_ERR_UPDGRP_CREATE, + .code = EC_BGP_UPDGRP_CREATE, .title = "BGP update group creation failed", .description = "BGP attempted to create an update group but was unable to", .suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting" }, { - .code = BGP_ERR_UPDATE_SND, + .code = EC_BGP_UPDATE_SND, .title = "BGP error creating update packet", .description = "BGP attempted to create an update packet but was unable to", .suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting" }, { - .code = BGP_ERR_PKT_OPEN, + .code = EC_BGP_PKT_OPEN, .title = "BGP error receiving open packet", .description = "BGP received an open from a peer that was invalid", .suggestion = "Determine the sending peer and correct his invalid open packet" }, { - .code = BGP_ERR_SND_FAIL, + .code = EC_BGP_SND_FAIL, .title = "BGP error sending to peer", .description = "BGP attempted to respond to open from a peer and failed", .suggestion = "BGP attempted to respond to an open and could not sene the packet. Check local IP address for source" }, { - .code = BGP_ERR_INVALID_STATUS, + .code = EC_BGP_INVALID_STATUS, .title = "BGP error receiving from peer", .description = "BGP received an update from a peer but status was incorrect", .suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting" }, { - .code = BGP_ERR_UPDATE_RCV, + .code = EC_BGP_UPDATE_RCV, .title = "BGP error receiving update packet", .description = "BGP received an invalid update packet", .suggestion = "Determine the source of the update and resolve the invalid update being sent" }, { - .code = BGP_ERR_NO_CAP, + .code = EC_BGP_NO_CAP, .title = "BGP error due to capability not enabled", .description = "BGP attempted a function that did not have the capability enabled", .suggestion = "Enable the capability if this functionality is desired" }, { - .code = BGP_ERR_NOTIFY_RCV, + .code = EC_BGP_NOTIFY_RCV, .title = "BGP error receiving notify message", .description = "BGP unable to process notification message", .suggestion = "BGP notify received while in stopped state. If the problem persists, report for troubleshooting" }, { - .code = BGP_ERR_KEEP_RCV, + .code = EC_BGP_KEEP_RCV, .title = "BGP error receiving keepalive packet", .description = "BGP unable to process keepalive packet", .suggestion = "BGP keepalive received while in stopped state. If the problem persists, report for troubleshooting" }, { - .code = BGP_ERR_RFSH_RCV, + .code = EC_BGP_RFSH_RCV, .title = "BGP error receiving route refresh message", .description = "BGP unable to process route refresh message", .suggestion = "BGP route refresh received while in stopped state. If the problem persists, report for troubleshooting"}, { - .code = BGP_ERR_CAP_RCV, + .code = EC_BGP_CAP_RCV, .title = "BGP error capability message", .description = "BGP unable to process received capability", .suggestion = "BGP capability message received while in stopped state. If the problem persists, report for troubleshooting" }, { - .code = BGP_ERR_NH_UPD, + .code = EC_BGP_NH_UPD, .title = "BGP error with nexthopo update", .description = "BGP unable to process nexthop update", .suggestion = "BGP received nexthop update but nexthop is not reachable in this bgp instance. Report for troubleshooting" }, { - .code = BGP_ERR_LABEL, + .code = EC_BGP_LABEL, .title = "Failure to apply label", .description = "BGP attempted to attempted to apply a label but could not", .suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting" }, { - .code = BGP_ERR_MULTIPATH, + .code = EC_BGP_MULTIPATH, .title = "Multipath specified is invalid", .description = "BGP was started with an invalid ecmp/multipath value", .suggestion = "Correct the ecmp/multipath value supplied when starting the BGP daemon" }, { - .code = BGP_ERR_PKT_PROCESS, + .code = EC_BGP_PKT_PROCESS, .title = "Failure to process a packet", .description = "BGP attempted to process a received packet but could not", .suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting" }, { - .code = BGP_ERR_CONNECT, + .code = EC_BGP_CONNECT, .title = "Failure to connect to peer", .description = "BGP attempted to send open to peer but couldn't connect", .suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting" }, { - .code = BGP_ERR_FSM, + .code = EC_BGP_FSM, .title = "BGP FSM issue", .description = "BGP neighbor transition problem", .suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting" }, { - .code = BGP_ERR_VNI, + .code = EC_BGP_VNI, .title = "BGP VNI creation issue", .description = "BGP could not create a new VNI", .suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting" }, { - .code = BGP_ERR_NO_DFLT, + .code = EC_BGP_NO_DFLT, .title = "BGP default instance missing", .description = "BGP could not find default instance", .suggestion = "Define a default instance of BGP since some feature requires it's existence" }, { - .code = BGP_ERR_VTEP_INVALID, + .code = EC_BGP_VTEP_INVALID, .title = "BGP remote VTEP invalid", .description = "BGP remote VTEP is invalid and cannot be used", .suggestion = "Correct remote VTEP configuration or resolve the source of the problem" }, { - .code = BGP_ERR_ES_INVALID, + .code = EC_BGP_ES_INVALID, .title = "BGP ES route error", .description = "BGP ES route incorrect, learned both local and remote", .suggestion = "Correct configuration or addressing so that same not learned both local and remote" }, { - .code = BGP_ERR_EVPN_ROUTE_DELETE, + .code = EC_BGP_EVPN_ROUTE_DELETE, .title = "BGP EVPN route delete error", .description = "BGP attempted to delete an EVPN route and failed", .suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting" }, { - .code = BGP_ERR_EVPN_FAIL, + .code = EC_BGP_EVPN_FAIL, .title = "BGP EVPN install/uninstall error", .description = "BGP attempted to install or uninstall an EVPN prefix and failed", .suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting" }, { - .code = BGP_ERR_EVPN_ROUTE_INVALID, + .code = EC_BGP_EVPN_ROUTE_INVALID, .title = "BGP EVPN route received with invalid contents", .description = "BGP received an EVPN route with invalid contents", .suggestion = "Determine the source of the EVPN route and resolve whatever is causing invalid contents" }, { - .code = BGP_ERR_EVPN_ROUTE_CREATE, + .code = EC_BGP_EVPN_ROUTE_CREATE, .title = "BGP EVPN route create error", .description = "BGP attempted to create an EVPN route and failed", .suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting" }, { - .code = BGP_ERR_ES_CREATE, + .code = EC_BGP_ES_CREATE, .title = "BGP EVPN ES entry create error", .description = "BGP attempted to create an EVPN ES entry and failed", .suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting" }, { - .code = BGP_ERR_MULTI_INSTANCE, + .code = EC_BGP_MULTI_INSTANCE, .title = "BGP config multi-instance issue", .description = "BGP configuration attempting multiple instances without enabling the feature", .suggestion = "Correct the configuration so that bgp multiple-instance is enabled if desired" }, { - .code = BGP_ERR_EVPN_AS_MISMATCH, + .code = EC_BGP_EVPN_AS_MISMATCH, .title = "BGP AS configuration issue", .description = "BGP configuration attempted for a different AS than currently configured", .suggestion = "Correct the configuration so that the correct BGP AS number is used" }, { - .code = BGP_ERR_EVPN_INSTANCE_MISMATCH, + .code = EC_BGP_EVPN_INSTANCE_MISMATCH, .title = "BGP EVPN AS and process name mismatch", .description = "BGP configuration has AS and process name mismatch", .suggestion = "Correct the configuration so that the BGP AS number and instance name are consistent" }, { - .code = BGP_ERR_FLOWSPEC_PACKET, + .code = EC_BGP_FLOWSPEC_PACKET, .title = "BGP Flowspec packet processing error", .description = "The BGP flowspec subsystem has detected a error in the send or receive of a packet", .suggestion = "Gather log files from both sides of the peering relationship and open an issue" }, { - .code = BGP_ERR_FLOWSPEC_INSTALLATION, + .code = EC_BGP_FLOWSPEC_INSTALLATION, .title = "BGP Flowspec Installation/removal Error", .description = "The BGP flowspec subsystem has detected that there was a failure for installation/removal/modification of Flowspec from the dataplane", .suggestion = "Gather log files from the router and open an issue, Restart FRR" diff --git a/bgpd/bgp_errors.h b/bgpd/bgp_errors.h index f7db77ac3..853f2da22 100644 --- a/bgpd/bgp_errors.h +++ b/bgpd/bgp_errors.h @@ -25,80 +25,80 @@ enum bgp_log_refs { - BGP_ERR_ATTR_FLAG = BGP_FERR_START, - BGP_ERR_ATTR_LEN, - BGP_ERR_ATTR_ORIGIN, - BGP_ERR_ATTR_MAL_AS_PATH, - BGP_ERR_ATTR_FIRST_AS, - BGP_ERR_ATTR_MARTIAN_NH, - BGP_ERR_ATTR_PMSI_TYPE, - BGP_ERR_ATTR_PMSI_LEN, - BGP_ERR_ATTR_NH_SEND_LEN, - BGP_ERR_PEER_GROUP, - BGP_ERR_PEER_DELETE, - BGP_ERR_TABLE_CHUNK, - BGP_ERR_MACIP_LEN, - BGP_ERR_LM_ERROR, - BGP_ERR_JSON_MEM_ERROR, - BGP_ERR_UPDGRP_ATTR_LEN, - BGP_ERR_UPDGRP_CREATE, - BGP_ERR_UPDATE_SND, - BGP_ERR_PKT_OPEN, - BGP_ERR_SND_FAIL, - BGP_ERR_INVALID_STATUS, - BGP_ERR_UPDATE_RCV, - BGP_ERR_NO_CAP, - BGP_ERR_NOTIFY_RCV, - BGP_ERR_KEEP_RCV, - BGP_ERR_RFSH_RCV, - BGP_ERR_CAP_RCV, - BGP_ERR_NH_UPD, - BGP_ERR_LABEL, - BGP_ERR_MULTIPATH, - BGP_ERR_PKT_PROCESS, - BGP_ERR_CONNECT, - BGP_ERR_FSM, - BGP_ERR_VNI, - BGP_ERR_NO_DFLT, - BGP_ERR_VTEP_INVALID, - BGP_ERR_ES_INVALID, - BGP_ERR_EVPN_ROUTE_DELETE, - BGP_ERR_EVPN_FAIL, - BGP_ERR_EVPN_ROUTE_INVALID, - BGP_ERR_EVPN_ROUTE_CREATE, - BGP_ERR_ES_CREATE, - BGP_ERR_MULTI_INSTANCE, - BGP_ERR_EVPN_AS_MISMATCH, - BGP_ERR_EVPN_INSTANCE_MISMATCH, - BGP_ERR_FLOWSPEC_PACKET, - BGP_ERR_FLOWSPEC_INSTALLATION, - BGP_WARN_ASPATH_FEWER_HOPS, - BGP_WARN_DEFUNCT_SNPA_LEN, - BGP_WARN_MISSING_ATTRIBUTE, - BGP_WARN_ATTRIBUTE_TOO_SMALL, - BGP_WARN_EXT_ATTRIBUTE_TOO_SMALL, - BGP_WARN_ATTRIBUTE_REPEATED, - BGP_WARN_ATTRIBUTE_TOO_LARGE, - BGP_WARN_ATTRIBUTE_PARSE_ERROR, - BGP_WARN_ATTRIBUTE_PARSE_WITHDRAW, - BGP_WARN_ATTRIBUTE_FETCH_ERROR, - BGP_WARN_ATTRIBUTES_MISMATCH, - BGP_WARN_DUMP, - BGP_WARN_UPDATE_PACKET_SHORT, - BGP_WARN_UPDATE_PACKET_LONG, - BGP_WARN_UNRECOGNIZED_CAPABILITY, - BGP_WARN_NO_TCP_MD5, - BGP_WARN_NO_SOCKOPT_MARK, - BGP_WARN_EVPN_PMSI_PRESENT, - BGP_WARN_EVPN_VPN_VNI, - BGP_WARN_EVPN_ESI, - BGP_WARN_INVALID_LABEL_STACK, - BGP_WARN_ZEBRA_SEND, - BGP_WARN_CAPABILITY_INVALID_LENGTH, - BGP_WARN_CAPABILITY_INVALID_DATA, - BGP_WARN_CAPABILITY_VENDOR, - BGP_WARN_CAPABILITY_UNKNOWN, - BGP_WARN_INVALID_NEXTHOP_LENGTH, + EC_BGP_ATTR_FLAG = BGP_FERR_START, + EC_BGP_ATTR_LEN, + EC_BGP_ATTR_ORIGIN, + EC_BGP_ATTR_MAL_AS_PATH, + EC_BGP_ATTR_FIRST_AS, + EC_BGP_ATTR_MARTIAN_NH, + EC_BGP_ATTR_PMSI_TYPE, + EC_BGP_ATTR_PMSI_LEN, + EC_BGP_ATTR_NH_SEND_LEN, + EC_BGP_PEER_GROUP, + EC_BGP_PEER_DELETE, + EC_BGP_TABLE_CHUNK, + EC_BGP_MACIP_LEN, + EC_BGP_LM_ERROR, + EC_BGP_JSON_MEM_ERROR, + EC_BGP_UPDGRP_ATTR_LEN, + EC_BGP_UPDGRP_CREATE, + EC_BGP_UPDATE_SND, + EC_BGP_PKT_OPEN, + EC_BGP_SND_FAIL, + EC_BGP_INVALID_STATUS, + EC_BGP_UPDATE_RCV, + EC_BGP_NO_CAP, + EC_BGP_NOTIFY_RCV, + EC_BGP_KEEP_RCV, + EC_BGP_RFSH_RCV, + EC_BGP_CAP_RCV, + EC_BGP_NH_UPD, + EC_BGP_LABEL, + EC_BGP_MULTIPATH, + EC_BGP_PKT_PROCESS, + EC_BGP_CONNECT, + EC_BGP_FSM, + EC_BGP_VNI, + EC_BGP_NO_DFLT, + EC_BGP_VTEP_INVALID, + EC_BGP_ES_INVALID, + EC_BGP_EVPN_ROUTE_DELETE, + EC_BGP_EVPN_FAIL, + EC_BGP_EVPN_ROUTE_INVALID, + EC_BGP_EVPN_ROUTE_CREATE, + EC_BGP_ES_CREATE, + EC_BGP_MULTI_INSTANCE, + EC_BGP_EVPN_AS_MISMATCH, + EC_BGP_EVPN_INSTANCE_MISMATCH, + EC_BGP_FLOWSPEC_PACKET, + EC_BGP_FLOWSPEC_INSTALLATION, + EC_BGP_ASPATH_FEWER_HOPS, + EC_BGP_DEFUNCT_SNPA_LEN, + EC_BGP_MISSING_ATTRIBUTE, + EC_BGP_ATTRIBUTE_TOO_SMALL, + EC_BGP_EXT_ATTRIBUTE_TOO_SMALL, + EC_BGP_ATTRIBUTE_REPEATED, + EC_BGP_ATTRIBUTE_TOO_LARGE, + EC_BGP_ATTRIBUTE_PARSE_ERROR, + EC_BGP_ATTRIBUTE_PARSE_WITHDRAW, + EC_BGP_ATTRIBUTE_FETCH_ERROR, + EC_BGP_ATTRIBUTES_MISMATCH, + EC_BGP_DUMP, + EC_BGP_UPDATE_PACKET_SHORT, + EC_BGP_UPDATE_PACKET_LONG, + EC_BGP_UNRECOGNIZED_CAPABILITY, + EC_BGP_NO_TCP_MD5, + EC_BGP_NO_SOCKOPT_MARK, + EC_BGP_EVPN_PMSI_PRESENT, + EC_BGP_EVPN_VPN_VNI, + EC_BGP_EVPN_ESI, + EC_BGP_INVALID_LABEL_STACK, + EC_BGP_ZEBRA_SEND, + EC_BGP_CAPABILITY_INVALID_LENGTH, + EC_BGP_CAPABILITY_INVALID_DATA, + EC_BGP_CAPABILITY_VENDOR, + EC_BGP_CAPABILITY_UNKNOWN, + EC_BGP_INVALID_NEXTHOP_LENGTH, }; extern void bgp_error_init(void); diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 3bd566e07..b0849b00e 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -173,7 +173,7 @@ static struct vrf_irt_node *vrf_import_rt_new(struct ecommunity_val *rt) bgp_def = bgp_get_default(); if (!bgp_def) { - flog_err(BGP_ERR_NO_DFLT, + flog_err(EC_BGP_NO_DFLT, "vrf import rt new - def instance not created yet"); return NULL; } @@ -204,7 +204,7 @@ static void vrf_import_rt_free(struct vrf_irt_node *irt) bgp_def = bgp_get_default(); if (!bgp_def) { - flog_err(BGP_ERR_NO_DFLT, + flog_err(EC_BGP_NO_DFLT, "vrf import rt free - def instance not created yet"); return; } @@ -227,7 +227,7 @@ static struct vrf_irt_node *lookup_vrf_import_rt(struct ecommunity_val *rt) bgp_def = bgp_get_default(); if (!bgp_def) { flog_err( - BGP_ERR_NO_DFLT, + EC_BGP_NO_DFLT, "vrf import rt lookup - def instance not created yet"); return NULL; } @@ -628,7 +628,7 @@ static int bgp_zebra_send_remote_vtep(struct bgp *bgp, struct bgpevpn *vpn, stream_put_in_addr(s, &p->prefix.imet_addr.ip.ipaddr_v4); else if (is_evpn_prefix_ipaddr_v6(p)) { flog_err( - BGP_ERR_VTEP_INVALID, + EC_BGP_VTEP_INVALID, "Bad remote IP when trying to %s remote VTEP for VNI %u", add ? "ADD" : "DEL", vpn->vni); return -1; @@ -1302,7 +1302,7 @@ static int update_evpn_type4_route_entry(struct bgp *bgp, */ if (remote_ri) { flog_err( - BGP_ERR_ES_INVALID, + EC_BGP_ES_INVALID, "%u ERROR: local es route for ESI: %s Vtep %s also learnt from remote", bgp->vrf_id, esi_to_str(&evp->prefix.es_addr.esi, buf, sizeof(buf)), @@ -1390,7 +1390,7 @@ static int update_evpn_type4_route(struct bgp *bgp, &route_changed); if (ret != 0) { flog_err( - BGP_ERR_ES_INVALID, + EC_BGP_ES_INVALID, "%u ERROR: Failed to updated ES route ESI: %s VTEP %s", bgp->vrf_id, esi_to_str(&p->prefix.es_addr.esi, buf, sizeof(buf)), @@ -2191,7 +2191,7 @@ static int delete_routes_for_es(struct bgp *bgp, struct evpnes *es) build_evpn_type4_prefix(&p, &es->esi, es->originator_ip.ipaddr_v4); ret = delete_evpn_type4_route(bgp, es, &p); if (ret) { - flog_err(BGP_ERR_EVPN_ROUTE_DELETE, + flog_err(EC_BGP_EVPN_ROUTE_DELETE, "%u failed to delete type-4 route for ESI %s", bgp->vrf_id, esi_to_str(&es->esi, buf, sizeof(buf))); } @@ -2851,7 +2851,7 @@ static int install_uninstall_routes_for_es(struct bgp *bgp, if (ret) { flog_err( - BGP_ERR_EVPN_FAIL, + EC_BGP_EVPN_FAIL, "Failed to %s EVPN %s route in ESI %s", install ? "install" : "uninstall", @@ -2931,7 +2931,7 @@ static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf, int install) if (ret) { flog_err( - BGP_ERR_EVPN_FAIL, + EC_BGP_EVPN_FAIL, "Failed to %s EVPN %s route in VRF %s", install ? "install" : "uninstall", @@ -3005,7 +3005,7 @@ static int install_uninstall_routes_for_vni(struct bgp *bgp, if (ret) { flog_err( - BGP_ERR_EVPN_FAIL, + EC_BGP_EVPN_FAIL, "%u: Failed to %s EVPN %s route in VNI %u", bgp->vrf_id, install ? "install" @@ -3108,7 +3108,7 @@ static int install_uninstall_route_in_es(struct bgp *bgp, struct evpnes *es, if (ret) { flog_err( - BGP_ERR_EVPN_FAIL, + EC_BGP_EVPN_FAIL, "%u: Failed to %s EVPN %s route in ESI %s", bgp->vrf_id, install ? "install" : "uninstall", "ES", esi_to_str(&evp->prefix.es_addr.esi, buf, sizeof(buf))); @@ -3150,7 +3150,7 @@ static int install_uninstall_route_in_vrfs(struct bgp *bgp_def, afi_t afi, ri); if (ret) { - flog_err(BGP_ERR_EVPN_FAIL, + flog_err(EC_BGP_EVPN_FAIL, "%u: Failed to %s prefix %s in VRF %s", bgp_def->vrf_id, install ? "install" : "uninstall", @@ -3187,7 +3187,7 @@ static int install_uninstall_route_in_vnis(struct bgp *bgp, afi_t afi, if (ret) { flog_err( - BGP_ERR_EVPN_FAIL, + EC_BGP_EVPN_FAIL, "%u: Failed to %s EVPN %s route in VNI %u", bgp->vrf_id, install ? "install" : "uninstall", evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE @@ -3559,7 +3559,7 @@ static int process_type2_route(struct peer *peer, afi_t afi, safi_t safi, */ if (psize != 33 && psize != 37 && psize != 49 && psize != 36 && psize != 40 && psize != 52) { - flog_err(BGP_ERR_EVPN_ROUTE_INVALID, + flog_err(EC_BGP_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-2 NLRI with invalid length %d", peer->bgp->vrf_id, peer->host, psize); return -1; @@ -3597,7 +3597,7 @@ static int process_type2_route(struct peer *peer, afi_t afi, safi_t safi, pfx += ETH_ALEN; } else { flog_err( - BGP_ERR_EVPN_ROUTE_INVALID, + EC_BGP_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-2 NLRI with unsupported MAC address length %d", peer->bgp->vrf_id, peer->host, macaddr_len); return -1; @@ -3609,7 +3609,7 @@ static int process_type2_route(struct peer *peer, afi_t afi, safi_t safi, if (ipaddr_len != 0 && ipaddr_len != IPV4_MAX_BITLEN && ipaddr_len != IPV6_MAX_BITLEN) { flog_err( - BGP_ERR_EVPN_ROUTE_INVALID, + EC_BGP_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-2 NLRI with unsupported IP address length %d", peer->bgp->vrf_id, peer->host, ipaddr_len); return -1; @@ -3670,7 +3670,7 @@ static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi, * IP len (1) and IP (4 or 16). */ if (psize != 17 && psize != 29) { - flog_err(BGP_ERR_EVPN_ROUTE_INVALID, + flog_err(EC_BGP_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-3 NLRI with invalid length %d", peer->bgp->vrf_id, peer->host, psize); return -1; @@ -3684,7 +3684,7 @@ static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi, (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL))) { if (attr->pmsi_tnl_type != PMSI_TNLTYPE_INGR_REPL) { flog_warn( - BGP_WARN_EVPN_PMSI_PRESENT, + EC_BGP_EVPN_PMSI_PRESENT, "%u:%s - Rx EVPN Type-3 NLRI with unsupported PTA %d", peer->bgp->vrf_id, peer->host, attr->pmsi_tnl_type); @@ -3715,7 +3715,7 @@ static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi, memcpy(&p.prefix.imet_addr.ip.ip.addr, pfx, IPV4_MAX_BYTELEN); } else { flog_err( - BGP_ERR_EVPN_ROUTE_INVALID, + EC_BGP_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-3 NLRI with unsupported IP address length %d", peer->bgp->vrf_id, peer->host, ipaddr_len); return -1; @@ -3751,7 +3751,7 @@ static int process_type4_route(struct peer *peer, afi_t afi, safi_t safi, * RD (8), ESI (10), ip-len (1), ip (4 or 16) */ if (psize != 23 && psize != 35) { - flog_err(BGP_ERR_EVPN_ROUTE_INVALID, + flog_err(EC_BGP_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-4 NLRI with invalid length %d", peer->bgp->vrf_id, peer->host, psize); return -1; @@ -3774,7 +3774,7 @@ static int process_type4_route(struct peer *peer, afi_t afi, safi_t safi, memcpy(&vtep_ip, pfx, IPV4_MAX_BYTELEN); } else { flog_err( - BGP_ERR_EVPN_ROUTE_INVALID, + EC_BGP_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-4 NLRI with unsupported IP address length %d", peer->bgp->vrf_id, peer->host, ipaddr_len); return -1; @@ -3816,7 +3816,7 @@ static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi, * Note that the IP and GW should both be IPv4 or both IPv6. */ if (psize != 34 && psize != 58) { - flog_err(BGP_ERR_EVPN_ROUTE_INVALID, + flog_err(EC_BGP_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-5 NLRI with invalid length %d", peer->bgp->vrf_id, peer->host, psize); return -1; @@ -3850,7 +3850,7 @@ static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi, ippfx_len = *pfx++; if (ippfx_len > IPV6_MAX_BITLEN) { flog_err( - BGP_ERR_EVPN_ROUTE_INVALID, + EC_BGP_EVPN_ROUTE_INVALID, "%u:%s - Rx EVPN Type-5 NLRI with invalid IP Prefix length %d", peer->bgp->vrf_id, peer->host, ippfx_len); return -1; @@ -4077,7 +4077,7 @@ void bgp_evpn_withdraw_type5_route(struct bgp *bgp_vrf, struct prefix *p, ret = delete_evpn_type5_route(bgp_vrf, &evp); if (ret) { flog_err( - BGP_ERR_EVPN_ROUTE_DELETE, + EC_BGP_EVPN_ROUTE_DELETE, "%u failed to delete type-5 route for prefix %s in vrf %s", bgp_vrf->vrf_id, prefix2str(p, buf, sizeof(buf)), vrf_id_to_name(bgp_vrf->vrf_id)); @@ -4123,7 +4123,7 @@ void bgp_evpn_advertise_type5_route(struct bgp *bgp_vrf, struct prefix *p, build_type5_prefix_from_ip_prefix(&evp, p); ret = update_evpn_type5_route(bgp_vrf, &evp, src_attr); if (ret) - flog_err(BGP_ERR_EVPN_ROUTE_CREATE, + flog_err(EC_BGP_EVPN_ROUTE_CREATE, "%u: Failed to create type-5 route for prefix %s", bgp_vrf->vrf_id, prefix2str(p, buf, sizeof(buf))); } @@ -4684,7 +4684,7 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr, withdraw ? NULL : attr, pnt, psize, addpath_id)) { flog_err( - BGP_ERR_EVPN_FAIL, + EC_BGP_EVPN_FAIL, "%u:%s - Error in processing EVPN type-2 NLRI size %d", peer->bgp->vrf_id, peer->host, psize); return -1; @@ -4696,7 +4696,7 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr, withdraw ? NULL : attr, pnt, psize, addpath_id)) { flog_err( - BGP_ERR_PKT_PROCESS, + EC_BGP_PKT_PROCESS, "%u:%s - Error in processing EVPN type-3 NLRI size %d", peer->bgp->vrf_id, peer->host, psize); return -1; @@ -4708,7 +4708,7 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr, withdraw ? NULL : attr, pnt, psize, addpath_id)) { flog_err( - BGP_ERR_PKT_PROCESS, + EC_BGP_PKT_PROCESS, "%u:%s - Error in processing EVPN type-4 NLRI size %d", peer->bgp->vrf_id, peer->host, psize); return -1; @@ -4719,7 +4719,7 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr, if (process_type5_route(peer, afi, safi, attr, pnt, psize, addpath_id, withdraw)) { flog_err( - BGP_ERR_PKT_PROCESS, + EC_BGP_PKT_PROCESS, "%u:%s - Error in processing EVPN type-5 NLRI size %d", peer->bgp->vrf_id, peer->host, psize); return -1; @@ -5164,7 +5164,7 @@ int bgp_evpn_local_macip_del(struct bgp *bgp, vni_t vni, struct ethaddr *mac, /* Lookup VNI hash - should exist. */ vpn = bgp_evpn_lookup_vni(bgp, vni); if (!vpn || !is_vni_live(vpn)) { - flog_warn(BGP_WARN_EVPN_VPN_VNI, + flog_warn(EC_BGP_EVPN_VPN_VNI, "%u: VNI hash entry for VNI %u %s at MACIP DEL", bgp->vrf_id, vni, vpn ? "not live" : "not found"); return -1; @@ -5189,7 +5189,7 @@ int bgp_evpn_local_macip_add(struct bgp *bgp, vni_t vni, struct ethaddr *mac, /* Lookup VNI hash - should exist. */ vpn = bgp_evpn_lookup_vni(bgp, vni); if (!vpn || !is_vni_live(vpn)) { - flog_warn(BGP_WARN_EVPN_VPN_VNI, + flog_warn(EC_BGP_EVPN_VPN_VNI, "%u: VNI hash entry for VNI %u %s at MACIP ADD", bgp->vrf_id, vni, vpn ? "not live" : "not found"); return -1; @@ -5202,7 +5202,7 @@ int bgp_evpn_local_macip_add(struct bgp *bgp, vni_t vni, struct ethaddr *mac, char buf2[INET6_ADDRSTRLEN]; flog_err( - BGP_ERR_EVPN_ROUTE_CREATE, + EC_BGP_EVPN_ROUTE_CREATE, "%u:Failed to create Type-2 route, VNI %u %s MAC %s IP %s (flags: 0x%x)", bgp->vrf_id, vpn->vni, CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY) @@ -5244,7 +5244,7 @@ int bgp_evpn_local_l3vni_add(vni_t l3vni, vrf_id_t vrf_id, struct ethaddr *rmac, bgp_def = bgp_get_default(); if (!bgp_def) { flog_err( - BGP_ERR_NO_DFLT, + EC_BGP_NO_DFLT, "Cannot process L3VNI %u ADD - default BGP instance not yet created", l3vni); return -1; @@ -5261,15 +5261,15 @@ int bgp_evpn_local_l3vni_add(vni_t l3vni, vrf_id_t vrf_id, struct ethaddr *rmac, BGP_INSTANCE_TYPE_VRF); switch (ret) { case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: - flog_err(BGP_ERR_MULTI_INSTANCE, + flog_err(EC_BGP_MULTI_INSTANCE, "'bgp multiple-instance' not present\n"); return -1; case BGP_ERR_AS_MISMATCH: - flog_err(BGP_ERR_EVPN_AS_MISMATCH, + flog_err(EC_BGP_EVPN_AS_MISMATCH, "BGP is already running; AS is %u\n", as); return -1; case BGP_ERR_INSTANCE_MISMATCH: - flog_err(BGP_ERR_EVPN_INSTANCE_MISMATCH, + flog_err(EC_BGP_EVPN_INSTANCE_MISMATCH, "BGP instance name and AS number mismatch\n"); return -1; } @@ -5332,7 +5332,7 @@ int bgp_evpn_local_l3vni_del(vni_t l3vni, vrf_id_t vrf_id) bgp_vrf = bgp_lookup_by_vrf_id(vrf_id); if (!bgp_vrf) { flog_err( - BGP_ERR_NO_DFLT, + EC_BGP_NO_DFLT, "Cannot process L3VNI %u Del - Could not find BGP instance", l3vni); return -1; @@ -5341,7 +5341,7 @@ int bgp_evpn_local_l3vni_del(vni_t l3vni, vrf_id_t vrf_id) bgp_def = bgp_get_default(); if (!bgp_def) { flog_err( - BGP_ERR_NO_DFLT, + EC_BGP_NO_DFLT, "Cannot process L3VNI %u Del - Could not find default BGP instance", l3vni); return -1; @@ -5403,7 +5403,7 @@ int bgp_evpn_local_vni_del(struct bgp *bgp, vni_t vni) if (!vpn) { if (bgp_debug_zebra(NULL)) flog_warn( - BGP_WARN_EVPN_VPN_VNI, + EC_BGP_EVPN_VPN_VNI, "%u: VNI hash entry for VNI %u not found at DEL", bgp->vrf_id, vni); return 0; @@ -5473,7 +5473,7 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni, vpn = bgp_evpn_new(bgp, vni, originator_ip, tenant_vrf_id); if (!vpn) { flog_err( - BGP_ERR_VNI, + EC_BGP_VNI, "%u: Failed to allocate VNI entry for VNI %u - at Add", bgp->vrf_id, vni); return -1; @@ -5496,7 +5496,7 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni, /* Create EVPN type-3 route and schedule for processing. */ build_evpn_type3_prefix(&p, vpn->originator_ip); if (update_evpn_route(bgp, vpn, &p, 0, 0)) { - flog_err(BGP_ERR_EVPN_ROUTE_CREATE, + flog_err(EC_BGP_EVPN_ROUTE_CREATE, "%u: Type3 route creation failure for VNI %u", bgp->vrf_id, vni); return -1; @@ -5526,7 +5526,7 @@ int bgp_evpn_local_es_del(struct bgp *bgp, struct evpnes *es = NULL; if (!bgp->esihash) { - flog_err(BGP_ERR_ES_CREATE, "%u: ESI hash not yet created", + flog_err(EC_BGP_ES_CREATE, "%u: ESI hash not yet created", bgp->vrf_id); return -1; } @@ -5534,7 +5534,7 @@ int bgp_evpn_local_es_del(struct bgp *bgp, /* Lookup ESI hash - should exist. */ es = bgp_evpn_lookup_es(bgp, esi); if (!es) { - flog_warn(BGP_WARN_EVPN_ESI, + flog_warn(EC_BGP_EVPN_ESI, "%u: ESI hash entry for ESI %s at Local ES DEL", bgp->vrf_id, esi_to_str(esi, buf, sizeof(buf))); return -1; @@ -5563,7 +5563,7 @@ int bgp_evpn_local_es_add(struct bgp *bgp, struct prefix_evpn p; if (!bgp->esihash) { - flog_err(BGP_ERR_ES_CREATE, "%u: ESI hash not yet created", + flog_err(EC_BGP_ES_CREATE, "%u: ESI hash not yet created", bgp->vrf_id); return -1; } @@ -5574,7 +5574,7 @@ int bgp_evpn_local_es_add(struct bgp *bgp, es = bgp_evpn_es_new(bgp, esi, originator_ip); if (!es) { flog_err( - BGP_ERR_ES_CREATE, + EC_BGP_ES_CREATE, "%u: Failed to allocate ES entry for ESI %s - at Local ES Add", bgp->vrf_id, esi_to_str(esi, buf, sizeof(buf))); return -1; @@ -5585,7 +5585,7 @@ int bgp_evpn_local_es_add(struct bgp *bgp, build_evpn_type4_prefix(&p, esi, originator_ip->ipaddr_v4); if (update_evpn_type4_route(bgp, es, &p)) { - flog_err(BGP_ERR_EVPN_ROUTE_CREATE, + flog_err(EC_BGP_EVPN_ROUTE_CREATE, "%u: Type4 route creation failure for ESI %s", bgp->vrf_id, esi_to_str(esi, buf, sizeof(buf))); return -1; diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index a6cc2d9b5..062e0a4a2 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -1890,7 +1890,7 @@ static struct bgpevpn *evpn_create_update_vni(struct bgp *bgp, vni_t vni) if (!vpn) { /* Check if this L2VNI is already configured as L3VNI */ if (bgp_evpn_lookup_l3vni_l2vni_table(vni)) { - flog_err(BGP_ERR_VNI, + flog_err(EC_BGP_VNI, "%u: Failed to create L2VNI %u, it is configured as L3VNI", bgp->vrf_id, vni); return NULL; @@ -1902,7 +1902,7 @@ static struct bgpevpn *evpn_create_update_vni(struct bgp *bgp, vni_t vni) vpn = bgp_evpn_new(bgp, vni, bgp->router_id, 0); if (!vpn) { flog_err( - BGP_ERR_VNI, + EC_BGP_VNI, "%u: Failed to allocate VNI entry for VNI %u - at Config", bgp->vrf_id, vni); return NULL; diff --git a/bgpd/bgp_flowspec.c b/bgpd/bgp_flowspec.c index c604135bf..0560844ec 100644 --- a/bgpd/bgp_flowspec.c +++ b/bgpd/bgp_flowspec.c @@ -110,7 +110,7 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr, } if (packet->length >= FLOWSPEC_NLRI_SIZELIMIT) { - flog_err(BGP_ERR_FLOWSPEC_PACKET, + flog_err(EC_BGP_FLOWSPEC_PACKET, "BGP flowspec nlri length maximum reached (%u)", packet->length); return -1; @@ -128,13 +128,13 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr, /* When packet overflow occur return immediately. */ if (pnt + psize > lim) { - flog_err(BGP_ERR_FLOWSPEC_PACKET, + flog_err(EC_BGP_FLOWSPEC_PACKET, "Flowspec NLRI length inconsistent ( size %u seen)", psize); return -1; } if (bgp_fs_nlri_validate(pnt, psize) < 0) { - flog_err(BGP_ERR_FLOWSPEC_PACKET, + flog_err(EC_BGP_FLOWSPEC_PACKET, "Bad flowspec format or NLRI options not supported"); return -1; } @@ -188,7 +188,7 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, NULL, NULL, 0, NULL); if (ret) { - flog_err(BGP_ERR_FLOWSPEC_INSTALLATION, + flog_err(EC_BGP_FLOWSPEC_INSTALLATION, "Flowspec NLRI failed to be %s.", attr ? "added" : "withdrawn"); return -1; diff --git a/bgpd/bgp_flowspec_util.c b/bgpd/bgp_flowspec_util.c index 9f92a3c3a..1ae2a8875 100644 --- a/bgpd/bgp_flowspec_util.c +++ b/bgpd/bgp_flowspec_util.c @@ -68,7 +68,7 @@ static int bgp_flowspec_call_non_opaque_decode(uint8_t *nlri_content, int len, len, mval, error); if (*error < 0) - flog_err(BGP_ERR_FLOWSPEC_PACKET, + flog_err(EC_BGP_FLOWSPEC_PACKET, "%s: flowspec_op_decode error %d", __func__, *error); else @@ -447,7 +447,7 @@ int bgp_flowspec_match_rules_fill(uint8_t *nlri_content, int len, len - offset, prefix, &error); if (error < 0) - flog_err(BGP_ERR_FLOWSPEC_PACKET, + flog_err(EC_BGP_FLOWSPEC_PACKET, "%s: flowspec_ip_address error %d", __func__, error); else @@ -542,7 +542,7 @@ int bgp_flowspec_match_rules_fill(uint8_t *nlri_content, int len, len - offset, &bpem->tcpflags, &error); if (error < 0) - flog_err(BGP_ERR_FLOWSPEC_PACKET, + flog_err(EC_BGP_FLOWSPEC_PACKET, "%s: flowspec_tcpflags_decode error %d", __func__, error); else @@ -557,7 +557,7 @@ int bgp_flowspec_match_rules_fill(uint8_t *nlri_content, int len, len - offset, &bpem->fragment, &error); if (error < 0) - flog_err(BGP_ERR_FLOWSPEC_PACKET, + flog_err(EC_BGP_FLOWSPEC_PACKET, "%s: flowspec_fragment_type_decode error %d", __func__, error); else diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 14d692ebf..f27ea8390 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -167,7 +167,7 @@ static struct peer *peer_xfer_conn(struct peer *from_peer) */ if (peer->curr) { flog_err( - BGP_ERR_PKT_PROCESS, + EC_BGP_PKT_PROCESS, "[%s] Dropping pending packet on connection transfer:", peer->host); uint16_t type = stream_getc_from(peer->curr, @@ -1286,7 +1286,7 @@ static int bgp_connect_check(struct thread *thread) static int bgp_connect_success(struct peer *peer) { if (peer->fd < 0) { - flog_err(BGP_ERR_CONNECT, + flog_err(EC_BGP_CONNECT, "bgp_connect_success peer's fd is negative value %d", peer->fd); bgp_stop(peer); @@ -1354,7 +1354,7 @@ int bgp_start(struct peer *peer) if (BGP_PEER_START_SUPPRESSED(peer)) { if (bgp_debug_neighbor_events(peer)) - flog_err(BGP_ERR_FSM, + flog_err(EC_BGP_FSM, "%s [FSM] Trying to start suppressed peer" " - this is never supposed to happen!", peer->host); @@ -1390,7 +1390,7 @@ int bgp_start(struct peer *peer) if (peer->bgp->vrf_id == VRF_UNKNOWN) { if (bgp_debug_neighbor_events(peer)) flog_err( - BGP_ERR_FSM, + EC_BGP_FSM, "%s [FSM] In a VRF that is not initialised yet", peer->host); return -1; @@ -1444,7 +1444,7 @@ int bgp_start(struct peer *peer) "%s [FSM] Non blocking connect waiting result, fd %d", peer->host, peer->fd); if (peer->fd < 0) { - flog_err(BGP_ERR_FSM, + flog_err(EC_BGP_FSM, "bgp_start peer's fd is negative value %d", peer->fd); return -1; @@ -1492,7 +1492,7 @@ static int bgp_fsm_open(struct peer *peer) peer and change to Idle status. */ static int bgp_fsm_event_error(struct peer *peer) { - flog_err(BGP_ERR_FSM, + flog_err(EC_BGP_FSM, "%s [FSM] unexpected packet received in state %s", peer->host, lookup_msg(bgp_status_msg, peer->status, NULL)); @@ -1526,7 +1526,7 @@ static int bgp_establish(struct peer *peer) other = peer->doppelganger; peer = peer_xfer_conn(peer); if (!peer) { - flog_err(BGP_ERR_CONNECT, "%%Neighbor failed in xfer_conn"); + flog_err(EC_BGP_CONNECT, "%%Neighbor failed in xfer_conn"); return -1; } @@ -1686,7 +1686,7 @@ static int bgp_fsm_update(struct peer *peer) static int bgp_ignore(struct peer *peer) { flog_err( - BGP_ERR_FSM, + EC_BGP_FSM, "%s [FSM] Ignoring event %s in state %s, prior events %s, %s, fd %d", peer->host, bgp_event_str[peer->cur_event], lookup_msg(bgp_status_msg, peer->status, NULL), @@ -1699,7 +1699,7 @@ static int bgp_ignore(struct peer *peer) static int bgp_fsm_exeption(struct peer *peer) { flog_err( - BGP_ERR_FSM, + EC_BGP_FSM, "%s [FSM] Unexpected event %s in state %s, prior events %s, %s, fd %d", peer->host, bgp_event_str[peer->cur_event], lookup_msg(bgp_status_msg, peer->status, NULL), @@ -1974,7 +1974,7 @@ int bgp_event_update(struct peer *peer, int event) */ if (!dyn_nbr && !passive_conn && peer->bgp) { flog_err( - BGP_ERR_FSM, + EC_BGP_FSM, "%s [FSM] Failure handling event %s in state %s, " "prior events %s, %s, fd %d", peer->host, bgp_event_str[peer->cur_event], diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c index 311f98001..86ef3b0d9 100644 --- a/bgpd/bgp_io.c +++ b/bgpd/bgp_io.c @@ -402,7 +402,7 @@ static uint16_t bgp_read(struct peer *peer) SET_FLAG(status, BGP_IO_TRANS_ERR); /* Fatal error; tear down session */ } else if (nbytes < 0) { - flog_err(BGP_ERR_UPDATE_RCV, + flog_err(EC_BGP_UPDATE_RCV, "%s [Error] bgp_read_packet error: %s", peer->host, safe_strerror(errno)); diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c index c32df275a..e6ab51780 100644 --- a/bgpd/bgp_label.c +++ b/bgpd/bgp_label.c @@ -192,7 +192,7 @@ static int bgp_nlri_get_labels(struct peer *peer, uint8_t *pnt, uint8_t plen, if (!(bgp_is_withdraw_label(label) || label_bos(label))) flog_warn( - BGP_WARN_INVALID_LABEL_STACK, + EC_BGP_INVALID_LABEL_STACK, "%s rcvd UPDATE with invalid label stack - no bottom of stack", peer->host); @@ -247,7 +247,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr, /* sanity check against packet data */ if ((pnt + psize) > lim) { flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s [Error] Update packet error / L-U (prefix length %d exceeds packet size %u)", peer->host, prefixlen, (uint)(lim - pnt)); return -1; @@ -259,7 +259,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr, /* There needs to be at least one label */ if (prefixlen < 24) { - flog_err(BGP_ERR_UPDATE_RCV, + flog_err(EC_BGP_UPDATE_RCV, "%s [Error] Update packet error" " (wrong label length %d)", peer->host, prefixlen); @@ -288,7 +288,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr, * ignored. */ flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s: IPv4 labeled-unicast NLRI is multicast address %s, ignoring", peer->host, inet_ntoa(p.u.prefix4)); continue; @@ -301,7 +301,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr, char buf[BUFSIZ]; flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s: IPv6 labeled-unicast NLRI is link-local address %s, ignoring", peer->host, inet_ntop(AF_INET6, &p.u.prefix6, buf, @@ -314,7 +314,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr, char buf[BUFSIZ]; flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s: IPv6 unicast NLRI is multicast address %s, ignoring", peer->host, inet_ntop(AF_INET6, &p.u.prefix6, buf, @@ -338,7 +338,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr, /* Packet length consistency check. */ if (pnt != lim) { flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s [Error] Update packet error / L-U (%zu data remaining after parsing)", peer->host, lim - pnt); return -1; diff --git a/bgpd/bgp_labelpool.c b/bgpd/bgp_labelpool.c index 8d15649ea..d5e4962cc 100644 --- a/bgpd/bgp_labelpool.c +++ b/bgpd/bgp_labelpool.c @@ -127,7 +127,7 @@ static wq_item_status lp_cbq_docallback(struct work_queue *wq, void *data) if (lcbq->label == MPLS_LABEL_NONE) { /* shouldn't happen */ - flog_err(BGP_ERR_LABEL, "%s: error: label==MPLS_LABEL_NONE", + flog_err(EC_BGP_LABEL, "%s: error: label==MPLS_LABEL_NONE", __func__); return WQ_SUCCESS; } @@ -338,7 +338,7 @@ void bgp_lp_get( if (rc) { /* shouldn't happen */ - flog_err(BGP_ERR_LABEL, + flog_err(EC_BGP_LABEL, "%s: can't insert new LCB into ledger list", __func__); XFREE(MTYPE_BGP_LABEL_CB, lcb); @@ -427,7 +427,7 @@ void bgp_lp_event_chunk(uint8_t keep, uint32_t first, uint32_t last) struct lp_fifo *lf; if (last < first) { - flog_err(BGP_ERR_LABEL, + flog_err(EC_BGP_LABEL, "%s: zebra label chunk invalid: first=%u, last=%u", __func__, first, last); return; diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index e0834604b..d888090e6 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -410,7 +410,7 @@ int main(int argc, char **argv) if (multipath_num > MULTIPATH_NUM || multipath_num <= 0) { flog_err( - BGP_ERR_MULTIPATH, + EC_BGP_MULTIPATH, "Multipath Number specified must be less than %d and greater than 0", MULTIPATH_NUM); return 1; diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 459775c8e..cede7570e 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -152,7 +152,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr, if (prefixlen < VPN_PREFIXLEN_MIN_BYTES * 8) { flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s [Error] Update packet error / VPN (prefix length %d less than VPN min length)", peer->host, prefixlen); return -1; @@ -161,7 +161,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr, /* sanity check against packet data */ if ((pnt + psize) > lim) { flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s [Error] Update packet error / VPN (prefix length %d exceeds packet size %u)", peer->host, prefixlen, (uint)(lim - pnt)); return -1; @@ -170,7 +170,7 @@ 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)) { flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s [Error] Update packet error / VPN (psize %d exceeds storage size %zu)", peer->host, prefixlen - VPN_PREFIXLEN_MIN_BYTES * 8, @@ -181,7 +181,7 @@ 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)) { flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_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, @@ -218,7 +218,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr, #endif default: - flog_err(BGP_ERR_UPDATE_RCV, "Unknown RD type %d", + flog_err(EC_BGP_UPDATE_RCV, "Unknown RD type %d", type); break; /* just report */ } @@ -242,7 +242,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr, /* Packet length consistency check. */ if (pnt != lim) { flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s [Error] Update packet error / VPN (%zu data remaining after parsing)", peer->host, lim - pnt); return -1; @@ -366,7 +366,7 @@ int vpn_leak_label_callback( return 0; } /* Shouldn't happen: different label allocation */ - flog_err(BGP_ERR_LABEL, + flog_err(EC_BGP_LABEL, "%s: %s had label %u but got new assignment %u", __func__, vp->bgp->name_pretty, vp->tovpn_label, label); diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 96d2e2f2a..ae78a0064 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -84,7 +84,7 @@ static int bgp_md5_set_socket(int socket, union sockunion *su, #endif /* HAVE_TCP_MD5SIG */ if (ret < 0) - flog_warn(BGP_WARN_NO_TCP_MD5, + flog_warn(EC_BGP_NO_TCP_MD5, "can't set TCP_MD5SIG option on socket %d: %s", socket, safe_strerror(en)); @@ -562,7 +562,7 @@ int bgp_connect(struct peer *peer) sockopt_reuseaddr(peer->fd); sockopt_reuseport(peer->fd); if (sockopt_mark_default(peer->fd, DATAPLANE_MARK, &bgpd_privs) < 0) - flog_warn(BGP_WARN_NO_SOCKOPT_MARK, + flog_warn(EC_BGP_NO_SOCKOPT_MARK, "Unable to set mark on FD for peer %s, err=%s", peer->host, safe_strerror(errno)); @@ -623,7 +623,7 @@ int bgp_getsockname(struct peer *peer) peer)) { #if defined(HAVE_CUMULUS) flog_err( - BGP_ERR_NH_UPD, + EC_BGP_NH_UPD, "%s: nexthop_set failed, resetting connection - intf %p", peer->host, peer->nexthop.ifp); return -1; diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index cf055fd43..3d2a4ee0d 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -345,7 +345,7 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id) bgp = bgp_lookup_by_vrf_id(vrf_id); if (!bgp) { flog_err( - BGP_ERR_NH_UPD, + EC_BGP_NH_UPD, "parse nexthop update: instance not found for vrf_id %u", vrf_id); return; @@ -592,7 +592,7 @@ static void sendmsg_zebra_rnh(struct bgp_nexthop_cache *bnc, int command) bnc->bgp->vrf_id); /* TBD: handle the failure */ if (ret < 0) - flog_warn(BGP_WARN_ZEBRA_SEND, + flog_warn(EC_BGP_ZEBRA_SEND, "sendmsg_nexthop: zclient_send_message() failed"); if ((command == ZEBRA_NEXTHOP_REGISTER) diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index 2a32f02f4..f4c188139 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -255,7 +255,7 @@ static int bgp_capability_mp(struct peer *peer, struct capability_header *hdr) /* Verify length is 4 */ if (hdr->length != 4) { flog_warn( - BGP_WARN_CAPABILITY_INVALID_LENGTH, + EC_BGP_CAPABILITY_INVALID_LENGTH, "MP Cap: Received invalid length %d, non-multiple of 4", hdr->length); return -1; @@ -451,7 +451,7 @@ static int bgp_capability_restart(struct peer *peer, /* Verify length is a multiple of 4 */ if ((caphdr->length - 2) % 4) { flog_warn( - BGP_WARN_CAPABILITY_INVALID_LENGTH, + EC_BGP_CAPABILITY_INVALID_LENGTH, "Restart Cap: Received invalid length %d, non-multiple of 4", caphdr->length); return -1; @@ -523,7 +523,7 @@ static as_t bgp_capability_as4(struct peer *peer, struct capability_header *hdr) SET_FLAG(peer->cap, PEER_CAP_AS4_RCV); if (hdr->length != CAPABILITY_CODE_AS4_LEN) { - flog_err(BGP_ERR_PKT_OPEN, + flog_err(EC_BGP_PKT_OPEN, "%s AS4 capability has incorrect data length %d", peer->host, hdr->length); return 0; @@ -549,7 +549,7 @@ static int bgp_capability_addpath(struct peer *peer, /* Verify length is a multiple of 4 */ if (hdr->length % 4) { flog_warn( - BGP_WARN_CAPABILITY_INVALID_LENGTH, + EC_BGP_CAPABILITY_INVALID_LENGTH, "Add Path: Received invalid length %d, non-multiple of 4", hdr->length); return -1; @@ -608,7 +608,7 @@ static int bgp_capability_enhe(struct peer *peer, struct capability_header *hdr) /* Verify length is a multiple of 4 */ if (hdr->length % 6) { flog_warn( - BGP_WARN_CAPABILITY_INVALID_LENGTH, + EC_BGP_CAPABILITY_INVALID_LENGTH, "Extended NH: Received invalid length %d, non-multiple of 6", hdr->length); return -1; @@ -651,7 +651,7 @@ static int bgp_capability_enhe(struct peer *peer, struct capability_header *hdr) || !(safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST)) { flog_warn( - BGP_WARN_CAPABILITY_INVALID_DATA, + EC_BGP_CAPABILITY_INVALID_DATA, "%s Unexpected afi/safi/next-hop afi: %u/%u/%u " "in Extended Next-hop capability, ignoring", peer->host, pkt_afi, pkt_safi, pkt_nh_afi); @@ -683,7 +683,7 @@ static int bgp_capability_hostname(struct peer *peer, len = stream_getc(s); if (stream_get_getp(s) + len > end) { flog_warn( - BGP_WARN_CAPABILITY_INVALID_DATA, + EC_BGP_CAPABILITY_INVALID_DATA, "%s: Received malformed hostname capability from peer %s", __FUNCTION__, peer->host); return -1; @@ -714,7 +714,7 @@ static int bgp_capability_hostname(struct peer *peer, if (stream_get_getp(s) + 1 > end) { flog_warn( - BGP_WARN_CAPABILITY_INVALID_DATA, + EC_BGP_CAPABILITY_INVALID_DATA, "%s: Received invalid domain name len (hostname capability) from peer %s", __FUNCTION__, peer->host); return -1; @@ -723,7 +723,7 @@ static int bgp_capability_hostname(struct peer *peer, len = stream_getc(s); if (stream_get_getp(s) + len > end) { flog_warn( - BGP_WARN_CAPABILITY_INVALID_DATA, + EC_BGP_CAPABILITY_INVALID_DATA, "%s: Received runt domain name (hostname capability) from peer %s", __FUNCTION__, peer->host); return -1; @@ -960,12 +960,12 @@ static int bgp_capability_parse(struct peer *peer, size_t length, specific capabilities. It seems reasonable for now... */ - flog_warn(BGP_WARN_CAPABILITY_VENDOR, + flog_warn(EC_BGP_CAPABILITY_VENDOR, "%s Vendor specific capability %d", peer->host, caphdr.code); } else { flog_warn( - BGP_WARN_CAPABILITY_UNKNOWN, + EC_BGP_CAPABILITY_UNKNOWN, "%s unrecognized capability code: %d - ignored", peer->host, caphdr.code); memcpy(*error, sp, caphdr.length + 2); @@ -981,7 +981,7 @@ static int bgp_capability_parse(struct peer *peer, size_t length, if (stream_get_getp(s) != (start + caphdr.length)) { if (stream_get_getp(s) > (start + caphdr.length)) flog_warn( - BGP_WARN_CAPABILITY_INVALID_LENGTH, + EC_BGP_CAPABILITY_INVALID_LENGTH, "%s Cap-parser for %s read past cap-length, %u!", peer->host, lookup_msg(capcode_str, caphdr.code, @@ -1197,7 +1197,7 @@ int bgp_open_option_parse(struct peer *peer, uint8_t length, int *mp_capability) && !peer->afc_nego[AFI_IP6][SAFI_ENCAP] && !peer->afc_nego[AFI_IP6][SAFI_FLOWSPEC] && !peer->afc_nego[AFI_L2VPN][SAFI_EVPN]) { - flog_err(BGP_ERR_PKT_OPEN, + flog_err(EC_BGP_PKT_OPEN, "%s [Error] Configured AFI/SAFIs do not " "overlap with received MP capabilities", peer->host); diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index d8bab6041..4477ec8dc 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -1091,7 +1091,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size) /* Just in case we have a silly peer who sends AS4 capability set to 0 */ if (CHECK_FLAG(peer->cap, PEER_CAP_AS4_RCV) && !as4) { - flog_err(BGP_ERR_PKT_OPEN, + flog_err(EC_BGP_PKT_OPEN, "%s bad OPEN, got AS4 capability, but AS4 set to 0", peer->host); bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR, @@ -1107,7 +1107,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size) */ if (as4 == BGP_AS_TRANS) { flog_err( - BGP_ERR_PKT_OPEN, + EC_BGP_PKT_OPEN, "%s [AS4] NEW speaker using AS_TRANS for AS4, not allowed", peer->host); bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR, @@ -1137,7 +1137,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size) && as4 != remote_as) { /* raise error, log this, close session */ flog_err( - BGP_ERR_PKT_OPEN, + EC_BGP_PKT_OPEN, "%s bad OPEN, got AS4 capability, but remote_as %u" " mismatch with 16bit 'myasn' %u in open", peer->host, as4, remote_as); @@ -1320,7 +1320,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size) if (!peer->nexthop.v4.s_addr) { #if defined(HAVE_CUMULUS) flog_err( - BGP_ERR_SND_FAIL, + EC_BGP_SND_FAIL, "%s: No local IPv4 addr resetting connection, fd %d", peer->host, peer->fd); bgp_notify_send(peer, BGP_NOTIFY_CEASE, @@ -1337,7 +1337,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size) if (IN6_IS_ADDR_UNSPECIFIED(&peer->nexthop.v6_global)) { #if defined(HAVE_CUMULUS) flog_err( - BGP_ERR_SND_FAIL, + EC_BGP_SND_FAIL, "%s: No local IPv6 addr resetting connection, fd %d", peer->host, peer->fd); bgp_notify_send(peer, BGP_NOTIFY_CEASE, @@ -1399,7 +1399,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) /* Status must be Established. */ if (peer->status != Established) { - flog_err(BGP_ERR_INVALID_STATUS, + flog_err(EC_BGP_INVALID_STATUS, "%s [FSM] Update packet received under status %s", peer->host, lookup_msg(bgp_status_msg, peer->status, NULL)); @@ -1423,7 +1423,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) Attribute Length + 23 exceeds the message Length), then the Error Subcode is set to Malformed Attribute List. */ if (stream_pnt(s) + 2 > end) { - flog_err(BGP_ERR_UPDATE_RCV, + flog_err(EC_BGP_UPDATE_RCV, "%s [Error] Update packet error" " (packet length is short for unfeasible length)", peer->host); @@ -1437,7 +1437,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) /* Unfeasible Route Length check. */ if (stream_pnt(s) + withdraw_len > end) { - flog_err(BGP_ERR_UPDATE_RCV, + flog_err(EC_BGP_UPDATE_RCV, "%s [Error] Update packet error" " (packet unfeasible length overflow %d)", peer->host, withdraw_len); @@ -1458,7 +1458,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) /* Attribute total length check. */ if (stream_pnt(s) + 2 > end) { flog_warn( - BGP_WARN_UPDATE_PACKET_SHORT, + EC_BGP_UPDATE_PACKET_SHORT, "%s [Error] Packet Error (update packet is short for attribute length)", peer->host); bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, @@ -1472,7 +1472,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) /* Attribute length check. */ if (stream_pnt(s) + attribute_len > end) { flog_warn( - BGP_WARN_UPDATE_PACKET_LONG, + EC_BGP_UPDATE_PACKET_LONG, "%s [Error] Packet Error (update packet attribute length overflow %d)", peer->host, attribute_len); bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, @@ -1512,7 +1512,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) if (attr_parse_ret == BGP_ATTR_PARSE_WITHDRAW) flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s rcvd UPDATE with errors in attr(s)!! Withdrawing route.", peer->host); @@ -1572,7 +1572,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) } if (nlri_ret < 0) { - flog_err(BGP_ERR_UPDATE_RCV, + flog_err(EC_BGP_UPDATE_RCV, "%s [Error] Error parsing NLRI", peer->host); if (peer->status == Established) bgp_notify_send( @@ -1744,7 +1744,7 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size) /* If peer does not have the capability, send notification. */ if (!CHECK_FLAG(peer->cap, PEER_CAP_REFRESH_ADV)) { - flog_err(BGP_ERR_NO_CAP, + flog_err(EC_BGP_NO_CAP, "%s [Error] BGP route refresh is not enabled", peer->host); bgp_notify_send(peer, BGP_NOTIFY_HEADER_ERR, @@ -1755,7 +1755,7 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size) /* Status must be Established. */ if (peer->status != Established) { flog_err( - BGP_ERR_INVALID_STATUS, + EC_BGP_INVALID_STATUS, "%s [Error] Route refresh packet received under status %s", peer->host, lookup_msg(bgp_status_msg, peer->status, NULL)); @@ -2105,7 +2105,7 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt, } } else { flog_warn( - BGP_WARN_UNRECOGNIZED_CAPABILITY, + EC_BGP_UNRECOGNIZED_CAPABILITY, "%s unrecognized capability code: %d - ignored", peer->host, hdr->code); } @@ -2136,7 +2136,7 @@ int bgp_capability_receive(struct peer *peer, bgp_size_t size) /* If peer does not have the capability, send notification. */ if (!CHECK_FLAG(peer->cap, PEER_CAP_DYNAMIC_ADV)) { - flog_err(BGP_ERR_NO_CAP, + flog_err(EC_BGP_NO_CAP, "%s [Error] BGP dynamic capability is not enabled", peer->host); bgp_notify_send(peer, BGP_NOTIFY_HEADER_ERR, @@ -2147,7 +2147,7 @@ int bgp_capability_receive(struct peer *peer, bgp_size_t size) /* Status must be Established. */ if (peer->status != Established) { flog_err( - BGP_ERR_NO_CAP, + EC_BGP_NO_CAP, "%s [Error] Dynamic capability packet received under status %s", peer->host, lookup_msg(bgp_status_msg, peer->status, NULL)); @@ -2229,7 +2229,7 @@ int bgp_process_packet(struct thread *thread) mprc = bgp_open_receive(peer, size); if (mprc == BGP_Stop) flog_err( - BGP_ERR_PKT_OPEN, + EC_BGP_PKT_OPEN, "%s: BGP OPEN receipt failed for peer: %s", __FUNCTION__, peer->host); break; @@ -2240,7 +2240,7 @@ int bgp_process_packet(struct thread *thread) mprc = bgp_update_receive(peer, size); if (mprc == BGP_Stop) flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s: BGP UPDATE receipt failed for peer: %s", __FUNCTION__, peer->host); break; @@ -2250,7 +2250,7 @@ int bgp_process_packet(struct thread *thread) mprc = bgp_notify_receive(peer, size); if (mprc == BGP_Stop) flog_err( - BGP_ERR_NOTIFY_RCV, + EC_BGP_NOTIFY_RCV, "%s: BGP NOTIFY receipt failed for peer: %s", __FUNCTION__, peer->host); break; @@ -2261,7 +2261,7 @@ int bgp_process_packet(struct thread *thread) mprc = bgp_keepalive_receive(peer, size); if (mprc == BGP_Stop) flog_err( - BGP_ERR_KEEP_RCV, + EC_BGP_KEEP_RCV, "%s: BGP KEEPALIVE receipt failed for peer: %s", __FUNCTION__, peer->host); break; @@ -2272,7 +2272,7 @@ int bgp_process_packet(struct thread *thread) mprc = bgp_route_refresh_receive(peer, size); if (mprc == BGP_Stop) flog_err( - BGP_ERR_RFSH_RCV, + EC_BGP_RFSH_RCV, "%s: BGP ROUTEREFRESH receipt failed for peer: %s", __FUNCTION__, peer->host); break; @@ -2282,7 +2282,7 @@ int bgp_process_packet(struct thread *thread) mprc = bgp_capability_receive(peer, size); if (mprc == BGP_Stop) flog_err( - BGP_ERR_CAP_RCV, + EC_BGP_CAP_RCV, "%s: BGP CAPABILITY receipt failed for peer: %s", __FUNCTION__, peer->host); break; diff --git a/bgpd/bgp_pbr.c b/bgpd/bgp_pbr.c index b182fde1e..52e6971b8 100644 --- a/bgpd/bgp_pbr.c +++ b/bgpd/bgp_pbr.c @@ -653,7 +653,7 @@ static int bgp_pbr_build_and_validate_entry(struct prefix *p, action_count++; if (action_count > ACTIONS_MAX_NUM) { if (BGP_DEBUG(pbr, PBR_ERROR)) - flog_err(BGP_ERR_FLOWSPEC_PACKET, + flog_err(EC_BGP_FLOWSPEC_PACKET, "%s: flowspec actions exceeds limit (max %u)", __func__, action_count); break; @@ -2251,7 +2251,7 @@ void bgp_pbr_update_entry(struct bgp *bgp, struct prefix *p, if (!bgp_zebra_tm_chunk_obtained()) { if (BGP_DEBUG(pbr, PBR_ERROR)) - flog_err(BGP_ERR_TABLE_CHUNK, + flog_err(EC_BGP_TABLE_CHUNK, "%s: table chunk not obtained yet", __func__); return; @@ -2259,7 +2259,7 @@ void bgp_pbr_update_entry(struct bgp *bgp, struct prefix *p, if (bgp_pbr_build_and_validate_entry(p, info, &api) < 0) { if (BGP_DEBUG(pbr, PBR_ERROR)) - flog_err(BGP_ERR_FLOWSPEC_INSTALLATION, + flog_err(EC_BGP_FLOWSPEC_INSTALLATION, "%s: cancel updating entry %p in bgp pbr", __func__, info); return; diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 4c2df0dd0..7402deff2 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -4216,7 +4216,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, /* Prefix length check. */ if (p.prefixlen > prefix_blen(&p) * 8) { flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s [Error] Update packet error (wrong prefix length %d for afi %u)", peer->host, p.prefixlen, packet->afi); return -1; @@ -4228,7 +4228,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, /* When packet overflow occur return immediately. */ if (pnt + psize > lim) { flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s [Error] Update packet error (prefix length %d overflows packet)", peer->host, p.prefixlen); return -1; @@ -4238,7 +4238,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, * prefix */ if (psize > (ssize_t)sizeof(p.u)) { flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s [Error] Update packet error (prefix length %d too large for prefix storage %zu)", peer->host, p.prefixlen, sizeof(p.u)); return -1; @@ -4260,7 +4260,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, * ignored. */ flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s: IPv4 unicast NLRI is multicast address %s, ignoring", peer->host, inet_ntoa(p.u.prefix4)); continue; @@ -4273,7 +4273,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, char buf[BUFSIZ]; flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s: IPv6 unicast NLRI is link-local address %s, ignoring", peer->host, inet_ntop(AF_INET6, &p.u.prefix6, buf, @@ -4285,7 +4285,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, char buf[BUFSIZ]; flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s: IPv6 unicast NLRI is multicast address %s, ignoring", peer->host, inet_ntop(AF_INET6, &p.u.prefix6, buf, @@ -4315,7 +4315,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, /* Packet length consistency check. */ if (pnt != lim) { flog_err( - BGP_ERR_UPDATE_RCV, + EC_BGP_UPDATE_RCV, "%s [Error] Update packet error (prefix length mismatch with total length)", peer->host); return -1; diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c index 37740671c..e129c13f8 100644 --- a/bgpd/bgp_updgrp.c +++ b/bgpd/bgp_updgrp.c @@ -1631,7 +1631,7 @@ void update_group_adjust_peer(struct peer_af *paf) if (!updgrp) { updgrp = update_group_create(paf); if (!updgrp) { - flog_err(BGP_ERR_UPDGRP_CREATE, + flog_err(EC_BGP_UPDGRP_CREATE, "couldn't create update group for peer %s", paf->peer->host); return; diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index f3047369b..56a82c801 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -428,7 +428,7 @@ struct stream *bpacket_reformat_for_peer(struct bpacket *pkt, default: /* TODO: handle IPv6 nexthops */ flog_warn( - BGP_WARN_INVALID_NEXTHOP_LENGTH, + EC_BGP_INVALID_NEXTHOP_LENGTH, "%s: %s: invalid MP nexthop length (AFI IP): %u", __func__, peer->host, nhlen); stream_free(s); @@ -534,7 +534,7 @@ struct stream *bpacket_reformat_for_peer(struct bpacket *pkt, default: /* TODO: handle IPv4 nexthops */ flog_warn( - BGP_WARN_INVALID_NEXTHOP_LENGTH, + EC_BGP_INVALID_NEXTHOP_LENGTH, "%s: %s: invalid MP nexthop length (AFI IP6): %u", __func__, peer->host, nhlen); stream_free(s); @@ -790,7 +790,7 @@ struct bpacket *subgroup_update_packet(struct update_subgroup *subgrp) * return */ if (space_remaining < space_needed) { flog_err( - BGP_ERR_UPDGRP_ATTR_LEN, + EC_BGP_UPDGRP_ATTR_LEN, "u%" PRIu64 ":s%" PRIu64 " attributes too long, cannot send UPDATE", subgrp->update_group->id, subgrp->id); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 3669ea773..559273589 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -10822,7 +10822,7 @@ static void bgp_show_all_instances_neighbors_vty(struct vty *vty, if (use_json) { if (!(json = json_object_new_object())) { flog_err( - BGP_ERR_JSON_MEM_ERROR, + EC_BGP_JSON_MEM_ERROR, "Unable to allocate memory for JSON object"); vty_out(vty, "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}\n"); diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 43afc317e..e90b4a7ae 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1078,7 +1078,7 @@ int bgp_zebra_get_table_range(uint32_t chunk_size, return -1; ret = tm_get_table_chunk(zclient, chunk_size, start, end); if (ret < 0) { - flog_err(BGP_ERR_TABLE_CHUNK, + flog_err(EC_BGP_TABLE_CHUNK, "BGP: Error getting table chunk %u", chunk_size); return -1; } @@ -2390,7 +2390,7 @@ static int bgp_zebra_process_local_macip(int command, struct zclient *zclient, ipa_len = stream_getl(s); if (ipa_len != 0 && ipa_len != IPV4_MAX_BYTELEN && ipa_len != IPV6_MAX_BYTELEN) { - flog_err(BGP_ERR_MACIP_LEN, + flog_err(EC_BGP_MACIP_LEN, "%u:Recv MACIP %s with invalid IP addr length %d", vrf_id, (command == ZEBRA_MACIP_ADD) ? "Add" : "Del", ipa_len); @@ -2487,12 +2487,12 @@ static void bgp_zebra_process_label_chunk( STREAM_GETL(s, last); if (zclient->redist_default != proto) { - flog_err(BGP_ERR_LM_ERROR, "Got LM msg with wrong proto %u", + flog_err(EC_BGP_LM_ERROR, "Got LM msg with wrong proto %u", proto); return; } if (zclient->instance != instance) { - flog_err(BGP_ERR_LM_ERROR, "Got LM msg with wrong instance %u", + flog_err(EC_BGP_LM_ERROR, "Got LM msg with wrong instance %u", proto); return; } @@ -2501,7 +2501,7 @@ static void bgp_zebra_process_label_chunk( first < MPLS_LABEL_UNRESERVED_MIN || last > MPLS_LABEL_UNRESERVED_MAX) { - flog_err(BGP_ERR_LM_ERROR, "%s: Invalid Label chunk: %u - %u", + flog_err(EC_BGP_LM_ERROR, "%s: Invalid Label chunk: %u - %u", __func__, first, last); return; } diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 066db1c77..cdccd50b9 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -1804,7 +1804,7 @@ static int peer_activate_af(struct peer *peer, afi_t afi, safi_t safi) int active; if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) { - flog_err(BGP_ERR_PEER_GROUP, "%s was called for peer-group %s", + flog_err(EC_BGP_PEER_GROUP, "%s was called for peer-group %s", __func__, peer->host); return 1; } @@ -1918,7 +1918,7 @@ static int non_peergroup_deactivate_af(struct peer *peer, afi_t afi, safi_t safi) { if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) { - flog_err(BGP_ERR_PEER_GROUP, "%s was called for peer-group %s", + flog_err(EC_BGP_PEER_GROUP, "%s was called for peer-group %s", __func__, peer->host); return 1; } @@ -1931,7 +1931,7 @@ 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) { - flog_err(BGP_ERR_PEER_DELETE, + flog_err(EC_BGP_PEER_DELETE, "couldn't delete af structure for peer %s", peer->host); return 1; @@ -1982,7 +1982,7 @@ int peer_deactivate(struct peer *peer, afi_t afi, safi_t safi) group = peer->group; if (peer_af_delete(peer, afi, safi) != 0) { - flog_err(BGP_ERR_PEER_DELETE, + flog_err(EC_BGP_PEER_DELETE, "couldn't delete af structure for peer %s", peer->host); } -- cgit v1.2.3