Commit e4f59a03 authored by winckel's avatar winckel

Added asserts after ASN1 message encoding to detect buffer overflow or other encoding issues.

Increase RRC buffer size for RRCConnectionReconfiguration messages.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4926 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 69f07aad
This diff is collapsed.
...@@ -167,26 +167,27 @@ uint8_t do_RRCConnectionSetup(uint8_t Mod_id, ...@@ -167,26 +167,27 @@ uint8_t do_RRCConnectionSetup(uint8_t Mod_id,
@param cba_rnti RNTI for the cba transmission @param cba_rnti RNTI for the cba transmission
@returns Size of encoded bit stream in bytes*/ @returns Size of encoded bit stream in bytes*/
uint8_t do_RRCConnectionReconfiguration(uint8_t Mod_id, uint16_t do_RRCConnectionReconfiguration(uint8_t Mod_id,
uint8_t *buffer, uint8_t *buffer,
uint8_t UE_id, uint8_t UE_id,
uint8_t Transaction_id, uint8_t Transaction_id,
SRB_ToAddModList_t *SRB_list, SRB_ToAddModList_t *SRB_list,
DRB_ToAddModList_t *DRB_list, DRB_ToAddModList_t *DRB_list,
DRB_ToReleaseList_t *DRB_list2, DRB_ToReleaseList_t *DRB_list2,
struct SPS_Config *sps_Config, struct SPS_Config *sps_Config,
struct PhysicalConfigDedicated *physicalConfigDedicated, struct PhysicalConfigDedicated *physicalConfigDedicated,
MeasObjectToAddModList_t *MeasObj_list, MeasObjectToAddModList_t *MeasObj_list,
ReportConfigToAddModList_t *ReportConfig_list, ReportConfigToAddModList_t *ReportConfig_list,
QuantityConfig_t *quantityConfig, QuantityConfig_t *quantityConfig,
MeasIdToAddModList_t *MeasId_list, MeasIdToAddModList_t *MeasId_list,
MAC_MainConfig_t *mac_MainConfig, MAC_MainConfig_t *mac_MainConfig,
MeasGapConfig_t *measGapConfig, MeasGapConfig_t *measGapConfig,
MobilityControlInfo_t *mobilityInfo, MobilityControlInfo_t *mobilityInfo,
struct MeasConfig__speedStatePars *speedStatePars, struct MeasConfig__speedStatePars *speedStatePars,
RSRP_Range_t *rsrp, RSRP_Range_t *rsrp,
C_RNTI_t *cba_rnti, C_RNTI_t *cba_rnti,
struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList); struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList
*dedicatedInfoNASList);
/*** /***
* \brief Generate an MCCH-Message (eNB). This routine configures MBSFNAreaConfiguration (PMCH-InfoList and Subframe Allocation for MBMS data) * \brief Generate an MCCH-Message (eNB). This routine configures MBSFNAreaConfiguration (PMCH-InfoList and Subframe Allocation for MBMS data)
......
...@@ -139,7 +139,7 @@ typedef enum HO_STATE_e { ...@@ -139,7 +139,7 @@ typedef enum HO_STATE_e {
#define MAX_MEAS_ID 6 #define MAX_MEAS_ID 6
#define PAYLOAD_SIZE_MAX 1024 #define PAYLOAD_SIZE_MAX 1024
#define RRC_BUF_SIZE 140 #define RRC_BUF_SIZE 255
#define UNDEF_SECURITY_MODE 0xff #define UNDEF_SECURITY_MODE 0xff
#define NO_SECURITY_MODE 0x33 #define NO_SECURITY_MODE 0x33
......
...@@ -1180,6 +1180,8 @@ void rrc_ue_process_securityModeCommand(uint8_t Mod_id,uint32_t frame,SecurityMo ...@@ -1180,6 +1180,8 @@ void rrc_ue_process_securityModeCommand(uint8_t Mod_id,uint32_t frame,SecurityMo
(void*)&ul_dcch_msg, (void*)&ul_dcch_msg,
buffer, buffer,
100); 100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %d)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
#ifdef XER_PRINT #ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg); xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg);
...@@ -1262,6 +1264,8 @@ void rrc_ue_process_ueCapabilityEnquiry(uint8_t Mod_id,uint32_t frame,UECapabili ...@@ -1262,6 +1264,8 @@ void rrc_ue_process_ueCapabilityEnquiry(uint8_t Mod_id,uint32_t frame,UECapabili
&ue_CapabilityRAT_Container); &ue_CapabilityRAT_Container);
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, (void*) &ul_dcch_msg, buffer, 100); enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, (void*) &ul_dcch_msg, buffer, 100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %d)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
#ifdef XER_PRINT #ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg); xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg);
......
...@@ -598,9 +598,9 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration (u8 Mod_id, u32 ...@@ -598,9 +598,9 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration (u8 Mod_id, u32
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
eNB_RRC_UE_INFO *UE_info = &eNB_rrc_inst[Mod_id].Info.UE[UE_index]; eNB_RRC_UE_INFO *UE_info = &eNB_rrc_inst[Mod_id].Info.UE[UE_index];
#endif #endif
u8 buffer[RRC_BUF_SIZE]; u8 buffer[RRC_BUF_SIZE];
u8 size; u16 size;
int i; int i;
// configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE
eNB_RRC_INST *rrc_inst = &eNB_rrc_inst[Mod_id]; eNB_RRC_INST *rrc_inst = &eNB_rrc_inst[Mod_id];
...@@ -1096,7 +1096,6 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration (u8 Mod_id, u32 ...@@ -1096,7 +1096,6 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration (u8 Mod_id, u32
//rrc_rlc_data_req(Mod_id,frame, 1,(UE_index*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer); //rrc_rlc_data_req(Mod_id,frame, 1,(UE_index*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer);
pdcp_rrc_data_req (Mod_id, UE_index, frame, 1, DCCH, pdcp_rrc_data_req (Mod_id, UE_index, frame, 1, DCCH,
rrc_eNB_mui++, 0, size, buffer, 1); rrc_eNB_mui++, 0, size, buffer, 1);
} }
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
...@@ -1269,11 +1268,11 @@ void check_handovers(u8 Mod_id, u32 frame) { ...@@ -1269,11 +1268,11 @@ void check_handovers(u8 Mod_id, u32 frame) {
// 5.3.5.4 RRCConnectionReconfiguration including the mobilityControlInfo to prepare the UE handover // 5.3.5.4 RRCConnectionReconfiguration including the mobilityControlInfo to prepare the UE handover
void rrc_eNB_generate_RRCConnectionReconfiguration_handover (u8 Mod_id, u32 frame,u16 UE_index,u8 *nas_pdu,u32 nas_length) { void rrc_eNB_generate_RRCConnectionReconfiguration_handover (u8 Mod_id, u32 frame,u16 UE_index,u8 *nas_pdu,u32 nas_length) {
u8 buffer[RRC_BUF_SIZE]; u8 buffer[RRC_BUF_SIZE];
u8 size; u16 size;
int i; int i;
uint8_t rv[2]; uint8_t rv[2];
u16 Idx; u16 Idx;
// configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE
eNB_RRC_INST *rrc_inst = &eNB_rrc_inst[Mod_id]; eNB_RRC_INST *rrc_inst = &eNB_rrc_inst[Mod_id];
......
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