Allocate VNF_info directly in config instead of global variable

This allows access to the VNF configuration in the various transport mechanisms straight from config, without this, the transport specific thread would cause a segmentation fault when trying to access the pack/unpack function pointers.
Add 2 functions to access the P5 and P7 VNF structures, to avoid having to always cast user_data and p7_vnfs
This commit is contained in:
Rúben Soares Silva
2025-10-23 08:45:24 +01:00
parent 206c7667e6
commit 244819c627
9 changed files with 87 additions and 79 deletions
+5 -4
View File
@@ -21,6 +21,8 @@
#include "socket_vnf.h"
#include "nfapi.h"
#include "nfapi_vnf.h"
#include <common/platform_constants.h>
#include "nfapi/oai_integration/vendor_ext.h" //TODO: Remove this include when removing the Aerial transport stuff
static bool send_p5_msg(vnf_t *vnf, nfapi_vnf_pnf_info_t *pnf, const void *msg, int len, uint8_t stream)
@@ -279,7 +281,6 @@ static int nfapi_nr_vnf_p5_start(nfapi_vnf_config_t *config)
// Verify that config is not null
if (config == 0)
return -1;
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
int p5ListenSock, p5Sock;
@@ -293,7 +294,7 @@ static int nfapi_nr_vnf_p5_start(nfapi_vnf_config_t *config)
struct sctp_initmsg initMsg = {0};
int noDelay;
vnf_t *vnf = (vnf_t *)(config);
vnf_t *vnf = (vnf_t *)(get_config());
NFAPI_TRACE(NFAPI_TRACE_INFO, "Starting P5 VNF connection on port %u\n", config->vnf_p5_port);
@@ -747,8 +748,8 @@ static int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t *config)
return -1;
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
vnf_p7_t *vnf_p7 = (vnf_p7_t *)config;
vnf_p7_t *vnf_p7 = get_p7_vnf();
vnf_p7 = (vnf_p7_t *)config;
// Create p7 receive udp port
// todo : this needs updating for Ipv6