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

Fix issue for ePCO

parent dd8c27ba
...@@ -46,15 +46,16 @@ int encode_extended_protocol_configuration_options( ...@@ -46,15 +46,16 @@ int encode_extended_protocol_configuration_options(
} }
lenPtr = (buffer + encoded); lenPtr = (buffer + encoded);
encoded++; uint16_t temp = 0;
encoded += 2; //ENCODE_U16
lenPtr = (buffer + encoded);
encoded++;
encoded += encode_protocol_configuration_options( encoded += encode_protocol_configuration_options(
extendedprotocolconfigurationoptions, buffer + encoded, len - encoded); extendedprotocolconfigurationoptions, buffer + encoded, len - encoded);
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); uint32_t len_ie = encoded - 2 - ((iei > 0) ? 1 : 0);
ENCODE_U16(lenPtr, len_ie , temp);
//*lenPtr = encoded - 2 - ((iei > 0) ? 1 : 0);
return encoded; return encoded;
} }
...@@ -84,16 +85,26 @@ int encode_protocol_configuration_options( ...@@ -84,16 +85,26 @@ int encode_protocol_configuration_options(
.protocol_or_container_ids[num_protocol_or_container_id] .protocol_or_container_ids[num_protocol_or_container_id]
.length; .length;
encoded++; encoded++;
if ( protocolconfigurationoptions
.protocol_or_container_ids[num_protocol_or_container_id]
.length
>0 ) {
if ((encode_result = encode_bstring( if ((encode_result = encode_bstring(
protocolconfigurationoptions protocolconfigurationoptions
.protocol_or_container_ids[num_protocol_or_container_id] .protocol_or_container_ids[num_protocol_or_container_id]
.contents, .contents,
buffer + encoded, len - encoded)) < 0) buffer + encoded, protocolconfigurationoptions
.protocol_or_container_ids[num_protocol_or_container_id]
.length
)) < 0)
return encode_result; return encode_result;
else else
encoded += encode_result; encoded += encode_result;
} else {
encoded += protocolconfigurationoptions
.protocol_or_container_ids[num_protocol_or_container_id]
.length;
}
num_protocol_or_container_id += 1; num_protocol_or_container_id += 1;
} }
return encoded; return encoded;
...@@ -111,11 +122,23 @@ int decode_extended_protocol_configuration_options( ...@@ -111,11 +122,23 @@ int decode_extended_protocol_configuration_options(
decoded++; decoded++;
} }
ielen = *(buffer + decoded); DECODE_U16(buffer+decoded, ielen, decoded);
if (((*(buffer + decoded) >> 7) & 0x1) != 1) {
return TLV_VALUE_DOESNT_MATCH;
}
// Bits 7 to 4 of octet 3 are spare, read as 0
if (((*(buffer + decoded) & 0x78) >> 3) != 0) {
return TLV_VALUE_DOESNT_MATCH;
}
extendedprotocolconfigurationoptions->configuration_protocol =
(*(buffer + decoded) >> 1) & 0x7;
decoded++; decoded++;
decode_result = decode_protocol_configuration_options( decode_result = decode_protocol_configuration_options(
extendedprotocolconfigurationoptions, buffer + decoded, ielen - decoded); extendedprotocolconfigurationoptions, buffer + decoded, ielen);
if (decode_result < 0) { if (decode_result < 0) {
return decode_result; return decode_result;
...@@ -132,7 +155,7 @@ int decode_protocol_configuration_options( ...@@ -132,7 +155,7 @@ int decode_protocol_configuration_options(
const uint8_t* const buffer, const const uint32_t len) { const uint8_t* const buffer, const const uint32_t len) {
int decoded = 0; int decoded = 0;
int decode_result = 0; int decode_result = 0;
/*
if (((*(buffer + decoded) >> 7) & 0x1) != 1) { if (((*(buffer + decoded) >> 7) & 0x1) != 1) {
return TLV_VALUE_DOESNT_MATCH; return TLV_VALUE_DOESNT_MATCH;
} }
...@@ -141,10 +164,10 @@ int decode_protocol_configuration_options( ...@@ -141,10 +164,10 @@ int decode_protocol_configuration_options(
if (((*(buffer + decoded) & 0x78) >> 3) != 0) { if (((*(buffer + decoded) & 0x78) >> 3) != 0) {
return TLV_VALUE_DOESNT_MATCH; return TLV_VALUE_DOESNT_MATCH;
} }
*/
protocolconfigurationoptions->configuration_protocol = // protocolconfigurationoptions->configuration_protocol =
(*(buffer + decoded) >> 1) & 0x7; // (*(buffer + decoded) >> 1) & 0x7;
decoded++; // decoded++;
protocolconfigurationoptions->num_protocol_or_container_id = 0; protocolconfigurationoptions->num_protocol_or_container_id = 0;
while (3 <= ((int32_t) len - (int32_t) decoded)) { while (3 <= ((int32_t) len - (int32_t) decoded)) {
...@@ -155,6 +178,7 @@ int decode_protocol_configuration_options( ...@@ -155,6 +178,7 @@ int decode_protocol_configuration_options(
->num_protocol_or_container_id] ->num_protocol_or_container_id]
.id, .id,
decoded); decoded);
DECODE_U8( DECODE_U8(
buffer + decoded, buffer + decoded,
protocolconfigurationoptions protocolconfigurationoptions
......
...@@ -713,16 +713,24 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -713,16 +713,24 @@ void smf_app::handle_pdu_session_create_sm_context_request(
// TODO: AlwaysonPDUSessionRequested // TODO: AlwaysonPDUSessionRequested
// TODO: SMPDUDNRequestContainer // TODO: SMPDUDNRequestContainer
// TODO: ExtendedProtocolConfigurationOptions // TODO: ExtendedProtocolConfigurationOptions
if (decoded_nas_msg.plain.sm.pdu_session_establishment_request Logger::smf_app().debug(
.extendedprotocolconfigurationoptions.num_protocol_or_container_id > "pco ext %d, spare %d, configuration protocol %d,number_ids %d", decoded_nas_msg.plain.sm.pdu_session_establishment_request
0) { .extendedprotocolconfigurationoptions.ext,
decoded_nas_msg.plain.sm.pdu_session_establishment_request
.extendedprotocolconfigurationoptions.spare,decoded_nas_msg.plain.sm.pdu_session_establishment_request
.extendedprotocolconfigurationoptions.configuration_protocol,decoded_nas_msg.plain.sm.pdu_session_establishment_request
.extendedprotocolconfigurationoptions.num_protocol_or_container_id );
// if (decoded_nas_msg.plain.sm.pdu_session_establishment_request
// .extendedprotocolconfigurationoptions.num_protocol_or_container_id >
// 0) {
protocol_configuration_options_t pco = {}; protocol_configuration_options_t pco = {};
xgpp_conv::protocol_configuration_options_nas_to_core( xgpp_conv::protocol_configuration_options_nas_to_core(
decoded_nas_msg.plain.sm.pdu_session_establishment_request decoded_nas_msg.plain.sm.pdu_session_establishment_request
.extendedprotocolconfigurationoptions, .extendedprotocolconfigurationoptions,
pco); pco);
smreq->req.set_pco(pco); smreq->req.set_pco(pco);
} // }
// Get necessary information // Get necessary information
supi_t supi = smreq->req.get_supi(); supi_t supi = smreq->req.get_supi();
......
...@@ -48,18 +48,18 @@ int smf_app::pco_push_protocol_or_container_id( ...@@ -48,18 +48,18 @@ int smf_app::pco_push_protocol_or_container_id(
pco.num_protocol_or_container_id) { pco.num_protocol_or_container_id) {
return RETURNerror; return RETURNerror;
} }
pco.protocol_or_container_ids[pco.num_protocol_or_container_id].protocol_id = pco_protocol_or_container_id_t pco_item = {};
pco_item.protocol_id =
poc_id->protocol_id; poc_id->protocol_id;
pco.protocol_or_container_ids[pco.num_protocol_or_container_id] pco_item.length_of_protocol_id_contents = poc_id->length_of_protocol_id_contents;
.length_of_protocol_id_contents = poc_id->length_of_protocol_id_contents; pco_item.protocol_id_contents = poc_id->protocol_id_contents;
pco.protocol_or_container_ids[pco.num_protocol_or_container_id] // assert(
.protocol_id_contents = poc_id->protocol_id_contents; // pco.protocol_or_container_ids[pco.num_protocol_or_container_id]
assert( // .length_of_protocol_id_contents ==
pco.protocol_or_container_ids[pco.num_protocol_or_container_id] // pco.protocol_or_container_ids[pco.num_protocol_or_container_id]
.length_of_protocol_id_contents == // .protocol_id_contents.size());
pco.protocol_or_container_ids[pco.num_protocol_or_container_id]
.protocol_id_contents.size());
// poc_id->protocol_id_contents = nullptr; // poc_id->protocol_id_contents = nullptr;
pco.protocol_or_container_ids.push_back(pco_item);
pco.num_protocol_or_container_id += 1; pco.num_protocol_or_container_id += 1;
return RETURNok; return RETURNok;
} }
......
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