Commit a57a10d8 authored by Vijay Chadachan's avatar Vijay Chadachan

Code improvements and Fix for Memory corruption issue

parent 81e2ba71
......@@ -112,7 +112,12 @@ void msc_log_message(
#define MESSAGE_CHART_GENERATOR msc_interface.msc_loaded
#ifdef MSC_INTERFACE
extern msc_interface_t msc_interface;
#else
msc_interface_t msc_interface;
#endif
#define MSC_INIT(arg1,arg2) if(msc_interface.msc_loaded) msc_interface.msc_init(arg1,arg2)
#define MSC_START_USE if(msc_interface.msc_loaded) msc_interface.msc_start_use
#define MSC_END if(msc_interface.msc_loaded) msc_interface.msc_end
......
......@@ -79,6 +79,8 @@ int stream_encrypt_eea1(stream_cipher_t *stream_cipher, uint8_t **out)
DevAssert(out != NULL);
n = ( stream_cipher->blength + 31 ) / 32;
int actual_buf_size = stream_cipher->blength >> 3;
zero_bit = stream_cipher->blength & 0x7;
memset(&snow_3g_context, 0, sizeof(snow_3g_context));
......@@ -120,7 +122,8 @@ int stream_encrypt_eea1(stream_cipher_t *stream_cipher, uint8_t **out)
/* Exclusive-OR the input data with keystream to generate the output bit
stream */
for (i=0; i<n*4; i++) {
LOG_A(OSA,"stream_cipher->blength %d loop till %d byte KS size is %d\n",stream_cipher->blength, actual_buf_size,4*n);
for (i=0; i<actual_buf_size; i++) {
stream_cipher->message[i] ^= *(((uint8_t*)KS)+i);
}
......
......@@ -54,7 +54,7 @@
extern RAN_CONTEXT_t RC;
extern uint16_t ss_rnti_g;
static acpCtx_t ctx_drb_g = NULL;
SSConfigContext_t SS_context;
extern SSConfigContext_t SS_context;
static unsigned char *buffer = NULL;
static const size_t size = 16 * 1024;
......
......@@ -286,11 +286,12 @@ int sys_add_reconfig_cell(struct CellConfigInfo_Type *AddOrReconfigure)
uint8_t num_CC = 0; /** NOTE: Handling only one cell */
for (int enb_id = 0; enb_id < RC.nb_inst; enb_id++)
{
MessageDef *msg_p = itti_alloc_new_message(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(enb_id), RRC_CONFIGURATION_REQ);
RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration;
if (AddOrReconfigure->Basic.d == true)
{
MessageDef *msg_p = itti_alloc_new_message(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(enb_id), RRC_CONFIGURATION_REQ);
RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration;
if (AddOrReconfigure->Basic.v.StaticCellInfo.d == true)
{
/** Handle Static Cell Info */
......
......@@ -48,7 +48,7 @@
#include "ss_eNB_sysind_task.h"
extern RAN_CONTEXT_t RC;
SSConfigContext_t SS_context;
extern SSConfigContext_t SS_context;
static acpCtx_t ctx_sysind_g = NULL;
static unsigned char *buffer = NULL;
static const size_t size = 16 * 1024;
......
......@@ -30,7 +30,7 @@
#include "SIDL_EUTRA_VNG_PORT.h"
#include "acpVng.h"
SSConfigContext_t SS_context;
extern SSConfigContext_t SS_context;
extern RAN_CONTEXT_t RC;
static acpCtx_t ctx_vng_g = NULL;
......@@ -241,7 +241,7 @@ ss_eNB_read_from_vng_socket(acpCtx_t ctx)
void *ss_eNB_vng_process_itti_msg(void *notUsed)
{
MessageDef *received_msg = NULL;
int result;
itti_poll_msg(TASK_VNG, &received_msg);
/* Check if there is a packet to handle */
......@@ -269,6 +269,9 @@ void *ss_eNB_vng_process_itti_msg(void *notUsed)
LOG_A(ENB_SS, "[VNG] Received unhandled message %d:%s\n",
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
}
result = itti_free(ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
AssertFatal(result == EXIT_SUCCESS, "[SYS] Failed to free memory (%d)!\n", result);
received_msg = NULL;
}
ss_eNB_read_from_vng_socket(ctx_vng_g);
......
......@@ -33,7 +33,7 @@
#include "ss_eNB_vt_timer_task.h"
SSConfigContext_t SS_context;
extern SSConfigContext_t SS_context;
extern RAN_CONTEXT_t RC;
......
......@@ -29,9 +29,10 @@
#include "ss_eNB_proxy_iface.h"
#include "SIDL_VIRTUAL_TIME_PORT.h"
#include "acpSysVT.h"
#define MSC_INTERFACE
#include "msc.h"
SSConfigContext_t SS_context;
extern SSConfigContext_t SS_context;
extern RAN_CONTEXT_t RC;
static acpCtx_t ctx_vtp_g = NULL;
......@@ -196,6 +197,7 @@ static inline void ss_send_vtp_resp(struct VirtualTimeInfo_Type *virtualTime)
//assert(message_p);
VtpCmdReq_t *req = (VtpCmdReq_t *)malloc(sizeof(VtpCmdReq_t));
LOG_A(ENB_APP,"itti_alloc %p\n", req);
req->header.preamble = 0xFEEDC0DE;
req->header.msg_id = SS_VTP_RESP;
req->header.length = sizeof(proxy_ss_header_t);
......
......@@ -44,6 +44,7 @@
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#define MSC_INTERFACE
#include "msc.h"
......
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