summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_aspath.c6
-rw-r--r--bgpd/bgp_attr.c30
-rw-r--r--bgpd/bgp_dump.c5
-rw-r--r--bgpd/bgp_errors.c169
-rw-r--r--bgpd/bgp_errors.h27
-rw-r--r--bgpd/bgp_evpn.c23
-rw-r--r--bgpd/bgp_label.c5
-rw-r--r--bgpd/bgp_network.c6
-rw-r--r--bgpd/bgp_nht.c3
-rw-r--r--bgpd/bgp_open.c33
-rw-r--r--bgpd/bgp_packet.c15
-rw-r--r--bgpd/bgp_updgrp_packet.c6
12 files changed, 280 insertions, 48 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index d6ad52b3a..b156cda86 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -35,9 +35,10 @@
#include "bgpd/bgp_aspath.h"
#include "bgpd/bgp_debug.h"
#include "bgpd/bgp_attr.h"
+#include "bgpd/bgp_errors.h"
/* Attr. Flags and Attr. Type Code. */
-#define AS_HEADER_SIZE 2
+#define AS_HEADER_SIZE 2
/* Now FOUR octets are used for AS value. */
#define AS_VALUE_SIZE sizeof (as_t)
@@ -1638,7 +1639,8 @@ struct aspath *aspath_reconcile_as4(struct aspath *aspath,
if (hops < 0) {
if (BGP_DEBUG(as4, AS4))
- zlog_warn(
+ flog_warn(
+ BGP_WARN_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 6acd4c8cf..062a8a9b4 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -1760,7 +1760,8 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args,
{
uint8_t val;
if ((val = stream_getc(s)))
- zlog_warn(
+ flog_warn(
+ BGP_WARN_DEFUNCT_SNPA_LEN,
"%s sent non-zero value, %u, for defunct SNPA-length field",
peer->host, val);
}
@@ -2336,7 +2337,8 @@ static int bgp_attr_check(struct peer *peer, struct attr *attr)
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,
@@ -2377,7 +2379,8 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,
/* 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(
+ flog_warn(
+ BGP_WARN_ATTRIBUTE_TOO_SMALL,
"%s: error BGP attribute length %lu is smaller than min len",
peer->host,
(unsigned long)(endp
@@ -2399,7 +2402,8 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,
/* 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(
+ flog_warn(
+ BGP_WARN_EXT_ATTRIBUTE_TOO_SMALL,
"%s: Extended length set, but just %lu bytes of attr header",
peer->host,
(unsigned long)(endp
@@ -2421,7 +2425,8 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,
List. */
if (CHECK_BITMAP(seen, type)) {
- zlog_warn(
+ flog_warn(
+ BGP_WARN_ATTRIBUTE_REPEATED,
"%s: error BGP attribute type %d appears twice in a message",
peer->host, type);
@@ -2439,7 +2444,8 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,
attr_endp = BGP_INPUT_PNT(peer) + length;
if (attr_endp > endp) {
- zlog_warn(
+ 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);
@@ -2597,7 +2603,8 @@ 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) {
- 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);
@@ -2605,7 +2612,8 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr,
}
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)
@@ -2615,7 +2623,8 @@ 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) {
- 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);
@@ -2627,7 +2636,8 @@ 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) {
- 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);
diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c
index d69b1c46f..49f27d298 100644
--- a/bgpd/bgp_dump.c
+++ b/bgpd/bgp_dump.c
@@ -36,6 +36,7 @@
#include "bgpd/bgp_route.h"
#include "bgpd/bgp_attr.h"
#include "bgpd/bgp_dump.h"
+#include "bgpd/bgp_errors.h"
enum bgp_dump_type {
BGP_DUMP_ALL,
@@ -119,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) {
- zlog_warn("bgp_dump_open_file: strftime error");
+ flog_warn(BGP_WARN_DUMP, "bgp_dump_open_file: strftime error");
return NULL;
}
@@ -131,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) {
- zlog_warn("bgp_dump_open_file: %s: %s", realpath,
+ flog_warn(BGP_WARN_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 50dd001b8..827927f1b 100644
--- a/bgpd/bgp_errors.c
+++ b/bgpd/bgp_errors.c
@@ -24,6 +24,174 @@
#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 = BGP_WARN_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,
+ .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,
+ .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,
+ .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,
+ .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,
+ .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,
+ .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,
+ .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,
+ .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,
+ .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,
+ .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,
+ .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,
+ .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,
+ .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,
+ .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,
+ .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",
+ },
+ {
+ .code = END_FERR,
+ }
+};
+
static struct log_ref ferr_bgp_err[] = {
{
.code = BGP_ERR_ATTR_FLAG,
@@ -303,4 +471,5 @@ static struct log_ref ferr_bgp_err[] = {
void bgp_error_init(void)
{
log_ref_add(ferr_bgp_err);
+ log_ref_add(ferr_bgp_warn);
}
diff --git a/bgpd/bgp_errors.h b/bgpd/bgp_errors.h
index be718d99e..f7db77ac3 100644
--- a/bgpd/bgp_errors.h
+++ b/bgpd/bgp_errors.h
@@ -72,6 +72,33 @@ enum bgp_log_refs {
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,
};
extern void bgp_error_init(void);
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index a104a2e16..3bd566e07 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -3683,9 +3683,11 @@ static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi,
if (attr &&
(attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL))) {
if (attr->pmsi_tnl_type != PMSI_TNLTYPE_INGR_REPL) {
- zlog_warn("%u:%s - Rx EVPN Type-3 NLRI with unsupported PTA %d",
- peer->bgp->vrf_id, peer->host,
- attr->pmsi_tnl_type);
+ flog_warn(
+ BGP_WARN_EVPN_PMSI_PRESENT,
+ "%u:%s - Rx EVPN Type-3 NLRI with unsupported PTA %d",
+ peer->bgp->vrf_id, peer->host,
+ attr->pmsi_tnl_type);
}
}
@@ -5162,7 +5164,8 @@ 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)) {
- zlog_warn("%u: VNI hash entry for VNI %u %s at MACIP DEL",
+ flog_warn(BGP_WARN_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;
}
@@ -5186,7 +5189,8 @@ 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)) {
- zlog_warn("%u: VNI hash entry for VNI %u %s at MACIP ADD",
+ flog_warn(BGP_WARN_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;
}
@@ -5398,7 +5402,8 @@ int bgp_evpn_local_vni_del(struct bgp *bgp, vni_t vni)
vpn = bgp_evpn_lookup_vni(bgp, vni);
if (!vpn) {
if (bgp_debug_zebra(NULL))
- zlog_warn(
+ flog_warn(
+ BGP_WARN_EVPN_VPN_VNI,
"%u: VNI hash entry for VNI %u not found at DEL",
bgp->vrf_id, vni);
return 0;
@@ -5529,9 +5534,9 @@ int bgp_evpn_local_es_del(struct bgp *bgp,
/* Lookup ESI hash - should exist. */
es = bgp_evpn_lookup_es(bgp, esi);
if (!es) {
- zlog_warn("%u: ESI hash entry for ESI %s at Local ES DEL",
- bgp->vrf_id,
- esi_to_str(esi, buf, sizeof(buf)));
+ flog_warn(BGP_WARN_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;
}
diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c
index 633e58933..c32df275a 100644
--- a/bgpd/bgp_label.c
+++ b/bgpd/bgp_label.c
@@ -187,11 +187,12 @@ static int bgp_nlri_get_labels(struct peer *peer, uint8_t *pnt, uint8_t plen,
/* If we RX multiple labels we will end up keeping only the last
* one. We do not yet support a label stack greater than 1. */
if (label_depth > 1)
- zlog_warn("%s rcvd UPDATE with label stack %d deep", peer->host,
+ zlog_info("%s rcvd UPDATE with label stack %d deep", peer->host,
label_depth);
if (!(bgp_is_withdraw_label(label) || label_bos(label)))
- zlog_warn(
+ flog_warn(
+ BGP_WARN_INVALID_LABEL_STACK,
"%s rcvd UPDATE with invalid label stack - no bottom of stack",
peer->host);
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index 22d5d35c8..96d2e2f2a 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -84,7 +84,8 @@ static int bgp_md5_set_socket(int socket, union sockunion *su,
#endif /* HAVE_TCP_MD5SIG */
if (ret < 0)
- zlog_warn("can't set TCP_MD5SIG option on socket %d: %s",
+ flog_warn(BGP_WARN_NO_TCP_MD5,
+ "can't set TCP_MD5SIG option on socket %d: %s",
socket, safe_strerror(en));
return ret;
@@ -561,7 +562,8 @@ 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)
- zlog_warn("Unable to set mark on FD for peer %s, err=%s",
+ flog_warn(BGP_WARN_NO_SOCKOPT_MARK,
+ "Unable to set mark on FD for peer %s, err=%s",
peer->host, safe_strerror(errno));
#ifdef IPTOS_PREC_INTERNETCONTROL
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index 0c0c07995..cf055fd43 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -592,7 +592,8 @@ static void sendmsg_zebra_rnh(struct bgp_nexthop_cache *bnc, int command)
bnc->bgp->vrf_id);
/* TBD: handle the failure */
if (ret < 0)
- zlog_warn("sendmsg_nexthop: zclient_send_message() failed");
+ flog_warn(BGP_WARN_ZEBRA_SEND,
+ "sendmsg_nexthop: zclient_send_message() failed");
if ((command == ZEBRA_NEXTHOP_REGISTER)
|| (command == ZEBRA_IMPORT_ROUTE_REGISTER))
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 5bdee5f51..2a32f02f4 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -254,7 +254,8 @@ static int bgp_capability_mp(struct peer *peer, struct capability_header *hdr)
/* Verify length is 4 */
if (hdr->length != 4) {
- zlog_warn(
+ flog_warn(
+ BGP_WARN_CAPABILITY_INVALID_LENGTH,
"MP Cap: Received invalid length %d, non-multiple of 4",
hdr->length);
return -1;
@@ -449,7 +450,8 @@ static int bgp_capability_restart(struct peer *peer,
/* Verify length is a multiple of 4 */
if ((caphdr->length - 2) % 4) {
- zlog_warn(
+ flog_warn(
+ BGP_WARN_CAPABILITY_INVALID_LENGTH,
"Restart Cap: Received invalid length %d, non-multiple of 4",
caphdr->length);
return -1;
@@ -546,7 +548,8 @@ static int bgp_capability_addpath(struct peer *peer,
/* Verify length is a multiple of 4 */
if (hdr->length % 4) {
- zlog_warn(
+ flog_warn(
+ BGP_WARN_CAPABILITY_INVALID_LENGTH,
"Add Path: Received invalid length %d, non-multiple of 4",
hdr->length);
return -1;
@@ -604,7 +607,8 @@ static int bgp_capability_enhe(struct peer *peer, struct capability_header *hdr)
/* Verify length is a multiple of 4 */
if (hdr->length % 6) {
- zlog_warn(
+ flog_warn(
+ BGP_WARN_CAPABILITY_INVALID_LENGTH,
"Extended NH: Received invalid length %d, non-multiple of 6",
hdr->length);
return -1;
@@ -646,7 +650,8 @@ static int bgp_capability_enhe(struct peer *peer, struct capability_header *hdr)
if (afi != AFI_IP || nh_afi != AFI_IP6
|| !(safi == SAFI_UNICAST
|| safi == SAFI_LABELED_UNICAST)) {
- zlog_warn(
+ flog_warn(
+ BGP_WARN_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);
@@ -677,7 +682,8 @@ static int bgp_capability_hostname(struct peer *peer,
len = stream_getc(s);
if (stream_get_getp(s) + len > end) {
- zlog_warn(
+ flog_warn(
+ BGP_WARN_CAPABILITY_INVALID_DATA,
"%s: Received malformed hostname capability from peer %s",
__FUNCTION__, peer->host);
return -1;
@@ -707,7 +713,8 @@ static int bgp_capability_hostname(struct peer *peer,
}
if (stream_get_getp(s) + 1 > end) {
- zlog_warn(
+ flog_warn(
+ BGP_WARN_CAPABILITY_INVALID_DATA,
"%s: Received invalid domain name len (hostname capability) from peer %s",
__FUNCTION__, peer->host);
return -1;
@@ -715,7 +722,8 @@ static int bgp_capability_hostname(struct peer *peer,
len = stream_getc(s);
if (stream_get_getp(s) + len > end) {
- zlog_warn(
+ flog_warn(
+ BGP_WARN_CAPABILITY_INVALID_DATA,
"%s: Received runt domain name (hostname capability) from peer %s",
__FUNCTION__, peer->host);
return -1;
@@ -952,10 +960,12 @@ static int bgp_capability_parse(struct peer *peer, size_t length,
specific
capabilities. It seems reasonable for now...
*/
- zlog_warn("%s Vendor specific capability %d",
+ flog_warn(BGP_WARN_CAPABILITY_VENDOR,
+ "%s Vendor specific capability %d",
peer->host, caphdr.code);
} else {
- zlog_warn(
+ flog_warn(
+ BGP_WARN_CAPABILITY_UNKNOWN,
"%s unrecognized capability code: %d - ignored",
peer->host, caphdr.code);
memcpy(*error, sp, caphdr.length + 2);
@@ -970,7 +980,8 @@ 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))
- zlog_warn(
+ flog_warn(
+ BGP_WARN_CAPABILITY_INVALID_LENGTH,
"%s Cap-parser for %s read past cap-length, %u!",
peer->host,
lookup_msg(capcode_str, caphdr.code,
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index bb474b9e2..d8bab6041 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1457,9 +1457,9 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
/* Attribute total length check. */
if (stream_pnt(s) + 2 > end) {
- zlog_warn(
- "%s [Error] Packet Error"
- " (update packet is short for attribute length)",
+ flog_warn(
+ BGP_WARN_UPDATE_PACKET_SHORT,
+ "%s [Error] Packet Error (update packet is short for attribute length)",
peer->host);
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MAL_ATTR);
@@ -1471,9 +1471,9 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
/* Attribute length check. */
if (stream_pnt(s) + attribute_len > end) {
- zlog_warn(
- "%s [Error] Packet Error"
- " (update packet attribute length overflow %d)",
+ flog_warn(
+ BGP_WARN_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,
BGP_NOTIFY_UPDATE_MAL_ATTR);
@@ -2104,7 +2104,8 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
return BGP_Stop;
}
} else {
- zlog_warn(
+ flog_warn(
+ BGP_WARN_UNRECOGNIZED_CAPABILITY,
"%s unrecognized capability code: %d - ignored",
peer->host, hdr->code);
}
diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c
index c0761503f..f3047369b 100644
--- a/bgpd/bgp_updgrp_packet.c
+++ b/bgpd/bgp_updgrp_packet.c
@@ -427,7 +427,8 @@ struct stream *bpacket_reformat_for_peer(struct bpacket *pkt,
break;
default:
/* TODO: handle IPv6 nexthops */
- zlog_warn(
+ flog_warn(
+ BGP_WARN_INVALID_NEXTHOP_LENGTH,
"%s: %s: invalid MP nexthop length (AFI IP): %u",
__func__, peer->host, nhlen);
stream_free(s);
@@ -532,7 +533,8 @@ struct stream *bpacket_reformat_for_peer(struct bpacket *pkt,
break;
default:
/* TODO: handle IPv4 nexthops */
- zlog_warn(
+ flog_warn(
+ BGP_WARN_INVALID_NEXTHOP_LENGTH,
"%s: %s: invalid MP nexthop length (AFI IP6): %u",
__func__, peer->host, nhlen);
stream_free(s);