Commit 02871149 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen
Browse files

Add mutex for PAA allocation

parent 021125d3
......@@ -30,9 +30,9 @@
int encode_extended_protocol_configuration_options(
protocol_configuration_options_nas_t extendedprotocolconfigurationoptions,
uint8_t iei, uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr = NULL;
uint32_t encoded = 0;
int encode_result = 0;
uint8_t* lenPtr = NULL;
uint32_t encoded = 0;
// int encode_result = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer,
((iei > 0) ?
......@@ -150,7 +150,7 @@ int decode_extended_protocol_configuration_options(
//------------------------------------------------------------------------------
int decode_protocol_configuration_options(
protocol_configuration_options_nas_t* protocolconfigurationoptions,
const uint8_t* const buffer, const const uint32_t len) {
const uint8_t* const buffer, const uint32_t len) {
int decoded = 0;
int decode_result = 0;
......
......@@ -33,6 +33,7 @@
#include "TLVEncoder.h"
#include "mmData.h"
#include "secu_defs.h"
#include "dynamic_memory_check.h"
/* L O C A L D E F I N I T I O N S */
#define SR_MAC_SIZE_BYTES 2
......@@ -940,6 +941,7 @@ static int _nas_message_decrypt(
// OAILOG_ERROR(LOG_NAS, "Unknown security header type %u",
// security_header_type); OAILOG_FUNC_RETURN (LOG_NAS, 0);
};
return 0;
}
static int _nas_message_plain_decode(
......
......@@ -157,7 +157,9 @@ class paa_dynamic {
std::map<std::string, dnn_dynamic_pools> dnns;
paa_dynamic() : ipv4_pools(), ipv6_pools(), dnns(){};
mutable std::shared_mutex m_ipv4_pools;
paa_dynamic() : ipv4_pools(), ipv6_pools(), dnns(), m_ipv4_pools(){};
public:
static paa_dynamic& get_instance() {
......@@ -173,6 +175,7 @@ class paa_dynamic {
const struct in_addr& first, const int range) {
if (pool_id >= 0) {
uint32_t uint32pool_id = uint32_t(pool_id);
std::unique_lock lock(m_ipv4_pools);
if (!ipv4_pools.count(uint32pool_id)) {
ipv4_pool pool(first, range);
ipv4_pools[uint32pool_id] = pool;
......@@ -206,6 +209,7 @@ class paa_dynamic {
if (dnns.count(dnn_label)) {
dnn_dynamic_pools& dnn_pool = dnns[dnn_label];
if (paa.pdu_session_type.pdu_session_type == PDU_SESSION_TYPE_E_IPV4) {
std::unique_lock lock(m_ipv4_pools);
for (std::vector<uint32_t>::const_iterator it4 =
dnn_pool.ipv4_pool_ids.begin();
it4 != dnn_pool.ipv4_pool_ids.end(); ++it4) {
......@@ -264,6 +268,7 @@ class paa_dynamic {
if (dnns.count(dnn_label)) {
dnn_dynamic_pools& dnn_pool = dnns[dnn_label];
if (paa.pdu_session_type.pdu_session_type == PDU_SESSION_TYPE_E_IPV4) {
std::unique_lock lock(m_ipv4_pools);
for (std::vector<uint32_t>::const_iterator it4 =
dnn_pool.ipv4_pool_ids.begin();
it4 != dnn_pool.ipv4_pool_ids.end(); ++it4) {
......@@ -295,6 +300,7 @@ class paa_dynamic {
bool release_paa(
const std::string& dnn_label, const struct in_addr& ipv4_address) {
std::unique_lock lock(m_ipv4_pools);
if (dnns.count(dnn_label)) {
dnn_dynamic_pools& dnn_pool = dnns[dnn_label];
for (std::vector<uint32_t>::const_iterator it4 =
......
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