aboutsummaryrefslogtreecommitdiff
path: root/networking/pscan.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-06-19 16:57:47 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-06-19 16:57:47 +0000
commitdcf6de552a15c1e7bddb32f1028ceb6214915425 (patch)
tree01099725f37568f9f6a8b846cd2cba17c98cbd88 /networking/pscan.c
parent5b5bcf24f5293f7f3db0aca9af98777a5aff6be2 (diff)
downloadbusybox-w32-dcf6de552a15c1e7bddb32f1028ceb6214915425.tar.gz
busybox-w32-dcf6de552a15c1e7bddb32f1028ceb6214915425.tar.bz2
busybox-w32-dcf6de552a15c1e7bddb32f1028ceb6214915425.zip
pscan: size optimization (Tito <farmatito@tiscali.it>)
Diffstat (limited to 'networking/pscan.c')
-rw-r--r--networking/pscan.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/networking/pscan.c b/networking/pscan.c
index 9fa6993e8..fe146b8bd 100644
--- a/networking/pscan.c
+++ b/networking/pscan.c
@@ -35,13 +35,13 @@ int pscan_main(int argc, char **argv)
35{ 35{
36 const char *opt_max_port = "1024"; /* -P: default max port */ 36 const char *opt_max_port = "1024"; /* -P: default max port */
37 const char *opt_min_port = "1"; /* -p: default min port */ 37 const char *opt_min_port = "1"; /* -p: default min port */
38 const char *opt_timeout = "5000"; /* -t: default timeout */ 38 const char *opt_timeout = "5000"; /* -t: default timeout in msec */
39 /* We estimate rtt and wait rtt*4 before concluding that port is 39 /* We estimate rtt and wait rtt*4 before concluding that port is
40 * totally blocked. min rtt of 5 ms may be too low if you are 40 * totally blocked. min rtt of 5 ms may be too low if you are
41 * scanning an Internet host behind saturated/traffic shaped link. 41 * scanning an Internet host behind saturated/traffic shaped link.
42 * Rule of thumb: with min_rtt of N msec, scanning 1000 ports 42 * Rule of thumb: with min_rtt of N msec, scanning 1000 ports
43 * will take N seconds at absolute minimum */ 43 * will take N seconds at absolute minimum */
44 const char *opt_min_rtt = "5"; /* -T: default min rtt */ 44 const char *opt_min_rtt = "5"; /* -T: default min rtt in msec */
45 len_and_sockaddr *lsap; 45 len_and_sockaddr *lsap;
46 int s; 46 int s;
47 unsigned port, max_port, nports; 47 unsigned port, max_port, nports;
@@ -57,10 +57,8 @@ int pscan_main(int argc, char **argv)
57 getopt32(argc, argv, "p:P:t:T:", &opt_min_port, &opt_max_port, &opt_timeout, &opt_min_rtt); 57 getopt32(argc, argv, "p:P:t:T:", &opt_min_port, &opt_max_port, &opt_timeout, &opt_min_rtt);
58 argv += optind; 58 argv += optind;
59 max_port = xatou_range(opt_max_port, 1, 65535); 59 max_port = xatou_range(opt_max_port, 1, 65535);
60 port = xatou_range(opt_min_port, 1, 65535); 60 port = xatou_range(opt_min_port, 1, max_port);
61 nports = max_port - port + 1; 61 nports = max_port - port + 1;
62 if ((int)nports <= 0)
63 bb_show_usage();
64 rtt_4 = timeout = xatou_range(opt_timeout, 1, INT_MAX/1000 / 4) * 1000; 62 rtt_4 = timeout = xatou_range(opt_timeout, 1, INT_MAX/1000 / 4) * 1000;
65 min_rtt = xatou_range(opt_min_rtt, 1, INT_MAX/1000 / 4) * 1000; 63 min_rtt = xatou_range(opt_min_rtt, 1, INT_MAX/1000 / 4) * 1000;
66 64