- Support -4 and -6. Approved by itojun.

This commit is contained in:
kanaoka 2002-08-23 08:14:20 +00:00
parent e68a39d27b
commit d4a4b29e36
4 changed files with 31 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: commands.c,v 1.48 2002/06/14 00:30:56 wiz Exp $ */
/* $NetBSD: commands.c,v 1.49 2002/08/23 08:14:20 kanaoka Exp $ */
/*
* Copyright (C) 1997 and 1998 WIDE Project.
@ -67,7 +67,7 @@
#if 0
static char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
#else
__RCSID("$NetBSD: commands.c,v 1.48 2002/06/14 00:30:56 wiz Exp $");
__RCSID("$NetBSD: commands.c,v 1.49 2002/08/23 08:14:20 kanaoka Exp $");
#endif
#endif /* not lint */
@ -2424,7 +2424,7 @@ tn(argc, argv)
telnetport = 0;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_family = family;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = 0;
hints.ai_flags = AI_NUMERICHOST; /* avoid forward lookup */
@ -2442,7 +2442,7 @@ tn(argc, argv)
} else {
/* FQDN - try again with forward DNS lookup */
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_family = family;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = 0;
hints.ai_flags = AI_CANONNAME;

View File

@ -1,4 +1,4 @@
/* $NetBSD: externs.h,v 1.24 2002/06/14 09:55:08 wiz Exp $ */
/* $NetBSD: externs.h,v 1.25 2002/08/23 08:14:20 kanaoka Exp $ */
/*
* Copyright (c) 1988, 1990, 1993
@ -119,6 +119,7 @@ extern int
autologin, /* Autologin enabled */
skiprc, /* Don't process the ~/.telnetrc file */
eight, /* use eight bit mode (binary in and/or out */
family, /* address family of peer */
flushout, /* flush output */
connected, /* Are we connected to the other side? */
globalmode, /* Mode tty should be in */

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.16 2002/06/14 00:30:56 wiz Exp $ */
/* $NetBSD: main.c,v 1.17 2002/08/23 08:14:20 kanaoka Exp $ */
/*
* Copyright (c) 1988, 1990, 1993
@ -43,11 +43,12 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1990, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 5/30/95";
#else
__RCSID("$NetBSD: main.c,v 1.16 2002/06/14 00:30:56 wiz Exp $");
__RCSID("$NetBSD: main.c,v 1.17 2002/08/23 08:14:20 kanaoka Exp $");
#endif
#endif /* not lint */
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
@ -75,6 +76,8 @@ char *ipsec_policy_in = NULL;
char *ipsec_policy_out = NULL;
#endif
int family = AF_UNSPEC;
int main(int, char *[]);
/*
@ -102,10 +105,10 @@ usage()
fprintf(stderr, "Usage: %s %s%s%s%s\n",
prompt,
#ifdef AUTHENTICATION
"[-8] [-E] [-K] [-L] [-N] [-S tos] [-X atype] [-a] [-c] [-d]",
"[-4] [-6] [-8] [-E] [-K] [-L] [-N] [-S tos] [-X atype] [-a] [-c] [-d]",
"\n\t[-e char] [-k realm] [-l user] [-f/-F] [-n tracefile] ",
#else
"[-8] [-E] [-L] [-N] [-S tos] [-a] [-c] [-d] [-e char] [-l user]",
"[-4] [-6] [-8] [-E] [-L] [-N] [-S tos] [-a] [-c] [-d] [-e char] [-l user]",
"\n\t[-n tracefile]",
#endif
#if defined(TN3270) && defined(unix)
@ -166,10 +169,16 @@ main(argc, argv)
#else
#define IPSECOPT
#endif
while ((ch = getopt(argc, argv, "8EKLNS:X:acde:fFk:l:n:rt:x"
while ((ch = getopt(argc, argv, "468EKLNS:X:acde:fFk:l:n:rt:x"
IPSECOPT)) != -1) {
#undef IPSECOPT
switch(ch) {
case '4':
family = AF_INET;
break;
case '6':
family = AF_INET6;
break;
case '8':
eight = 3; /* binary output and input */
break;

View File

@ -1,4 +1,4 @@
.\" $NetBSD: telnet.1,v 1.22 2002/02/08 01:36:34 ross Exp $
.\" $NetBSD: telnet.1,v 1.23 2002/08/23 08:14:20 kanaoka Exp $
.\"
.\" Copyright (c) 1983, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -43,6 +43,8 @@
protocol
.Sh SYNOPSIS
.Nm ""
.Op Fl 4
.Op Fl 6
.Op Fl 8
.Op Fl E
.Op Fl F
@ -101,6 +103,14 @@ command with those arguments.
.Pp
Options:
.Bl -tag -width indent
.It Fl 4
Forces
.Nm
to use IPv4 addreses only.
.It Fl 6
Forces
.Nm
to use IPv6 addresses only.
.It Fl 8
Specifies an 8-bit data path. This causes an attempt to
negotiate the