summaryrefslogtreecommitdiff
path: root/usr.bin/telnet/commands.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-05-23 12:15:21 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-05-23 12:15:21 +0000
commit4d473766d13416ed86508d2cef5b341debe4b8e6 (patch)
treecf049d024dae170abd525b0c4858b2efb275ac5e /usr.bin/telnet/commands.c
parentec690bc0c48094b1abc3b1b293a7d687980f9acb (diff)
fix multi-address host connects; cstone@pobox.com
print new address as it is tried; deraadt
Diffstat (limited to 'usr.bin/telnet/commands.c')
-rw-r--r--usr.bin/telnet/commands.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c
index 112dc0f84fb..3ea2882bf07 100644
--- a/usr.bin/telnet/commands.c
+++ b/usr.bin/telnet/commands.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commands.c,v 1.15 1998/05/15 03:16:35 art Exp $ */
+/* $OpenBSD: commands.c,v 1.16 1998/05/23 12:15:20 deraadt Exp $ */
/* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */
/*
@@ -2561,8 +2561,11 @@ tn(argc, argv)
}
if (connect(net, sa, sa_size) < 0) {
+ int retry = 0;
+
if (host && host->h_addr_list[1]) {
int oerrno = errno;
+ retry = 1;
switch(family) {
case AF_INET :
@@ -2573,7 +2576,7 @@ tn(argc, argv)
#if defined(AF_INET6) && defined(HAVE_STRUCT_SOCKADDR_IN6)
case AF_INET6: {
char buf[INET6_ADDRSTRLEN];
-
+
fprintf(stderr, "telnet: connect to address %s: ",
inet_ntop(AF_INET6, &sin6.sin6_addr, buf,
sizeof(buf)));
@@ -2587,9 +2590,22 @@ tn(argc, argv)
errno = oerrno;
perror(NULL);
- host->h_addr_list++;
- memmove((caddr_t)&sin.sin_addr,
- host->h_addr_list[0], host->h_length);
+
+ switch(family) {
+ case AF_INET :
+ printf("Trying %s...\r\n", inet_ntoa(sin.sin_addr));
+ break;
+#if defined(AF_INET6) && defined(HAVE_STRUCT_SOCKADDR_IN6)
+ case AF_INET6: {
+ printf("Trying %s...\r\n", inet_ntop(AF_INET6,
+ &sin6.sin6_addr,
+ buf,
+ sizeof(buf)));
+ break;
+ }
+#endif
+ }
+
(void) NetClose(net);
continue;
}