Commit 8fdcb992 authored by Alessandro Rubini's avatar Alessandro Rubini

ptpdump: don't wrongly report a trailing short TLV

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 5c918341
......@@ -234,8 +234,11 @@ static void dump_payload(char *prefix, void *pl, int len)
#endif
}
/* Dump any trailing TLV */
while (donelen < len) {
/*
* Dump any trailing TLV, but ignore a trailing 2-long data hunk.
* The trailing zeroes appear with less-than-minimum Eth messages.
*/
while (donelen < len && len - donelen > 2) {
int n = len - donelen;
if (n < sizeof(struct ptp_tlv)) {
printf("%sTLV: too short (%i - %i = %i)\n", prefix,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment