Fixed remote_addr.sin_port

For some reason the htons invocation got deleted which broke
the VNF P7 interface.

Also fixed some build issues, not sure how these got onto the
develop branch to begin with.
This commit is contained in:
Melissa Elkadi
2021-02-26 15:57:35 -08:00
parent 98c8ddb673
commit 8b2b78e477
14 changed files with 26 additions and 41 deletions
+5 -17
View File
@@ -48,29 +48,17 @@ void nfapi_set_trace_level(nfapi_trace_level_t new_level)
void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...)
{
char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH];
uint32_t num_chars;
va_list p_args;
struct timeval tv;
pthread_t tid = pthread_self();
(void)gettimeofday(&tv, NULL);
num_chars = (uint32_t)snprintf(trace_buff, TRACE_HEADER_LENGTH, "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid);
if (num_chars > TRACE_HEADER_LENGTH)
{
printf("trace_dbg: Error, num_chars is too large: %d", num_chars);
return;
}
snprintf(trace_buff, sizeof(trace_buff), "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid);
int n = strlen(trace_buff);
va_start(p_args, format);
if ((num_chars = (uint32_t)vsnprintf(&trace_buff[num_chars], MAX_MSG_LENGTH, format, p_args)))
{
if (level <= NFAPI_TRACE_WARN)
{
printf("%s", trace_buff);
}
printf("%s", trace_buff);
}
vsnprintf(trace_buff + n, sizeof(trace_buff) - n, format, p_args);
va_end(p_args);
fputs(trace_buff, stdout);
fflush(stdout);
}
+2 -8
View File
@@ -25,6 +25,7 @@
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <assert.h>
#include <stdio.h>
@@ -477,14 +478,7 @@ int nfapi_nr_vnf_start(nfapi_vnf_config_t* config)
int nfapi_vnf_start(nfapi_vnf_config_t* config)
{
// Verify that config is not null
if(config == 0)
return -1;
// Make sure to set the defined trace function before using NFAPI_TRACE
if(config->trace)
nfapi_trace_g = (nfapi_trace_fn_t)config->trace;
assert(config != 0);
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
int p5ListenSock, p5Sock;
+1 -1
View File
@@ -807,7 +807,7 @@ int nfapi_vnf_p7_add_pnf(nfapi_vnf_p7_config_t* config, const char* pnf_p7_addr,
// save the remote endpoint information
node->remote_addr.sin_family = AF_INET;
node->remote_addr.sin_port = pnf_p7_port;//htons(pnf_p7_port);
node->remote_addr.sin_port = htons(pnf_p7_port);
node->remote_addr.sin_addr.s_addr = inet_addr(pnf_p7_addr);
vnf_p7_connection_info_list_add(vnf_p7, node);