print-ntp.c: Add and use VERSIONSHIFT

Add shift constant VERSIONSHIFT(3), and use it in ntp_print().
This commit is contained in:
Ulrich Windl 2017-08-23 14:42:57 +02:00 committed by Denis Ovsienko
parent 8cdb42601b
commit b1ee9bac52

View File

@ -141,6 +141,7 @@ struct ntpdata {
*/
#define NTPVERSION_1 0x08
#define VERSIONMASK 0x38
#define VERSIONSHIFT 3
#define LEAPMASK 0xc0
#ifdef MODEMASK
#undef MODEMASK /* Solaris sucks */
@ -212,7 +213,7 @@ ntp_print(netdissect_options *ndo,
ND_TCHECK(bp->status);
version = (int)(bp->status & VERSIONMASK) >> 3;
version = (int)(bp->status & VERSIONMASK) >> VERSIONSHIFT;
ND_PRINT((ndo, "NTPv%d", version));
mode = bp->status & MODEMASK;