Commit fcacd1fb authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Fix dnn encoding

parent 2be016a7
......@@ -144,3 +144,9 @@ void util::string_to_bstring(const std::string& str, bstring bstr) {
bstr->slen = str.length();
memcpy((void*) bstr->data, (void*) str.c_str(), str.length());
}
void util::string_to_dnn(const std::string& str, bstring bstr) {
std::string tmp = std::to_string(str.length()) + str;
bstr->slen = tmp.length();
memcpy((void*) bstr->data, (void*) tmp.c_str(), tmp.length());
}
......@@ -61,5 +61,6 @@ void ipv4v6_to_pdu_address_information(
struct in_addr ipv4_address, struct in6_addr ipv6_address, bstring str);
void string_to_bstring(const std::string& str, bstring bstr);
void string_to_dnn(const std::string& str, bstring bstr);
} // namespace util
#endif
......@@ -250,8 +250,8 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
// DNN
sm_msg->pdu_session_establishment_accept.dnn =
bfromcstralloc(sm_context_res.get_dnn().length(), "\0");
util::string_to_bstring(
bfromcstralloc(sm_context_res.get_dnn().length() + 1, "\0");
util::string_to_dnn(
sm_context_res.get_dnn(), sm_msg->pdu_session_establishment_accept.dnn);
Logger::smf_n1().debug("DNN %s", sm_context_res.get_dnn().c_str());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment