On Saturday 16 June 2007 18:31:00 Denis Vlasenko wrote:
> On 6/16/07, Tito <[EMAIL PROTECTED]> wrote:
> > On Saturday 16 June 2007 15:39:58 Denis Vlasenko wrote:
> > > On Friday 15 June 2007 23:16, Tito wrote:
> > > > Looks good to me, added some of the TODOs and changed all the time to
> > > > msec.
> > > > Please check if i fully understood your code. Sorry no time for a patch
> > > > right now,
> > > > sending the file I've changed. If needed patch will follow tomorrow. ;-)
> > >
> > > Applied to svn. Thanks.
> >
> > Hi, Denis,
> > you should also add pscan.c to svn.
>
> Why I'm not surprised. I forgot svn add, again... :(
> Will do later today when I'll get back home.
>
> Sorry.
> --
> vda
>
Hi,
little patch for saving a few bytes and improve some comments:
[EMAIL PROTECTED]:~/Desktop/busybox# scripts/bloat-o-meter busybox_old
busybox_unstripped
function old new delta
pscan_main 589 580 -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-9) Total: -9 bytes
Ciao,
Tito
--- busybox.orig/networking/pscan.c 2007-06-17 21:28:43.000000000 +0200
+++ busybox/networking/pscan.c 2007-06-17 23:55:26.000000000 +0200
@@ -35,13 +35,13 @@
{
const char *opt_max_port = "1024"; /* -P: default max port */
const char *opt_min_port = "1"; /* -p: default min port */
- const char *opt_timeout = "5000"; /* -t: default timeout */
+ const char *opt_timeout = "5000"; /* -t: default timeout in msec
*/
/* We estimate rtt and wait rtt*4 before concluding that port is
* totally blocked. min rtt of 5 ms may be too low if you are
* scanning an Internet host behind saturated/traffic shaped link.
* Rule of thumb: with min_rtt of N msec, scanning 1000 ports
* will take N seconds at absolute minimum */
- const char *opt_min_rtt = "5"; /* -T: default min rtt */
+ const char *opt_min_rtt = "5"; /* -T: default min rtt in msec
*/
len_and_sockaddr *lsap;
int s;
unsigned port, max_port, nports;
@@ -57,10 +57,8 @@
getopt32(argc, argv, "p:P:t:T:", &opt_min_port, &opt_max_port,
&opt_timeout, &opt_min_rtt);
argv += optind;
max_port = xatou_range(opt_max_port, 1, 65535);
- port = xatou_range(opt_min_port, 1, 65535);
+ port = xatou_range(opt_min_port, 1, max_port);
nports = max_port - port + 1;
- if ((int)nports <= 0)
- bb_show_usage();
rtt_4 = timeout = xatou_range(opt_timeout, 1, INT_MAX/1000 / 4) * 1000;
min_rtt = xatou_range(opt_min_rtt, 1, INT_MAX/1000 / 4) * 1000;
--- busybox.orig/networking/pscan.c 2007-06-17 21:28:43.000000000 +0200
+++ busybox/networking/pscan.c 2007-06-17 23:55:26.000000000 +0200
@@ -35,13 +35,13 @@
{
const char *opt_max_port = "1024"; /* -P: default max port */
const char *opt_min_port = "1"; /* -p: default min port */
- const char *opt_timeout = "5000"; /* -t: default timeout */
+ const char *opt_timeout = "5000"; /* -t: default timeout in msec */
/* We estimate rtt and wait rtt*4 before concluding that port is
* totally blocked. min rtt of 5 ms may be too low if you are
* scanning an Internet host behind saturated/traffic shaped link.
* Rule of thumb: with min_rtt of N msec, scanning 1000 ports
* will take N seconds at absolute minimum */
- const char *opt_min_rtt = "5"; /* -T: default min rtt */
+ const char *opt_min_rtt = "5"; /* -T: default min rtt in msec */
len_and_sockaddr *lsap;
int s;
unsigned port, max_port, nports;
@@ -57,10 +57,8 @@
getopt32(argc, argv, "p:P:t:T:", &opt_min_port, &opt_max_port, &opt_timeout, &opt_min_rtt);
argv += optind;
max_port = xatou_range(opt_max_port, 1, 65535);
- port = xatou_range(opt_min_port, 1, 65535);
+ port = xatou_range(opt_min_port, 1, max_port);
nports = max_port - port + 1;
- if ((int)nports <= 0)
- bb_show_usage();
rtt_4 = timeout = xatou_range(opt_timeout, 1, INT_MAX/1000 / 4) * 1000;
min_rtt = xatou_range(opt_min_rtt, 1, INT_MAX/1000 / 4) * 1000;
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox