summaryrefslogtreecommitdiffstats
path: root/usr.bin/telnet
diff options
context:
space:
mode:
authorbillf <billf@FreeBSD.org>1998-12-14 22:40:39 +0000
committerbillf <billf@FreeBSD.org>1998-12-14 22:40:39 +0000
commitcf6ada6c38a7f43c01a80384974b5bb169822f95 (patch)
treebe073a0ef0de6ea55e2fd7c63796a6d96d49b11c /usr.bin/telnet
parent3695233d550885612a33b0c0e24656922f1610ad (diff)
downloadFreeBSD-src-cf6ada6c38a7f43c01a80384974b5bb169822f95.zip
FreeBSD-src-cf6ada6c38a7f43c01a80384974b5bb169822f95.tar.gz
Add "-N" option to supress reverse name lookup.
This comes in really handy when you're telneting the broken DNS server by IP. PR: bin/8698
Diffstat (limited to 'usr.bin/telnet')
-rw-r--r--usr.bin/telnet/commands.c3
-rw-r--r--usr.bin/telnet/externs.h1
-rw-r--r--usr.bin/telnet/main.c5
-rw-r--r--usr.bin/telnet/telnet.15
-rw-r--r--usr.bin/telnet/telnet.c1
5 files changed, 12 insertions, 3 deletions
diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c
index 165bec2..ebacc42 100644
--- a/usr.bin/telnet/commands.c
+++ b/usr.bin/telnet/commands.c
@@ -2186,7 +2186,8 @@ tn(argc, argv)
if (temp != INADDR_NONE) {
sin.sin_addr.s_addr = temp;
sin.sin_family = AF_INET;
- host = gethostbyaddr((char *)&temp, sizeof(temp), AF_INET);
+ if (doaddrlookup)
+ host = gethostbyaddr((char *)&temp, sizeof(temp), AF_INET);
if (host)
(void) strncpy(_hostname, host->h_name, sizeof(_hostname));
else
diff --git a/usr.bin/telnet/externs.h b/usr.bin/telnet/externs.h
index 43fdb43..a8c3f24 100644
--- a/usr.bin/telnet/externs.h
+++ b/usr.bin/telnet/externs.h
@@ -145,6 +145,7 @@ extern int
termdata, /* Print out terminal data flow */
#endif /* defined(unix) */
debug, /* Debug level */
+ doaddrlookup, /* do a reverse lookup? */
clienteof; /* Client received EOF */
extern cc_t escape; /* Escape to command mode */
diff --git a/usr.bin/telnet/main.c b/usr.bin/telnet/main.c
index 3c4d8df..7f7c9ff 100644
--- a/usr.bin/telnet/main.c
+++ b/usr.bin/telnet/main.c
@@ -135,7 +135,7 @@ main(argc, argv)
rlogin = (strncmp(prompt, "rlog", 4) == 0) ? '~' : _POSIX_VDISABLE;
autologin = -1;
- while ((ch = getopt(argc, argv, "8EKLS:X:acde:fFk:l:n:rt:x")) != -1) {
+ while ((ch = getopt(argc, argv, "8EKLNS:X:acde:fFk:l:n:rt:x")) != -1) {
switch(ch) {
case '8':
eight = 3; /* binary output and input */
@@ -151,6 +151,9 @@ main(argc, argv)
case 'L':
eight |= 2; /* binary output only */
break;
+ case 'N':
+ doaddrlookup = 0;
+ break;
case 'S':
{
#ifdef HAS_GETTOS
diff --git a/usr.bin/telnet/telnet.1 b/usr.bin/telnet/telnet.1
index b234919..de161e8 100644
--- a/usr.bin/telnet/telnet.1
+++ b/usr.bin/telnet/telnet.1
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)telnet.1 8.5 (Berkeley) 3/1/94
-.\" $Id: telnet.1,v 1.8 1997/11/11 05:00:59 steve Exp $
+.\" $Id: telnet.1,v 1.9 1997/12/27 18:58:27 steve Exp $
.\"
.Dd March 1, 1994
.Dt TELNET 1
@@ -93,6 +93,9 @@ Specifies no automatic login to the remote system.
Specifies an 8-bit data path on output. This causes the
.Dv BINARY
option to be negotiated on output.
+.It Fl N
+Prevents IP address to name lookup when destination host is given
+as an IP address.
.It Fl S Ar tos
Sets the IP type-of-service (TOS) option for the telnet
connection to the value
diff --git a/usr.bin/telnet/telnet.c b/usr.bin/telnet/telnet.c
index 5057969..da8b0e1 100644
--- a/usr.bin/telnet/telnet.c
+++ b/usr.bin/telnet/telnet.c
@@ -106,6 +106,7 @@ int
donebinarytoggle, /* the user has put us in binary */
dontlecho, /* do we suppress local echoing right now? */
globalmode,
+ doaddrlookup = 1, /* do a reverse address lookup? */
clienteof = 0;
char *prompt = 0;
OpenPOWER on IntegriCloud