aboutsummaryrefslogtreecommitdiff
path: root/networking/pscan.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2012-03-22 14:11:12 +0000
committerRon Yorston <rmy@pobox.com>2012-03-22 14:11:12 +0000
commit67758035a4fe040c6ac69b39d61bcd6bddd7b827 (patch)
treea4a1db7f54c16d12fabe2626b8f1e235cd694e9e /networking/pscan.c
parent811c449748d5bd0505f8510e5582892f94ac0cda (diff)
parentb83c9704128dd106071184e4b00335a3b8486857 (diff)
downloadbusybox-w32-67758035a4fe040c6ac69b39d61bcd6bddd7b827.tar.gz
busybox-w32-67758035a4fe040c6ac69b39d61bcd6bddd7b827.tar.bz2
busybox-w32-67758035a4fe040c6ac69b39d61bcd6bddd7b827.zip
Merge commit 'b83c9704128dd106071184e4b00335a3b8486857' into merge
Diffstat (limited to 'networking/pscan.c')
-rw-r--r--networking/pscan.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/networking/pscan.c b/networking/pscan.c
index a8194d1a8..5595148fc 100644
--- a/networking/pscan.c
+++ b/networking/pscan.c
@@ -6,6 +6,18 @@
6 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8 8
9//usage:#define pscan_trivial_usage
10//usage: "[-cb] [-p MIN_PORT] [-P MAX_PORT] [-t TIMEOUT] [-T MIN_RTT] HOST"
11//usage:#define pscan_full_usage "\n\n"
12//usage: "Scan a host, print all open ports\n"
13//usage: "\nOptions:"
14//usage: "\n -c Show closed ports too"
15//usage: "\n -b Show blocked ports too"
16//usage: "\n -p Scan from this port (default 1)"
17//usage: "\n -P Scan up to this port (default 1024)"
18//usage: "\n -t Timeout (default 5000 ms)"
19//usage: "\n -T Minimum rtt (default 5 ms, increase for congested hosts)"
20
9#include "libbb.h" 21#include "libbb.h"
10 22
11/* debugging */ 23/* debugging */
@@ -76,7 +88,7 @@ int pscan_main(int argc UNUSED_PARAM, char **argv)
76 DMSG("rtt %u", rtt_4); 88 DMSG("rtt %u", rtt_4);
77 89
78 /* The SOCK_STREAM socket type is implemented on the TCP/IP protocol. */ 90 /* The SOCK_STREAM socket type is implemented on the TCP/IP protocol. */
79 set_nport(lsap, htons(port)); 91 set_nport(&lsap->u.sa, htons(port));
80 s = xsocket(lsap->u.sa.sa_family, SOCK_STREAM, 0); 92 s = xsocket(lsap->u.sa.sa_family, SOCK_STREAM, 0);
81 /* We need unblocking socket so we don't need to wait for ETIMEOUT. */ 93 /* We need unblocking socket so we don't need to wait for ETIMEOUT. */
82 /* Nonblocking connect typically "fails" with errno == EINPROGRESS */ 94 /* Nonblocking connect typically "fails" with errno == EINPROGRESS */