From 28f22e266f232fc617d12cd761713507738ccb41 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 15 Aug 2018 20:30:41 -0400 Subject: [PATCH] bgpd: Convert bgp_network.c to use flog_warn Signed-off-by: Donald Sharp --- bgpd/bgp_errors.c | 12 ++++++++++++ bgpd/bgp_errors.h | 2 ++ bgpd/bgp_network.c | 6 ++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_errors.c b/bgpd/bgp_errors.c index bf77f748e1..b9f814af2a 100644 --- a/bgpd/bgp_errors.c +++ b/bgpd/bgp_errors.c @@ -115,6 +115,18 @@ static struct log_ref ferr_bgp_warn[] = { .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 = END_FERR, } diff --git a/bgpd/bgp_errors.h b/bgpd/bgp_errors.h index c02b9bb0ae..c47a600082 100644 --- a/bgpd/bgp_errors.h +++ b/bgpd/bgp_errors.h @@ -87,6 +87,8 @@ enum bgp_log_refs { BGP_WARN_UPDATE_PACKET_SHORT, BGP_WARN_UPDATE_PACKET_LONG, BGP_WARN_UNRECOGNIZED_CAPABILITY, + BGP_WARN_NO_TCP_MD5, + BGP_WARN_NO_SOCKOPT_MARK, }; extern void bgp_error_init(void); diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 22d5d35c82..96d2e2f2ab 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 -- 2.39.5