From 752b2fdc81570f23bb409f63971f66aa87dcaf2b Mon Sep 17 00:00:00 2001 From: Ze Gan Date: Thu, 4 Feb 2021 10:47:10 +0800 Subject: [PATCH 1/3] Enable log name Signed-off-by: Ze Gan --- cfgmgr/macsecmgrd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfgmgr/macsecmgrd.cpp b/cfgmgr/macsecmgrd.cpp index 2cad8fc56e..f77e3d8c07 100644 --- a/cfgmgr/macsecmgrd.cpp +++ b/cfgmgr/macsecmgrd.cpp @@ -47,7 +47,7 @@ int main(int argc, char **argv) try { - // Logger::linkToDbNative("macsecmgrd"); + Logger::linkToDbNative("macsecmgrd"); SWSS_LOG_NOTICE("--- Starting macsecmgrd ---"); swss::DBConnector cfgDb("CONFIG_DB", 0); From 831785cfeae180f11f6b0a0b17059270236456a6 Mon Sep 17 00:00:00 2001 From: Ze Gan Date: Thu, 4 Feb 2021 10:47:56 +0800 Subject: [PATCH 2/3] Fix bug and change path for integration Signed-off-by: Ze Gan --- cfgmgr/macsecmgr.cpp | 21 ++++++++++++++------- cfgmgr/macsecmgr.h | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/cfgmgr/macsecmgr.cpp b/cfgmgr/macsecmgr.cpp index bf5344c8d0..8007428937 100644 --- a/cfgmgr/macsecmgr.cpp +++ b/cfgmgr/macsecmgr.cpp @@ -24,11 +24,10 @@ using namespace std; using namespace swss; -#define WPA_SUPPLICANT_CMD "./wpa_supplicant" -#define WPA_CLI_CMD "./wpa_cli" -#define WPA_CONF "./wpa.conf" -// #define SOCK_DIR "/var/run/macsec/" -#define SOCK_DIR "./" +#define WPA_SUPPLICANT_CMD "/sbin/wpa_supplicant" +#define WPA_CLI_CMD "/sbin/wpa_cli" +#define WPA_CONF "/etc/wpa_supplicant.conf" +#define SOCK_DIR "/var/run/" constexpr std::uint64_t RETRY_TIME = 30; @@ -68,9 +67,17 @@ static bool get_value( return false; } - lexical_convert(*value_opt, value); + try + { + lexical_convert(*value_opt, value); + } + catch(const boost::bad_lexical_cast &e) + { + SWSS_LOG_ERROR("Cannot convert value(%s) in field(%s)", value_opt->c_str(), field.c_str()); + return false; + } - return false; + return true; } static void wpa_cli_commands(std::ostringstream & ostream) diff --git a/cfgmgr/macsecmgr.h b/cfgmgr/macsecmgr.h index 50bd04bbcf..eaefbd3e8b 100644 --- a/cfgmgr/macsecmgr.h +++ b/cfgmgr/macsecmgr.h @@ -27,7 +27,7 @@ class MACsecMgr : public Orch using TaskArgs = std::vector; struct MACsecProfile { - std::uint8_t priority; + std::uint32_t priority; std::string cipher_suite; std::string primary_cak; std::string primary_ckn; From 72e56bd99e595eaac529b507022929410bf8b729 Mon Sep 17 00:00:00 2001 From: Ze Gan Date: Thu, 4 Feb 2021 11:14:29 +0800 Subject: [PATCH 3/3] Polish the log level Signed-off-by: Ze Gan --- cfgmgr/macsecmgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfgmgr/macsecmgr.cpp b/cfgmgr/macsecmgr.cpp index 8007428937..57fdcd4c9a 100644 --- a/cfgmgr/macsecmgr.cpp +++ b/cfgmgr/macsecmgr.cpp @@ -63,7 +63,7 @@ static bool get_value( auto value_opt = swss::fvsGetValue(ta, field, true); if (!value_opt) { - SWSS_LOG_WARN("Cannot find field : %s", field.c_str()); + SWSS_LOG_DEBUG("Cannot find field : %s", field.c_str()); return false; }