summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/telnet/commands.c8
-rw-r--r--usr.bin/telnet/externs.h4
-rw-r--r--usr.bin/telnet/main.c18
-rw-r--r--usr.bin/telnet/telnet.17
4 files changed, 30 insertions, 7 deletions
diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c
index a5244e1dd08..9b848f5da22 100644
--- a/usr.bin/telnet/commands.c
+++ b/usr.bin/telnet/commands.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commands.c,v 1.50 2009/04/27 06:08:10 matthieu Exp $ */
+/* $OpenBSD: commands.c,v 1.51 2009/06/05 00:20:46 claudio Exp $ */
/* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */
/*
@@ -2396,6 +2396,12 @@ tn(argc, argv)
if (net < 0)
continue;
+ if (rdomain) {
+ if (setsockopt(net, IPPROTO_IP, SO_RDOMAIN, &rdomain,
+ sizeof(rdomain)) == -1)
+ perror("setsockopt (SO_RDOMAIN)");
+ }
+
if (aliasp) {
struct addrinfo ahints, *ares;
diff --git a/usr.bin/telnet/externs.h b/usr.bin/telnet/externs.h
index d15e1ce985e..8729421c51c 100644
--- a/usr.bin/telnet/externs.h
+++ b/usr.bin/telnet/externs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: externs.h,v 1.14 2005/02/27 15:46:42 otto Exp $ */
+/* $OpenBSD: externs.h,v 1.15 2009/06/05 00:20:46 claudio Exp $ */
/* $KTH: externs.h,v 1.16 1997/11/29 02:28:35 joda Exp $ */
/*
@@ -108,6 +108,8 @@ extern void (*encrypt_output) (unsigned char *, int);
extern int (*decrypt_input) (int);
#endif
+extern u_int rdomain; /* routing domain to use */
+
/*
* We keep track of each side of the option negotiation.
*/
diff --git a/usr.bin/telnet/main.c b/usr.bin/telnet/main.c
index 2c9261ec043..7483c05192f 100644
--- a/usr.bin/telnet/main.c
+++ b/usr.bin/telnet/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.16 2007/03/15 22:51:16 jmc Exp $ */
+/* $OpenBSD: main.c,v 1.17 2009/06/05 00:20:46 claudio Exp $ */
/* $NetBSD: main.c,v 1.5 1996/02/28 21:04:05 thorpej Exp $ */
/*
@@ -60,6 +60,7 @@ static int default_forward=0;
#endif
int family = AF_UNSPEC;
+u_int rdomain;
/*
* Initialize variables.
@@ -91,7 +92,8 @@ usage()
# else
"usage: %s [-468acdEFfKLrx] [-b hostalias] [-e escapechar] "
"[-k realm]\n"
- "\t[-l user] [-n tracefile] [-X authtype] [host [port]]\n",
+ "\t[-l user] [-n tracefile] [-V rdoamin] [-X authtype] "
+ "[host [port]]\n",
#endif
__progname);
@@ -149,6 +151,7 @@ main(argc, argv)
extern int optind;
int ch;
char *user, *alias;
+ const char *errstr;
#ifdef FORWARD
extern int forward_flags;
#endif /* FORWARD */
@@ -177,7 +180,7 @@ main(argc, argv)
*/
autologin = -1;
- while ((ch = getopt(argc, argv, "4678DEKLS:X:ab:cde:fFk:l:n:rt:x"))
+ while ((ch = getopt(argc, argv, "4678DEKLS:X:ab:cde:fFk:l:n:rt:V:x"))
!= -1) {
switch(ch) {
case '4':
@@ -328,6 +331,15 @@ main(argc, argv)
prompt);
#endif
break;
+ case 'V':
+ rdomain = (unsigned int)strtonum(optarg, 0,
+ RT_TABLEID_MAX, &errstr);
+ if (errstr) {
+ fprintf(stderr,
+ "%s: Warning: -R ignored, rdomain %s: %s\n",
+ prompt, errstr, optarg);
+ }
+ break;
case 'x':
#ifdef ENCRYPTION
encrypt_auto(1);
diff --git a/usr.bin/telnet/telnet.1 b/usr.bin/telnet/telnet.1
index ed428f7139b..bfdbb9b69b0 100644
--- a/usr.bin/telnet/telnet.1
+++ b/usr.bin/telnet/telnet.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: telnet.1,v 1.40 2007/08/06 19:16:05 sobrado Exp $
+.\" $OpenBSD: telnet.1,v 1.41 2009/06/05 00:20:46 claudio Exp $
.\" $NetBSD: telnet.1,v 1.5 1996/02/28 21:04:12 thorpej Exp $
.\"
.\" Copyright (c) 1983, 1990, 1993
@@ -30,7 +30,7 @@
.\"
.\" from: @(#)telnet.1 8.4 (Berkeley) 2/3/94
.\"
-.Dd $Mdocdate: August 6 2007 $
+.Dd $Mdocdate: June 5 2009 $
.Dt TELNET 1
.Os
.Sh NAME
@@ -47,6 +47,7 @@ protocol
.Op Fl k Ar realm
.Op Fl l Ar user
.Op Fl n Ar tracefile
+.Op Fl V Ar rdomain
.Op Fl X Ar authtype
.Oo
.Ar host
@@ -185,6 +186,8 @@ mode, the escape character is set to the tilde (~) character,
unless modified by the
.Fl e
option.
+.It Fl V Ar rdomain
+Set the routing domain, the default is 0.
.It Fl X Ar authtype
Disables the
.Ar authtype