Open jain-ab opened 4 years ago
Hi @jain-ab,
Can you provide the initial message in XER or another format, the exact ASN.1 files as extracting the ASN.1 from the specs is a tedious and time consuming task and the exact command you've used to compile the asn?
Also if you have a minimal reproducible example can you share it as well?
Hi @velichkov ,
Attached file contains the message in XER format.
I am trying the aper enocde/ decode of this message abd encoding is success and it provides the hex as 00 00 00 1e 00 00 03 00 4e 00 02 00 12 00 00 40 01 01 00 30 00 0c 40 01 00 50 00 06 64 b2 04 40 24 24
But aper decoding fails with the same hex.
I used the following command to compile the asn
./asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps ../a38473-f40.asn
Thanks
Here it is , renamed it to .txt to attach.
A preliminary investigation result :
Decoding fails at NativeInteger_compare
when performing check asn_VAL_4_id_UE_associatedLogicalF1_ConnectionItem
in function select_UE_associatedLogicalF1_ConnectionItemRes_value_type()
It should be decimal 80 (i.e. 0x50 in hexadecimal) but this function compares 0x5000 with 0x50
Hi @brchiu and @velichkov,
Could you please suggest a fix for this?
Thanks
Hi velichkov and @brchiu Thank you for your help so far! Please can you suggest to move on this issue? Thanks
Hello @jain-ab I'm experiencing exactly the same issue. Have you managed to solve it?
Hi @brchiu @velichkov I think that length of the sequence is incorrectly decoded here. Please look at the logs:
Getting open type ResetType encoded in 10 bytes (per_opentype.c:437)
[PER got 2<=80 bits => span 2 +0[2..80]:40 (78) => 0x1] (asn_bit_data.c:132)
CHOICE ResetType got index 1 in range 2 (constr_CHOICE.c:1051)
Discovered CHOICE ResetType encodes partOfF1-Interface (constr_CHOICE.c:1080)
getting nsnnwn with range 65536 (per_support.c:361)
Aligning 6 bits (per_support.c:301)
[PER got 6<=78 bits => span 8 +0[8..80]:40 (72) => 0x0] (asn_bit_data.c:132)
[PER got 16<=72 bits => span 24 +1[16..72]:01 (56) => 0x100] (asn_bit_data.c:132)
Got to decode 256 elements (eff -1) (constr_SET_OF.c:1153)
Here are the 10 bytes mentioned in first line of logs: 40 01 00 50 00 04 60 10 00 01
partOfF1-Interface is a sequence of ProtocolIE-SingleContainer. There can be 65536 items. Hence decoder takes second and third byte (01 00) as number of elements. The bytes are decoded as 256 which is incorrect (aper_get_length() returns 256). What happens next is that the decoder tries to decode the id field. Because it consumed two bytes instead of one, it takes bytes 50 00 instead of 00 50 and hence the wrong id value.
If a seqence can hold 65536 items then length needs 2 bytes. But I suppose the length here is somehow compressed to one byte and the APER decoder doesn't take it into account.
Fixed basing on https://github.com/open5gs/open5gs/issues/773
Hi, I am trying to encode / decode Reset message from 38.473 f40 (V15.4.0 (2018-12)) using aper encode/decode.
Reset ::= SEQUENCE { protocolIEs ProtocolIE-Container { {ResetIEs} }, ... }
ResetIEs F1AP-PROTOCOL-IES ::= { { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| { ID id-ResetType CRITICALITY reject TYPE ResetType PRESENCE mandatory }, ... } ResetType ::= CHOICE { f1-Interface ResetAll, partOfF1-Interface UE-associatedLogicalF1-ConnectionListRes, choice-extension ProtocolIE-SingleContainer { { ResetType-ExtIEs} } } UE-associatedLogicalF1-ConnectionListRes ::= SEQUENCE (SIZE(1.. maxnoofIndividualF1ConnectionsToReset)) OF ProtocolIE-SingleContainer { { UE-associatedLogicalF1-ConnectionItemRes } }
UE-associatedLogicalF1-ConnectionItemRes F1AP-PROTOCOL-IES ::= { { ID id-UE-associatedLogicalF1-ConnectionItem CRITICALITY reject TYPE UE-associatedLogicalF1-ConnectionItem PRESENCE mandatory}, ... }
UE-associatedLogicalF1-ConnectionItem ::= SEQUENCE { gNB-CU-UE-F1AP-ID GNB-CU-UE-F1AP-ID OPTIONAL, gNB-DU-UE-F1AP-ID GNB-DU-UE-F1AP-ID OPTIONAL, iE-Extensions ProtocolExtensionContainer { { UE-associatedLogicalF1-ConnectionItemExtIEs} } OPTIONAL, ... }
Aper Encoding is success and it gives the encoded hex buffer as below
00 00 00 1e 00 00 03 00 4e 00 02 00 12 00 00 40 01 01 00 30 00 0c 40 01 00 50 00 06 64 b2 04 40 24 24
But when I try to decode the same hex buffer using aper decode it fails
Debug logs shows decoding fails UE-associatedLogicalF1-ConnectionItemRes
Decoded Criticality = 0 (skeletons/NativeEnumerated.c:293) Decoding member "value" in ProtocolIE-SingleContainer (skeletons/constr_SEQUENCE.c:1599) Failed to decode element ProtocolIE-SingleContainer (skeletons/OPEN_TYPE.c:421) Failed decode value in ProtocolIE-SingleContainer skeletons/constr_SEQUENCE.c:1609) UE-associatedLogicalF1-ConnectionListRes SET OF ProtocolIE-SingleContainer decoded 2, 0xa09590 (skeletons/constr_SET_OF.c:1262) Failed decoding ProtocolIE-SingleContainer of UE-associatedLogicalF1-ConnectionListRes (SET OF) (skeletons/constr_SET_OF.c:1272)
Is this something known bug and is there any fix available? Please suggest.
Thanks