Fix various problems in 4G NAS handling

- rename as_nas_info_t member data to nas_data to have a uniq name to
  trace between complex malloc/free of this pointer
- fix, maybe not perfect, these pais od malloc/free
- remove typedef name changes across transmission of these as_nas_info_t
  over itti, as name changing makes it even more confusing
- remove globals that are likely possible races
- in as_message_decode() fix memcpy size, it is hard to understand the
  initial idea, likely the author beleives a struct of struct makes a
  intermediate pointer
- in network_api.c remove globals (static but used globally)
- remove casts that are there to hide gcc warnings on probable unaligned
  access
- remain a weird mix of packed/unpacked versions of the same typedef,
  but gcc is happy
This commit is contained in:
Laurent THOMAS
2024-10-22 11:05:20 +02:00
parent 8df8de894b
commit e48e38650d
15 changed files with 203 additions and 330 deletions
+5 -4
View File
@@ -253,7 +253,8 @@ static void *_nas_network_mngr(void *args)
/* Network receiving loop */
while (true) {
/* Read the network data message */
bytes = network_api_read_data (*fd);
char _network_api_recv_buffer[NETWORK_API_RECV_BUFFER_SIZE] = {0};
bytes = network_api_read_data(*fd, _network_api_recv_buffer);
if (bytes == RETURNerror) {
/* Failed to read data from the network sublayer;
@@ -269,7 +270,8 @@ static void *_nas_network_mngr(void *args)
}
/* Decode the network data message */
network_message_id = network_api_decode_data (bytes);
as_message_t _as_data = {};
network_message_id = network_api_decode_data(bytes, &_as_data);
if (network_message_id == RETURNerror) {
/* Failed to decode data read from the network sublayer */
@@ -277,8 +279,7 @@ static void *_nas_network_mngr(void *args)
}
/* Process the network data message */
ret_code = nas_network_process_data (user, network_message_id,
network_api_get_data ());
ret_code = nas_network_process_data(user, network_message_id, &_as_data);
if (ret_code != RETURNok) {
/* The network data message has not been successfully