Huge length for Initial Context Setup Request from AMF
When testing the OAI Core with RAN+UE Emulator, it seems the AMF is sending more bytes for Initial Context Setup Request than expected. E.g. usual length of this message is 165 or < 200 bytes in normal cases including NAS PDU (Registration Accept) in it. However, AMF here seems to send more bytes, when seen on pcap of Wireshark too. Due to this at the RAN, receives additional bytes and tries to decode the additional bytes too. Attached pcap is one such have 1320 bytes of payload in NGAP. ICSR-More-length-issue.pcapng
It seems when using msg->encode2Buffer(buffer, BUFFER_SIZE_2048); on the AMF side, those additional bytes are getting appended than the required. If msg->encode2NewBuffer(buffer, encoded_size); is used instead, the problem is not seen and only the required bytes are present as per the length of the respective NGAP message. Kindly review and fix.