Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alex037yang
OpenXG-RAN
Commits
64fd6112
Commit
64fd6112
authored
Feb 09, 2021
by
Michael Cook
Committed by
Melissa Elkadi
Apr 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Error checking added to recvfrom functions
Also added a variable for synchronizing UDP buffer lengths
parent
6e10329d
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
53 additions
and
13 deletions
+53
-13
nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h
nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h
+2
-0
nfapi/open-nFAPI/pnf/src/pnf_p7.c
nfapi/open-nFAPI/pnf/src/pnf_p7.c
+8
-1
nfapi/open-nFAPI/vnf/src/vnf_p7.c
nfapi/open-nFAPI/vnf/src/vnf_p7.c
+2
-2
openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+12
-1
openair2/PHY_INTERFACE/phy_stub_UE.c
openair2/PHY_INTERFACE/phy_stub_UE.c
+9
-4
openair2/RRC/LTE/rrc_UE.c
openair2/RRC/LTE/rrc_UE.c
+8
-1
openair2/UTIL/ASYNC_IF/socket_link.c
openair2/UTIL/ASYNC_IF/socket_link.c
+5
-1
openair3/GTPV1-U/gtpv1u_eNB.c
openair3/GTPV1-U/gtpv1u_eNB.c
+1
-1
openair3/GTPV1-U/gtpv1u_eNB_defs.h
openair3/GTPV1-U/gtpv1u_eNB_defs.h
+1
-0
openair3/UDP/udp_eNB_task.c
openair3/UDP/udp_eNB_task.c
+5
-2
No files found.
nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h
View file @
64fd6112
...
...
@@ -27,6 +27,8 @@
#define NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH 3
#define NFAPI_MAX_NUM_RF_BANDS 16
#define NFAPI_MAX_PACKED_MESSAGE_SIZE 8192
// The following definition control the size of arrays used in the interface.
// These may be changed if desired. They are used in the encoder to make sure
// that the user has not specified a 'count' larger than the max array, and also
...
...
nfapi/open-nFAPI/pnf/src/pnf_p7.c
View file @
64fd6112
...
...
@@ -2948,12 +2948,19 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time)
}
// read the segment
recvfrom_result
=
recvfrom
(
pnf_p7
->
p7_sock
,
pnf_p7
->
rx_message_buffer
,
header
.
message_length
,
MSG_DONTWAIT
,
(
struct
sockaddr
*
)
&
remote_addr
,
&
remote_addr_size
);
recvfrom_result
=
recvfrom
(
pnf_p7
->
p7_sock
,
pnf_p7
->
rx_message_buffer
,
pnf_p7
->
rx_message_buffer_size
,
MSG_DONTWAIT
|
MSG_TRUNC
,
(
struct
sockaddr
*
)
&
remote_addr
,
&
remote_addr_size
);
now_hr_time
=
pnf_get_current_time_hr
();
//DJP - moved to here - get closer timestamp???
if
(
recvfrom_result
>
0
)
{
if
(
recvfrom_result
!=
header
.
message_length
)
{
NFAPI_TRACE
(
NFAPI_TRACE_ERROR
,
"%s(%d). Received unexpected number of bytes. %d != %d"
,
__FUNCTION__
,
__LINE__
,
recvfrom_result
,
header
.
message_length
);
break
;
}
pnf_handle_p7_message
(
pnf_p7
->
rx_message_buffer
,
recvfrom_result
,
pnf_p7
,
now_hr_time
);
//printf("\npnf_handle_p7_message sfn=%d,slot=%d\n",pnf_p7->sfn,pnf_p7->slot);
}
...
...
nfapi/open-nFAPI/vnf/src/vnf_p7.c
View file @
64fd6112
...
...
@@ -2452,9 +2452,9 @@ int vnf_p7_read_dispatch_message(vnf_p7_t* vnf_p7)
{
NFAPI_TRACE
(
NFAPI_TRACE_ERROR
,
"recvfrom returned 0
\n
"
);
}
else
if
(
recvfrom_result
!=
header
.
message_length
)
else
if
(
recvfrom_result
!=
-
1
&&
recvfrom_result
!=
header
.
message_length
)
{
NFAPI_TRACE
(
NFAPI_TRACE_
NOTE
,
"did not receive the entire message %d %d
\n
"
,
recvfrom_result
,
header
.
message_length
);
NFAPI_TRACE
(
NFAPI_TRACE_
ERROR
,
"Received unexpected number of bytes %d %d
\n
"
,
recvfrom_result
,
header
.
message_length
);
recvfrom_result
+=
recvfrom
(
vnf_p7
->
socket
,
&
vnf_p7
->
rx_message_buffer
[
recvfrom_result
],
header
.
message_length
-
recvfrom_result
,
MSG_WAITALL
,
(
struct
sockaddr
*
)
&
remote_addr
,
&
remote_addr_size
);
...
...
openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
View file @
64fd6112
...
...
@@ -644,9 +644,20 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP)
//TTN for D2D (PC5S)
// receive a message from ProSe App
memset
(
receive_buf
,
0
,
BUFSIZE
);
bytes_received
=
recvfrom
(
pdcp_pc5_sockfd
,
receive_buf
,
BUFSIZE
,
0
,
bytes_received
=
recvfrom
(
pdcp_pc5_sockfd
,
receive_buf
,
BUFSIZE
,
MSG_TRUNC
,
(
struct
sockaddr
*
)
&
prose_pdcp_addr
,
(
socklen_t
*
)
&
prose_addr_len
);
if
(
bytes_received
==
-
1
){
LOG_E
(
PDCP
,
"%s(%d). recvfrom failed. %s
\n
"
,
__FUNCTION__
,
__LINE__
,
strerror
(
errno
));
return
;
}
if
(
bytes_received
==
0
){
LOG_E
(
PDCP
,
"%s(%d). EOF pdcp_pc5_sockfd.
\n
"
,
__FUNCTION__
,
__LINE__
);
}
if
(
bytes_received
>
BUFSIZE
)
{
LOG_E
(
PDCP
,
"%s(%d). Message truncated. %d
\n
"
,
__FUNCTION__
,
__LINE__
,
bytes_received
);
return
;
}
if
(
bytes_received
>
0
)
{
pc5s_header
=
calloc
(
1
,
sizeof
(
pc5s_header_t
));
memcpy
((
void
*
)
pc5s_header
,
(
void
*
)
receive_buf
,
sizeof
(
pc5s_header_t
));
...
...
openair2/PHY_INTERFACE/phy_stub_UE.c
View file @
64fd6112
...
...
@@ -1235,8 +1235,7 @@ void *ue_standalone_pnf_task(void *context)
{
struct
sockaddr_in
server_address
;
socklen_t
addr_len
=
sizeof
(
server_address
);
char
buffer
[
1024
];
char
buffer
[
NFAPI_MAX_PACKED_MESSAGE_SIZE
];
int
sd
=
ue_rx_sock_descriptor
;
assert
(
sd
>
0
);
...
...
@@ -1246,7 +1245,7 @@ void *ue_standalone_pnf_task(void *context)
bool
dl_config_req_valid
=
false
;
while
(
true
)
{
ssize_t
len
=
recvfrom
(
sd
,
buffer
,
sizeof
(
buffer
),
0
,
(
struct
sockaddr
*
)
&
server_address
,
&
addr_len
);
ssize_t
len
=
recvfrom
(
sd
,
buffer
,
sizeof
(
buffer
),
MSG_TRUNC
,
(
struct
sockaddr
*
)
&
server_address
,
&
addr_len
);
if
(
len
==
-
1
)
{
LOG_E
(
MAC
,
"reading from standalone pnf sctp socket failed
\n
"
);
...
...
@@ -1256,6 +1255,12 @@ void *ue_standalone_pnf_task(void *context)
the length of the message. This works because sizeof(uint16_t) < sizeof(nfapi_p7_message_header_t)
and sizeof(phy_channel_params_t) < sizeof(nfapi_p7_message_header_t) and
sizeof(uint16_t) != sizeof(phy_channel_params_t). */
if
(
len
>
sizeof
(
buffer
))
{
LOG_E
(
MAC
,
"%s(%d). Message truncated. %zd
\n
"
,
__FUNCTION__
,
__LINE__
,
len
);
continue
;
}
if
(
len
==
sizeof
(
uint16_t
))
{
uint16_t
sfn_sf
=
0
;
...
...
@@ -1568,7 +1573,7 @@ static void print_rx_ind(nfapi_rx_indication_t *p)
void
send_standalone_msg
(
UL_IND_t
*
UL
,
nfapi_message_id_e
msg_type
)
{
int
encoded_size
=
-
1
;
char
buffer
[
1024
];
char
buffer
[
NFAPI_MAX_PACKED_MESSAGE_SIZE
];
switch
(
msg_type
)
{
...
...
openair2/RRC/LTE/rrc_UE.c
View file @
64fd6112
...
...
@@ -5241,13 +5241,20 @@ void *rrc_control_socket_thread_fct(void *arg) {
LOG_I
(
RRC
,
"Listening to incoming connection from ProSe App
\n
"
);
// receive a message from ProSe App
memset
(
receive_buf
,
0
,
BUFSIZE
);
n
=
recvfrom
(
ctrl_sock_fd
,
receive_buf
,
BUFSIZE
,
0
,
n
=
recvfrom
(
ctrl_sock_fd
,
receive_buf
,
BUFSIZE
,
MSG_TRUNC
,
(
struct
sockaddr
*
)
&
prose_app_addr
,
(
socklen_t
*
)
&
prose_addr_len
);
if
(
n
<
0
)
{
LOG_E
(
RRC
,
"ERROR: Failed to receive from ProSe App
\n
"
);
exit
(
EXIT_FAILURE
);
}
if
(
n
==
0
)
{
LOG_E
(
RRC
,
"%s(%d). EOF for ctrl_sock_fd
\n
"
,
__FUNCTION__
,
__LINE__
);
}
if
(
n
>
BUFSIZE
)
{
LOG_E
(
RRC
,
"%s(%d). Message truncated. %d
\n
"
,
__FUNCTION__
,
__LINE__
,
n
);
exit
(
EXIT_FAILURE
);
}
//TODO: should store the address of ProSeApp [UE_rrc_inst] to be able to send UE state notification to the App
//sl_ctrl_msg_recv = (struct sidelink_ctrl_element *) receive_buf;
...
...
openair2/UTIL/ASYNC_IF/socket_link.c
View file @
64fd6112
...
...
@@ -409,10 +409,14 @@ static int socket_udp_receive(int socket_fd, void *buf, int size)
socklen_t
slen
=
sizeof
(
client
);
int
l
;
l
=
recvfrom
(
socket_fd
,
buf
,
size
,
0
,
(
struct
sockaddr
*
)
&
client
,
&
slen
);
l
=
recvfrom
(
socket_fd
,
buf
,
size
,
MSG_TRUNC
,
(
struct
sockaddr
*
)
&
client
,
&
slen
);
//getsockname(socket_fd, (struct sockaddr *)&client, &slen);
if
(
l
==
-
1
)
goto
error
;
if
(
l
==
0
)
goto
socket_closed
;
if
(
l
>
size
)
{
LOG_E
(
MAC
,
"%s(%d). Message truncated. %d
\n
"
,
__FUNCTION__
,
__LINE__
,
l
);
return
-
1
;
}
return
l
;
...
...
openair3/GTPV1-U/gtpv1u_eNB.c
View file @
64fd6112
...
...
@@ -221,7 +221,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req(
* - END-MARKER
*/
case
NW_GTPV1U_ULP_API_RECV_TPDU
:
{
uint8_t
buffer
[
4096
];
uint8_t
buffer
[
NFAPI_MAX_PACKED_MESSAGE_SIZE
];
uint32_t
buffer_len
;
struct
rrc_eNB_ue_context_s
*
ue_context_p
;
uint16_t
msgType
=
NW_GTP_GPDU
;
...
...
openair3/GTPV1-U/gtpv1u_eNB_defs.h
View file @
64fd6112
...
...
@@ -29,6 +29,7 @@
#include "hashtable.h"
#include "LTE_asn_constant.h"
#include "nfapi_interface.h"
#ifndef GTPV1U_ENB_DEFS_H_
#define GTPV1U_ENB_DEFS_H_
...
...
openair3/UDP/udp_eNB_task.c
View file @
64fd6112
...
...
@@ -235,7 +235,7 @@ udp_eNB_send_to(
void
udp_eNB_receiver
(
struct
udp_socket_desc_s
*
udp_sock_pP
)
{
uint8_t
l_buffer
[
2048
];
uint8_t
l_buffer
[
NFAPI_MAX_PACKED_MESSAGE_SIZE
];
int
n
;
socklen_t
from_len
;
struct
sockaddr_in
addr
;
...
...
@@ -246,10 +246,13 @@ void udp_eNB_receiver(struct udp_socket_desc_s *udp_sock_pP)
if
(
1
)
{
from_len
=
(
socklen_t
)
sizeof
(
struct
sockaddr_in
);
if
((
n
=
recvfrom
(
udp_sock_pP
->
sd
,
l_buffer
,
sizeof
(
l_buffer
),
0
,
if
((
n
=
recvfrom
(
udp_sock_pP
->
sd
,
l_buffer
,
sizeof
(
l_buffer
),
MSG_TRUNC
,
(
struct
sockaddr
*
)
&
addr
,
&
from_len
))
<
0
)
{
LOG_E
(
UDP_
,
"Recvfrom failed %s
\n
"
,
strerror
(
errno
));
return
;
}
else
if
(
n
>
sizeof
(
l_buffer
))
{
LOG_E
(
UDP_
,
"%s(%d). Message truncated. %d
\n
"
,
__FUNCTION__
,
__LINE__
,
n
);
return
;
}
else
if
(
n
==
0
)
{
LOG_W
(
UDP_
,
"Recvfrom returned 0
\n
"
);
return
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment