Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
tsn-measures
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
nexedi
tsn-measures
Commits
d067cff7
Commit
d067cff7
authored
Jun 24, 2020
by
Joanne Hugé
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix segmentation fault caused by incorrectly accessing the cyclic timestamp buffer
parent
53fd7c47
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
packet-exchange/src/send_packet.c
packet-exchange/src/send_packet.c
+5
-3
No files found.
packet-exchange/src/send_packet.c
View file @
d067cff7
...
@@ -37,6 +37,8 @@
...
@@ -37,6 +37,8 @@
#include "common.h"
#include "common.h"
#include "send_packet.h"
#include "send_packet.h"
#define TIMESTAMP_BUFFER_SIZE 64
static
void
*
poll_thread
(
void
*
p
);
static
void
*
poll_thread
(
void
*
p
);
static
void
process_error_queue
();
static
void
process_error_queue
();
...
@@ -56,7 +58,7 @@ static struct sock_txtime sk_txtime;
...
@@ -56,7 +58,7 @@ static struct sock_txtime sk_txtime;
static
char
*
tx_buffer
;
static
char
*
tx_buffer
;
static
int
sock_fd
;
static
int
sock_fd
;
static
uint64_t
timestamps_buffer
[
64
];
static
uint64_t
timestamps_buffer
[
TIMESTAMP_BUFFER_SIZE
];
static
int
ts_buf_read_index
=
0
;
static
int
ts_buf_read_index
=
0
;
static
int
ts_buf_write_index
=
0
;
static
int
ts_buf_write_index
=
0
;
...
@@ -129,7 +131,7 @@ void send_udp_packet(char *data,
...
@@ -129,7 +131,7 @@ void send_udp_packet(char *data,
if
(
params
->
use_timestamps
)
{
if
(
params
->
use_timestamps
)
{
clock_gettime
(
CLOCK_REALTIME
,
&
ts
);
clock_gettime
(
CLOCK_REALTIME
,
&
ts
);
timestamps_buffer
[
ts_buf_write_index
++
]
=
ts_to_uint
(
ts
);
timestamps_buffer
[
(
ts_buf_write_index
++
)
%
TIMESTAMP_BUFFER_SIZE
]
=
ts_to_uint
(
ts
);
}
}
packets_sent
++
;
packets_sent
++
;
...
@@ -220,7 +222,7 @@ static void process_error_queue() {
...
@@ -220,7 +222,7 @@ static void process_error_queue() {
struct
timespec
*
stamp
=
(
struct
timespec
*
)
CMSG_DATA
(
cmsg
);
struct
timespec
*
stamp
=
(
struct
timespec
*
)
CMSG_DATA
(
cmsg
);
int
kernel_latency
=
(
ts_to_uint
(
*
stamp
)
-
timestamps_buffer
[
ts_buf_read_index
++
])
/
1000
;
int
kernel_latency
=
(
ts_to_uint
(
*
stamp
)
-
timestamps_buffer
[
(
ts_buf_read_index
++
)
%
TIMESTAMP_BUFFER_SIZE
])
/
1000
;
stats
->
min_kernel_latency
=
min
(
kernel_latency
,
stats
->
min_kernel_latency
);
stats
->
min_kernel_latency
=
min
(
kernel_latency
,
stats
->
min_kernel_latency
);
stats
->
max_kernel_latency
=
max
(
kernel_latency
,
stats
->
max_kernel_latency
);
stats
->
max_kernel_latency
=
max
(
kernel_latency
,
stats
->
max_kernel_latency
);
...
...
Joanne Hugé
@jhuge
mentioned in commit
2aa17b73
·
Jul 31, 2020
mentioned in commit
2aa17b73
mentioned in commit 2aa17b73fd8c7c5a0c0e35ba717a55e84582700d
Toggle commit list
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