1. "TSDU Length" comes in network byte order on wire, add missing macro.
2. The (unused) justification of the number of bytes on wire wasn't
correct because one side of the comparison included header size and
another didn't (note the byte order as well). Besides that, the value of
TSDU Length was already output thus far. Don't justify the number of
bytes on wire and change the final printf() to make a use of it.
TCHECK(*pgm);
- (void)printf("PGM, length %u", pgm->pgm_length);
+ (void)printf("PGM, length %u", EXTRACT_16BITS(&pgm->pgm_length));
if (!vflag)
return;
- if (length > pgm->pgm_length)
- length = pgm->pgm_length;
-
(void)printf(" 0x%02x%02x%02x%02x%02x%02x ",
pgm->pgm_gsid[0],
pgm->pgm_gsid[1],
}
}
- (void)printf(" [%u]", EXTRACT_16BITS(&pgm->pgm_length));
+ (void)printf(" [%u]", length);
return;