]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Fix printing of NTP key-id.
authorMiroslav Lichvar <[email protected]>
Mon, 19 Jun 2017 14:50:53 +0000 (16:50 +0200)
committerMiroslav Lichvar <[email protected]>
Tue, 29 Aug 2017 10:42:10 +0000 (12:42 +0200)
The key-id in an NTP MAC is in big-endian format.

print-ntp.c

index 63e69d5c2cfcae5b5d8b63595d903ab23df46520..9952a0202b57ddf6ec5b82dbde993036e7d60ff3 100644 (file)
@@ -309,10 +309,10 @@ ntp_print(netdissect_options *ndo,
 
        if ( (sizeof(struct ntpdata) - length) == 16) {         /* Optional: key-id */
                ND_TCHECK(bp->key_id);
-               ND_PRINT((ndo, "\n\tKey id: %u", bp->key_id));
+               ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_32BITS(&bp->key_id)));
        } else if ( (sizeof(struct ntpdata) - length) == 0) {   /* Optional: key-id + authentication */
                ND_TCHECK(bp->key_id);
-               ND_PRINT((ndo, "\n\tKey id: %u", bp->key_id));
+               ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_32BITS(&bp->key_id)));
                ND_TCHECK2(bp->message_digest, sizeof (bp->message_digest));
                 ND_PRINT((ndo, "\n\tAuthentication: %08x%08x%08x%08x",
                               EXTRACT_32BITS(bp->message_digest),