Dear sir,
Recently we meet a problem about socket communication in CC2534.
We use standard socket in server and client now, but this kind of communication will bind a port that is open.
Our sercurity scan tool will account this port isn't safe.
We check CC2534 source code and find the Unix Domain socket that is a safe socket communication.
How we switch socket to Unix Domain socket?
Please help us to modify code.
Thanks!
#ifdef NPI_UNIX
// Create the socket
sNPIlisten = socket(AF_UNIX, SOCK_STREAM, 0);
// Bind socket to a Unix domain address
local.sun_family = AF_UNIX;
strcpy(local.sun_path, "echo_socket");
unlink(local.sun_path);
len = strlen(local.sun_path) + sizeof(local.sun_family);
if (bind(sNPIlisten, (struct sockaddr *)&local, len) == -1)
{
perror("bind");
writeToNpiLnxLog("Port is probably already in use, please select an available port\n");
debug_printf("Port is probably already in use, please select an available port\n");
npi_ipc_errno = NPI_LNX_ERROR_IPC_SOCKET_BIND;
NPI_LNX_IPC_Exit(NPI_LNX_FAILURE, TRUE);
}
#else
sNPIlisten = socket(servinfo->ai_family, servinfo->ai_socktype,
servinfo->ai_protocol);
int yes = 1