aligungr / UERANSIM

Open source 5G UE and RAN (gNodeB) implementation.
GNU General Public License v3.0
735 stars 308 forks source link

[gNB] APER decoding failed for SCTP message #684

Open trawkam opened 6 months ago

trawkam commented 6 months ago

Hello,

When connecting to E\ AMF NG Setup fails with error:

UERANSIM v3.2.6
[2024-01-11 13:23:14.344] [sctp] [info] Trying to establish SCTP connection... (10.9.248.202:38412)
[2024-01-11 13:23:14.357] [sctp] [info] SCTP connection established (10.9.248.202:38412)
[2024-01-11 13:23:14.358] [sctp] [debug] SCTP association setup ascId[424]
[2024-01-11 13:23:14.358] [ngap] [debug] Sending NG Setup Request
[2024-01-11 13:23:14.371] [ngap] [error] APER decoding failed for SCTP message
[2024-01-11 13:23:14.371] [ngap] [warning] Sending an error indication with cause: protocol/transfer-syntax-error

I have compared received response with the one from Open5GS (which works correct) and the only difference i see is additional IE-Extension in ServedGUAMIItem list item:

image

Stg22 commented 6 months ago

The current version of UERANSIM is based on the release 3GPP 15.8 (see https://github.com/aligungr/UERANSIM/blob/master/tools/ngap-15.8.0.asn1). However, the use of GUAMIType has been defined into the Release 16.x. And unfortunately, the ASN.1 compiler uses for the project does not include UTF8String requires by the new ASN.1 file (Release 16.x).

So I guess significant code modification are required to support such exchanges.

Stg22 commented 6 months ago

A temporary solution has been found... By using the ASN1 file from the Release 3GPP 16.14 of the document TS.38.413, it is possible to get all required source code.

Indeed, the asn1 compiler from the OpenAirInterface project (with the branch velichkov_s1ap_plus_option_group ) with the environment variable ASN1C_PREFIX=ASNNGAP is able to produce files .c and .h. These files will replace those in src/asn/ngap.

Note that RRC has to be updated in a similar way but needs slight additonal modifications.

Obviously, GUAMIType is not handled but do not stop the state machine. So it is not a final solution.

huaperez commented 5 months ago

@Stg22 I am facing a similar issue as described in the root cause. How to get the temporary solution? It is ok is GUAMIType is not handled at this moment.

Stg22 commented 5 months ago

You need to get ASN1 compiler from the project Open Air Interface and to use that tool from the branch velichkov_s1ap_plus_option_group. Then you need to extract ASN1 file from the 3GPP Document 38.413 Release 16 (for instance the latest one: 16.14). Set the environment varaible export ASN_PREFIX=ASNNGAP and launch the compiler with this file. You will get a set of files (.c and .h) which will replaced those in the directory https://github.com/aligungr/UERANSIM/tree/master/src/asn/ngap. You will need also to put some additional files from the directory "skeletons" (UTF8String, ...) of asn1 source code to the following directory https://github.com/aligungr/UERANSIM/tree/master/src/asn/asn1c. If you don't do that, you will get compiling error (note that is is a good way to identify the additional files required from the directory "skeletons" :o) ) Finally, recompile UERANSIM. You can apply the same procedure for RRC in order to have also a release 16.

I will try to provide a more detail procedure later.

vulcanfan commented 2 months ago

Hi @Stg22 I have tried to compile Rel 16 NGAP with the branch you indicated above, but I'm getting errors such as:

WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 8066 in ngap.asn1
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 8067 in ngap.asn1
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 8067 in ngap.asn1
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 8067 in ngap.asn1
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 8068 in ngap.asn1
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 8068 in ngap.asn1
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 8068 in ngap.asn1
FATAL: Name "e_ASN_NGAP_extensionValue" is generated by NGAP-Containers.extensionValue at line ngap.asn1:8055 and NGAP-Containers.extensionValue at line ngap.asn1:8055
FATAL: Name "enum ASN_NGAP_extensionValue" is generated by NGAP-Containers.extensionValue at line ngap.asn1:8055 and NGAP-Containers.extensionValue at line ngap.asn1:8055
FATAL: Name "ASN_NGAP_extensionValue_PR" is generated by NGAP-Containers.extensionValue at line ngap.asn1:8055 and NGAP-Containers.extensionValue at line ngap.asn1:8055

I don't know if the parameterization Warning can be ignored. But the Fatal errors seem related, and seems to be complaining that a type definition on a line is conflicting with itself.

If I use -fcompound-names then the compilation completes, but then building UERANSIM fails because of various missing type definitions related to parameterised types. Eg:

[  2%] Building C object src/asn/ngap/CMakeFiles/asn-ngap.dir/ASN_NGAP_AMF-TNLAssociationSetupItem.c.o
In file included from ./UERANSIM/src/asn/ngap/ASN_NGAP_ProtocolExtensionField.h:19,
                 from ./UERANSIM/src/asn/ngap/ASN_NGAP_ProtocolExtensionContainer.h:3234,
                 from ./UERANSIM/src/asn/ngap/ASN_NGAP_EndpointIPAddressAndPort.h:46,
                 from ./UERANSIM/src/asn/ngap/ASN_NGAP_ProtocolIE-Field.h:22,
                 from ./UERANSIM/src/asn/ngap/ASN_NGAP_ProtocolIE-SingleContainer.h:15,
                 from ./UERANSIM/src/asn/ngap/ASN_NGAP_CPTransportLayerInformation.h:16,
                 from ./UERANSIM/src/asn/ngap/ASN_NGAP_AMF-TNLAssociationSetupItem.h:15,
                 from ./UERANSIM/src/asn/ngap/ASN_NGAP_AMF-TNLAssociationSetupItem.c:8:
./UERANSIM/src/asn/ngap/ASN_NGAP_UPTransportLayerInformation.h:35:17: error: unknown type name ‘ASN_NGAP_ProtocolIE_SingleContainer_8012P48_t’
   35 |                 ASN_NGAP_ProtocolIE_SingleContainer_8012P48_t    choice_Extensions;
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The reason it can't find the type definition is because it referenced by ASN_NGAP_UPTransportLayerInformation.h before the type gets declared lower down in ASN_NGAP_ProtocolIE-SingleContainer.h. That is, from above, ASN_NGAP_ProtocolIE-SingleContainer.h pulls in ASN_NGAP_ProtocolIE-Field.h and eventually ASN_NGAP_UPTransportLayerInformation.h before ASN_NGAP_ProtocolIE_SingleContainer_8012P48_t is declared lower down in ASN_NGAP_ProtocolIE-SingleContainer.h. So a dependency issue.

Please can you advise how you managed to compile Rel16, and any hints you can give here? Many thanks in advance