From b7cd3069c0f3a4e025f905e993f7af312cee4ae1 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 15 Aug 2018 20:32:36 -0400 Subject: [PATCH 1/3] bgpd: Modify warn to info for deprecated commands Modify zlog_warn to zlog_info commands for notification of deprecated commands. Signed-off-by: Donald Sharp --- bgpd/bgp_vty.c | 4 ++-- bgpd/bgp_zebra.c | 2 +- bgpd/bgpd.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index e3efbbf252..aaed29dc87 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -802,7 +802,7 @@ DEFUN_HIDDEN (no_bgp_multiple_instance, vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n"); vty_out(vty, "if you are using this please let the developers know\n"); - zlog_warn("Deprecated option: `bgp multiple-instance` being used"); + zlog_info("Deprecated option: `bgp multiple-instance` being used"); ret = bgp_option_unset(BGP_OPT_MULTIPLE_INSTANCE); if (ret < 0) { vty_out(vty, "%% There are more than two BGP instances\n"); @@ -827,7 +827,7 @@ DEFUN_HIDDEN (bgp_config_type, if (argv_find(argv, argc, "cisco", &idx)) { vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n"); vty_out(vty, "if you are using this please let the developers know!\n"); - zlog_warn("Deprecated option: `bgp config-type cisco` being used"); + zlog_info("Deprecated option: `bgp config-type cisco` being used"); bgp_option_set(BGP_OPT_CONFIG_CISCO); } else bgp_option_unset(BGP_OPT_CONFIG_CISCO); diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 9591fe673f..eeda58fbcf 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1016,7 +1016,7 @@ static int bgp_zebra_tm_connect(struct thread *t) ret = tm_table_manager_connect(zclient); } if (ret < 0) { - zlog_warn("Error connecting to table manager!"); + zlog_info("Error connecting to table manager!"); bgp_tm_status_connected = false; } else { if (!bgp_tm_status_connected) diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 82da0245b5..5002dd4474 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -4094,7 +4094,7 @@ static int peer_af_flag_modify(struct peer *peer, afi_t afi, safi_t safi, if (flag & PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS) { if (!bgp_flag_check( bgp, BGP_FLAG_DETERMINISTIC_MED)) { - zlog_warn( + zlog_info( "%s: enabling bgp deterministic-med, this is required" " for addpath-tx-bestpath-per-AS", peer->host); From deff24cad5511425e22fb9cde9cf4638241f8e58 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 15 Aug 2018 20:37:45 -0400 Subject: [PATCH 2/3] bgpd: Convert warn to debug There exists a few places where actual debugs were being displayed as warns. Convert them over to debugs and guard as appropriate. Signed-off-by: Donald Sharp --- bgpd/bgp_route.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 1ded492a20..2a1a0b9c1f 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -493,16 +493,18 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_info *new, } if (newattr->sticky && !existattr->sticky) { - zlog_warn( - "%s: %s wins over %s due to sticky MAC flag", - pfx_buf, new_buf, exist_buf); + if (debug) + zlog_debug( + "%s: %s wins over %s due to sticky MAC flag", + pfx_buf, new_buf, exist_buf); return 1; } if (!newattr->sticky && existattr->sticky) { - zlog_warn( - "%s: %s loses to %s due to sticky MAC flag", - pfx_buf, new_buf, exist_buf); + if (debug) + zlog_debug( + "%s: %s loses to %s due to sticky MAC flag", + pfx_buf, new_buf, exist_buf); return 0; } } From 68ede9c40127bfd3e098fa11da32bbdaae75f908 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 15 Aug 2018 20:44:31 -0400 Subject: [PATCH 3/3] bgpd: zlog_warn to assert for code that must be executed first In bgp_keepalives.c, it was noticed that we were ensuring that we called an intialization function first, but this is a development escape in that once this was fixed we never see it. So if a developer moves this assumption around, let's crash the program and lead them to this spot instead of silently ignoring the problem. Signed-off-by: Donald Sharp --- bgpd/bgp_keepalives.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bgpd/bgp_keepalives.c b/bgpd/bgp_keepalives.c index 3216683a54..f81836cc83 100644 --- a/bgpd/bgp_keepalives.c +++ b/bgpd/bgp_keepalives.c @@ -239,10 +239,10 @@ void bgp_keepalives_on(struct peer *peer) /* placeholder bucket data to use for fast key lookups */ static struct pkat holder = {0}; - if (!peerhash_mtx) { - zlog_warn("%s: call bgp_keepalives_init() first", __func__); - return; - } + /* + * We need to ensure that bgp_keepalives_init was called first + */ + assert(peerhash_mtx); pthread_mutex_lock(peerhash_mtx); { @@ -269,10 +269,10 @@ void bgp_keepalives_off(struct peer *peer) /* placeholder bucket data to use for fast key lookups */ static struct pkat holder = {0}; - if (!peerhash_mtx) { - zlog_warn("%s: call bgp_keepalives_init() first", __func__); - return; - } + /* + * We need to ensure that bgp_keepalives_init was called first + */ + assert(peerhash_mtx); pthread_mutex_lock(peerhash_mtx); {