Skip to content

Commit

Permalink
Adding protectionScheme into config file
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephane GORSE committed May 9, 2023
1 parent 88c99cb commit 4cdac7d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
2 changes: 2 additions & 0 deletions config/custom-ue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ supi: 'imsi-286010000000001'
mcc: '286'
# Mobile Network Code value of HPLMN (2 or 3 digits)
mnc: '93'
# SUCI Protection Scheme : 0 for Null-scheme, 1 for Profile A and 2 for Profile B
protectionScheme: 0
# Routing Indicator
routingIndicator: '0000'

Expand Down
2 changes: 2 additions & 0 deletions config/free5gc-ue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ supi: 'imsi-208930000000003'
mcc: '208'
# Mobile Network Code value of HPLMN (2 or 3 digits)
mnc: '93'
# SUCI Protection Scheme : 0 for Null-scheme, 1 for Profile A and 2 for Profile B
protectionScheme: 0
# Routing Indicator
routingIndicator: '0000'

Expand Down
2 changes: 2 additions & 0 deletions config/open5gs-ue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ supi: 'imsi-999700000000001'
mcc: '999'
# Mobile Network Code value of HPLMN (2 or 3 digits)
mnc: '70'
# SUCI Protection Scheme : 0 for Null-scheme, 1 for Profile A and 2 for Profile B
protectionScheme: 0
# Routing Indicator
routingIndicator: '0000'

Expand Down
2 changes: 2 additions & 0 deletions src/ue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ static nr::ue::UeConfig *ReadConfigYaml()

if (yaml::HasField(config, "supi"))
result->supi = Supi::Parse(yaml::GetString(config, "supi"));
if (yaml::HasField(config, "protectionScheme"))
result->protectionScheme = yaml::GetInt32(config, "protectionScheme", 0, 255);
if (yaml::HasField(config, "imei"))
result->imei = yaml::GetString(config, "imei", 15, 15);
if (yaml::HasField(config, "imeiSv"))
Expand Down
16 changes: 12 additions & 4 deletions src/ue/nas/mm/identity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ nas::IE5gsMobileIdentity NasMm::generateSuci()
{
auto &supi = m_base->config->supi;
auto &plmn = m_base->config->hplmn;
auto &protectionScheme = m_base->config->protectionScheme;

if (!supi.has_value())
return {};
Expand All @@ -99,10 +100,17 @@ nas::IE5gsMobileIdentity NasMm::generateSuci()
{
ret.imsi.routingIndicator = "0000";
}
ret.imsi.protectionSchemaId = 0;
ret.imsi.homeNetworkPublicKeyIdentifier = 0;
ret.imsi.schemeOutput = imsi.substr(plmn.isLongMnc ? 6 : 5);
return ret;
if (protectionScheme == 0) {
ret.imsi.protectionSchemaId = 0;
ret.imsi.homeNetworkPublicKeyIdentifier = 0;
ret.imsi.schemeOutput = imsi.substr(plmn.isLongMnc ? 6 : 5);
return ret;
}
else
{
m_logger->err("Protection Scheme %d not implemented", protectionScheme);
return {};
}
}

nas::IE5gsMobileIdentity NasMm::getOrGeneratePreferredId()
Expand Down
1 change: 1 addition & 0 deletions src/ue/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ struct UeConfig
{
/* Read from config file */
std::optional<Supi> supi{};
int protectionScheme;
std::optional<std::string> routingIndicator{};
Plmn hplmn{};
OctetString key{};
Expand Down

0 comments on commit 4cdac7d

Please sign in to comment.