break;
case 'P':
remoteport = strtoint_or_err(optarg, "invalid argument");
- if (remoteport > 65535 || remoteport < 1) {
+ if (remoteport < 1 || MaxPort < remoteport) {
error(EXIT_FAILURE, 0, "Illegal port number: %d", remoteport);
}
break;
case 'L':
localport = strtoint_or_err(optarg, "invalid argument");
- if (localport > 65535 || localport < MinPort) {
+ if (localport < MinPort || MaxPort < localport) {
error(EXIT_FAILURE, 0, "Illegal port number: %d", localport);
}
break;
#define MinSequence 33000
#define MaxSequence 65536
#define MinPort 1024
+#define MaxPort 65535
#define MAXPACKET 4470 /* largest test packet size */
#define MINPACKET 28 /* 20 bytes IP header and 8 bytes ICMP or UDP */