summaryrefslogtreecommitdiff
path: root/ssh-keyscan.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-keyscan.c')
-rw-r--r--ssh-keyscan.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index 9a91be499..f30e85045 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keyscan.c,v 1.78 2009/01/22 10:02:34 djm Exp $ */ 1/* $OpenBSD: ssh-keyscan.c,v 1.79 2009/10/28 16:38:18 reyk Exp $ */
2/* 2/*
3 * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. 3 * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
4 * 4 *
@@ -68,6 +68,9 @@ int timeout = 5;
68int maxfd; 68int maxfd;
69#define MAXCON (maxfd - 10) 69#define MAXCON (maxfd - 10)
70 70
71/* The default routing domain */
72int scan_rdomain = -1;
73
71extern char *__progname; 74extern char *__progname;
72fd_set *read_wait; 75fd_set *read_wait;
73size_t read_wait_nfdset; 76size_t read_wait_nfdset;
@@ -412,7 +415,8 @@ tcpconnect(char *host)
412 if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) 415 if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0)
413 fatal("getaddrinfo %s: %s", host, ssh_gai_strerror(gaierr)); 416 fatal("getaddrinfo %s: %s", host, ssh_gai_strerror(gaierr));
414 for (ai = aitop; ai; ai = ai->ai_next) { 417 for (ai = aitop; ai; ai = ai->ai_next) {
415 s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); 418 s = socket_rdomain(ai->ai_family, ai->ai_socktype,
419 ai->ai_protocol, scan_rdomain);
416 if (s < 0) { 420 if (s < 0) {
417 error("socket: %s", strerror(errno)); 421 error("socket: %s", strerror(errno));
418 continue; 422 continue;
@@ -715,7 +719,7 @@ usage(void)
715{ 719{
716 fprintf(stderr, 720 fprintf(stderr,
717 "usage: %s [-46Hv] [-f file] [-p port] [-T timeout] [-t type]\n" 721 "usage: %s [-46Hv] [-f file] [-p port] [-T timeout] [-t type]\n"
718 "\t\t [host | addrlist namelist] ...\n", 722 "\t\t [-V rdomain] [host | addrlist namelist] ...\n",
719 __progname); 723 __progname);
720 exit(1); 724 exit(1);
721} 725}
@@ -741,7 +745,7 @@ main(int argc, char **argv)
741 if (argc <= 1) 745 if (argc <= 1)
742 usage(); 746 usage();
743 747
744 while ((opt = getopt(argc, argv, "Hv46p:T:t:f:")) != -1) { 748 while ((opt = getopt(argc, argv, "Hv46p:T:t:f:V:")) != -1) {
745 switch (opt) { 749 switch (opt) {
746 case 'H': 750 case 'H':
747 hash_hosts = 1; 751 hash_hosts = 1;
@@ -802,6 +806,11 @@ main(int argc, char **argv)
802 case '6': 806 case '6':
803 IPv4or6 = AF_INET6; 807 IPv4or6 = AF_INET6;
804 break; 808 break;
809 case 'V':
810 scan_rdomain = a2port(optarg);
811 if (scan_rdomain < 0)
812 scan_rdomain = -1;
813 break;
805 case '?': 814 case '?':
806 default: 815 default:
807 usage(); 816 usage();