Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
PPSi
Commits
fc87c522
Commit
fc87c522
authored
Mar 13, 2023
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dump-funcs.c: check truncated packets, get length from header
parent
4e0def72
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
dump-funcs.c
tools/dump-funcs.c
+11
-6
No files found.
tools/dump-funcs.c
View file @
fc87c522
...
...
@@ -327,22 +327,27 @@ static void dump_tlv(const char *prefix, const unsigned char *tlv, int totallen)
}
/* A big function to dump the ptp information */
static
void
dump_payload
(
c
har
*
prefix
,
void
*
pl
,
int
len
)
static
void
dump_payload
(
c
onst
char
*
prefix
,
const
void
*
pl
,
unsigned
p
len
)
{
struct
ptp_header
*
h
=
pl
;
void
*
msg_specific
=
(
void
*
)(
h
+
1
);
const
struct
ptp_header
*
h
=
pl
;
const
void
*
msg_specific
=
(
const
void
*
)(
h
+
1
);
int
donelen
=
34
;
/* packet length before tlv */
int
version
=
h
->
versionPTP_and_reserved
&
0xf
;
int
messageType
=
h
->
type_and_transport_specific
&
0xf
;
char
*
cfptr
=
(
void
*
)
&
h
->
correctionField
;
const
char
*
cfptr
=
(
void
*
)
&
h
->
correctionField
;
unsigned
len
=
plen
;
if
(
plen
<
sizeof
(
*
h
))
{
printf
(
"%struncated (len = %i)
\n
"
,
prefix
,
plen
);
goto
out
;
}
if
(
version
!=
2
)
{
printf
(
"%sVERSION: unsupported (%i)
\n
"
,
prefix
,
version
);
goto
out
;
}
len
=
ntohs
(
h
->
messageLength
);
printf
(
"%sVERSION: %i (type %i, len %i, domain %i)
\n
"
,
prefix
,
version
,
messageType
,
ntohs
(
h
->
messageLength
),
h
->
domainNumber
);
version
,
messageType
,
len
,
h
->
domainNumber
);
printf
(
"%sFLAGS: 0x%02x%02x (correction 0x%08x:%08x %08u)
\n
"
,
prefix
,
(
unsigned
)
h
->
flagField
[
0
],(
unsigned
)
h
->
flagField
[
1
],
(
int
)
ntohl
(
*
(
int
*
)
cfptr
),
...
...
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