New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(agw): Replaced the key for guti hashtable, currently the key is GUTI in string format #12653
fix(agw): Replaced the key for guti hashtable, currently the key is GUTI in string format #12653
Conversation
Thanks for opening a PR! 💯
Howto
More infoPlease take a moment to read through the Magma project's
If this is your first Magma PR, also consider reading
|
@@ -757,4 +757,5 @@ bstring paa_to_bstring(const paa_t* paa); | |||
// Return the hex representation of a char array | |||
char* bytes_to_hex(char* byte_array, int length, char* hex_array); | |||
|
|||
void convert_guti_to_string(guti_t* guti_p, char (*guti_str)[]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[cpplint] reported by reviewdog 🐶
Extra space before ( in function call [whitespace/parens] [4]
(*key_array_p)[i], *((*key_list)[i])); | ||
hashtable_rc_t ht_rc = obj_hashtable_uint64_ts_get( | ||
guti_htbl, (const void*)(*key_array_p)[i], sizeof(guti_t), &mme_ue_id); | ||
std::string guti_str((char*)(*key_array_p)[i], (GUTI_STRING_LEN - 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[cpplint] reported by reviewdog 🐶
Using C-style cast. Use reinterpret_cast<char*>(...) instead [readability/casting] [4]
@@ -180,9 +179,10 @@ void MmeNasStateConverter::proto_to_guti_table( | |||
std::unique_ptr<guti_t> guti = std::make_unique<guti_t>(); | |||
memset(guti.get(), 0, sizeof(guti_t)); | |||
|
|||
mme_app_convert_string_to_guti(guti.get(), kv.first); | |||
char guti_str[GUTI_STRING_LEN] = {}; | |||
strcpy(guti_str, (char*)(kv.first.c_str())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[cpplint] reported by reviewdog 🐶
Using C-style cast. Use reinterpret_cast<char*>(...) instead [readability/casting] [4]
@@ -180,9 +179,10 @@ void MmeNasStateConverter::proto_to_guti_table( | |||
std::unique_ptr<guti_t> guti = std::make_unique<guti_t>(); | |||
memset(guti.get(), 0, sizeof(guti_t)); | |||
|
|||
mme_app_convert_string_to_guti(guti.get(), kv.first); | |||
char guti_str[GUTI_STRING_LEN] = {}; | |||
strcpy(guti_str, (char*)(kv.first.c_str())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[cpplint] reported by reviewdog 🐶
Almost always, snprintf is better than strcpy [runtime/printf] [4]
f2dbcf1
to
9b89ba4
Compare
9b89ba4
to
26044c2
Compare
26044c2
to
971cc36
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, with minor change
@@ -367,3 +367,12 @@ char* bytes_to_hex(char* byte_array, int length, char* hex_array) { | |||
} | |||
return hex_array; | |||
} | |||
|
|||
void convert_guti_to_string(guti_t* guti_p, char (*guti_str)[]) { | |||
#define GUTI_STRING_LEN 21 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already defined in conversions.h
below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
@@ -541,8 +541,6 @@ struct emm_context_s* emm_context_get(emm_data_t* emm_data, | |||
const mme_ue_s1ap_id_t ue_id); | |||
struct emm_context_s* emm_context_get_by_imsi(emm_data_t* emm_data, | |||
imsi64_t imsi64); | |||
struct emm_context_s* emm_context_get_by_guti(emm_data_t* emm_data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -662,26 +662,6 @@ struct emm_context_s* emm_context_get_by_imsi( | |||
return emm_context_p; | |||
} | |||
|
|||
//------------------------------------------------------------------------------ | |||
struct emm_context_s* emm_context_get_by_guti(emm_data_t* emm_data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clean up!
971cc36
to
9ea686e
Compare
Oops! Looks like you failed the Howto
♻️ Updated: ✅ The check is passing the Semantic PR after the last commit. |
9ea686e
to
369e46e
Compare
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
@@ -367,3 +367,11 @@ char* bytes_to_hex(char* byte_array, int length, char* hex_array) { | |||
} | |||
return hex_array; | |||
} | |||
|
|||
void convert_guti_to_string(guti_t* guti_p, char (*guti_str)[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[cpplint] reported by reviewdog 🐶
Extra space before ( in function call [whitespace/parens] [4]
…hashtable_conversion Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
…UTI in string format (magma#12653) * Modified code to use guti in string format Signed-off-by: Rashmi <rashmi.sarwad@radisys.com> * Fixed OAI build failure Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Summary
Guti hash table is of object hash table, for which earlier key was pointer to object of structure, guti_t. As part of this PR, we changed the key as string format of GUTI.
Partially fixes the issue, #11189
The other part would be fixed by PR, #12573
Test Plan