From: Donald Sharp Date: Wed, 15 Aug 2018 00:49:14 +0000 (-0400) Subject: bgpd: Convert zlog_warn to flog_warn for bgp_packet.c X-Git-Tag: frr-7.1-dev~371^2~47 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=63d430ceee8baed5fddafff2c91066a55594058b;p=mirror%2Ffrr.git bgpd: Convert zlog_warn to flog_warn for bgp_packet.c Signed-off-by: Donald Sharp --- diff --git a/bgpd/bgp_errors.c b/bgpd/bgp_errors.c index 51048b2af9..bf77f748e1 100644 --- a/bgpd/bgp_errors.c +++ b/bgpd/bgp_errors.c @@ -97,6 +97,24 @@ static struct log_ref ferr_bgp_warn[] = { .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 = END_FERR, } @@ -382,4 +400,5 @@ void bgp_error_init(void) { log_ref_add(ferr_bgp_warn); 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 34d1f67f6c..c02b9bb0ae 100644 --- a/bgpd/bgp_errors.h +++ b/bgpd/bgp_errors.h @@ -84,6 +84,9 @@ enum bgp_log_refs { 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, }; extern void bgp_error_init(void); diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index bb474b9e20..c04116e9ee 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -1457,10 +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)", - peer->host); + 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); return BGP_Stop; @@ -1471,10 +1470,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)", - peer->host, attribute_len); + 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); return BGP_Stop; @@ -2104,9 +2102,9 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt, return BGP_Stop; } } else { - zlog_warn( - "%s unrecognized capability code: %d - ignored", - peer->host, hdr->code); + flog_warn(BGP_WARN_UNRECOGNIZED_CAPABILITY, + "%s unrecognized capability code: %d - ignored", + peer->host, hdr->code); } }