From 4f2b880cee57abd46bac4d50952fdfd40d34bf2d Mon Sep 17 00:00:00 2001 From: Daniele Date: Fri, 25 Jun 2021 14:34:16 +0200 Subject: [PATCH] Quick solution for mnc values bug --- src/gnb.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gnb.cpp b/src/gnb.cpp index 548ef669c..6ee3a878e 100644 --- a/src/gnb.cpp +++ b/src/gnb.cpp @@ -22,6 +22,7 @@ #include #include #include +#include static app::CliServer *g_cliServer = nullptr; static nr::gnb::GnbConfig *g_refConfig = nullptr; @@ -41,8 +42,10 @@ static nr::gnb::GnbConfig *ReadConfigYaml() result->plmn.mcc = yaml::GetInt32(config, "mcc", 1, 999); yaml::GetString(config, "mcc", 3, 3); - result->plmn.mnc = yaml::GetInt32(config, "mnc", 0, 999); result->plmn.isLongMnc = yaml::GetString(config, "mnc", 2, 3).size() == 3; + auto mncValue = config["mnc"].Scalar(); + config["mnc"] = mncValue.erase(0, std::min(mncValue.find_first_not_of('0'), mncValue.size()-1)); + result->plmn.mnc = yaml::GetInt32(config, "mnc", 0, 999); result->nci = yaml::GetInt64(config, "nci", 0, 0xFFFFFFFFFll); result->gnbIdLength = yaml::GetInt32(config, "idLength", 22, 32);