+ ND_PRINT("\n\t Reference Timestamp: ");
+ p_ntp_time(ndo, &(bp->ref_timestamp));
+
+ ND_PRINT("\n\t Originator Timestamp: ");
+ p_ntp_time(ndo, &(bp->org_timestamp));
+
+ ND_PRINT("\n\t Receive Timestamp: ");
+ p_ntp_time(ndo, &(bp->rec_timestamp));
+
+ ND_PRINT("\n\t Transmit Timestamp: ");
+ p_ntp_time(ndo, &(bp->xmt_timestamp));
+
+ ND_PRINT("\n\t Originator - Receive Timestamp: ");
+ p_ntp_delta(ndo, &(bp->org_timestamp), &(bp->rec_timestamp));
+
+ ND_PRINT("\n\t Originator - Transmit Timestamp: ");
+ p_ntp_delta(ndo, &(bp->org_timestamp), &(bp->xmt_timestamp));
+
+ /* FIXME: this code is not aware of any extension fields */
+ if (length == NTP_TIMEMSG_MINLEN + 4) { /* Optional: key-id (crypto-NAK) */
+ ND_PRINT("\n\tKey id: %u", GET_BE_U_4(bp->key_id));
+ } else if (length == NTP_TIMEMSG_MINLEN + 4 + 16) { /* Optional: key-id + 128-bit digest */
+ ND_PRINT("\n\tKey id: %u", GET_BE_U_4(bp->key_id));
+ ND_PRINT("\n\tAuthentication: %08x%08x%08x%08x",
+ GET_BE_U_4(bp->message_digest),
+ GET_BE_U_4(bp->message_digest + 4),
+ GET_BE_U_4(bp->message_digest + 8),
+ GET_BE_U_4(bp->message_digest + 12));
+ } else if (length == NTP_TIMEMSG_MINLEN + 4 + 20) { /* Optional: key-id + 160-bit digest */
+ ND_PRINT("\n\tKey id: %u", GET_BE_U_4(bp->key_id));
+ ND_PRINT("\n\tAuthentication: %08x%08x%08x%08x%08x",
+ GET_BE_U_4(bp->message_digest),
+ GET_BE_U_4(bp->message_digest + 4),
+ GET_BE_U_4(bp->message_digest + 8),
+ GET_BE_U_4(bp->message_digest + 12),
+ GET_BE_U_4(bp->message_digest + 16));
+ } else if (length > NTP_TIMEMSG_MINLEN) {
+ ND_PRINT("\n\t(%u more bytes after the header)", length - NTP_TIMEMSG_MINLEN);
+ }
+ return;
+
+invalid:
+ nd_print_invalid(ndo);
+ ND_TCHECK_LEN(bp, length);
+}
+
+/*
+ * Print NTP control message requests and responses
+ */
+static void
+ntp_control_print(netdissect_options *ndo,
+ const struct ntp_control_data *cd, u_int length)
+{
+ uint8_t control, R, E, M, opcode;
+ uint16_t sequence, status, assoc, offset, count;
+
+ if (length < NTP_CTRLMSG_MINLEN)
+ goto invalid;
+
+ control = GET_U_1(cd->control);
+ R = (control & 0x80) != 0;
+ E = (control & 0x40) != 0;
+ M = (control & 0x20) != 0;
+ opcode = control & 0x1f;
+ ND_PRINT(", %s, %s, %s, OpCode=%u\n",
+ R ? "Response" : "Request", E ? "Error" : "OK",
+ M ? "More" : "Last", opcode);
+
+ sequence = GET_BE_U_2(cd->sequence);
+ ND_PRINT("\tSequence=%hu", sequence);
+
+ status = GET_BE_U_2(cd->status);
+ ND_PRINT(", Status=%#hx", status);