]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Check against various modes explicitly.
authorGuy Harris <[email protected]>
Sun, 14 Jan 2018 22:20:30 +0000 (14:20 -0800)
committerGuy Harris <[email protected]>
Sun, 14 Jan 2018 22:20:30 +0000 (14:20 -0800)
This avoids a "comparison is always true" warning when checking whether
mode is >= MODE_UNSPEC.

print-ntp.c

index 99cf72b253df664f914fcb31bcc14e7749901b17..b4fa61297301e7bb8ea7549bfd223b19196d2ba2 100644 (file)
@@ -479,12 +479,24 @@ ntp_print(netdissect_options *ndo,
                  tok2str(ntp_leapind_values, "Unknown", leapind),
                  leapind);
 
-       if (mode >= MODE_UNSPEC && mode <= MODE_BROADCAST)
+       switch (mode) {
+
+       case MODE_UNSPEC:
+       case MODE_SYM_ACT:
+       case MODE_SYM_PAS:
+       case MODE_CLIENT:
+       case MODE_SERVER:
+       case MODE_BROADCAST:
                ntp_time_print(ndo, &bp->td, length);
-       else if (mode == MODE_CONTROL)
+               break;
+
+       case MODE_CONTROL:
                ntp_control_print(ndo, &bp->cd, length);
-       else
-               {;}                     /* XXX: not implemented! */
+               break;
+
+       default:
+               break;                  /* XXX: not implemented! */
+       }
        return;
 
 trunc: