From 60453219bdaf4e4b5e09eaf27a08be66753362a5 Mon Sep 17 00:00:00 2001 From: Bill Fumerola Date: Mon, 14 Dec 1998 22:40:39 +0000 Subject: [PATCH] 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 --- usr.bin/telnet/commands.c | 3 ++- usr.bin/telnet/externs.h | 1 + usr.bin/telnet/main.c | 5 ++++- usr.bin/telnet/telnet.1 | 5 ++++- usr.bin/telnet/telnet.c | 1 + 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c index 165bec2e4428..ebacc42bc0d9 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 43fdb43287be..a8c3f24f57fd 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 3c4d8df281de..7f7c9ff0059b 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 b2349195b2ce..de161e850807 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 5057969c6f24..da8b0e113bf1 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;