diff options
author | maxim <maxim@FreeBSD.org> | 2005-01-09 10:24:46 +0000 |
---|---|---|
committer | maxim <maxim@FreeBSD.org> | 2005-01-09 10:24:46 +0000 |
commit | ae5da6b5cfca812bea25bbdef893f80d26875b31 (patch) | |
tree | c05c1af1cd0973883c4b00dab171b9c38ae56f11 /contrib/telnet/telnetd | |
parent | d1d9cce8164ae46ea7db1995980a2fa53691fcd5 (diff) | |
download | FreeBSD-src-ae5da6b5cfca812bea25bbdef893f80d26875b31.zip FreeBSD-src-ae5da6b5cfca812bea25bbdef893f80d26875b31.tar.gz |
o Make telnet[d] -S (IP TOS) flag really work. We do not have
/etc/iptos implementation so only numeric values supported.
o telnetd.8: steal the -S flag description from telnet.1, bump
the date of the document.
MFC after: 6 weeks
Diffstat (limited to 'contrib/telnet/telnetd')
-rw-r--r-- | contrib/telnet/telnetd/telnetd.8 | 9 | ||||
-rw-r--r-- | contrib/telnet/telnetd/telnetd.c | 11 |
2 files changed, 18 insertions, 2 deletions
diff --git a/contrib/telnet/telnetd/telnetd.8 b/contrib/telnet/telnetd/telnetd.8 index 0f3a15c..ab99096 100644 --- a/contrib/telnet/telnetd/telnetd.8 +++ b/contrib/telnet/telnetd/telnetd.8 @@ -32,7 +32,7 @@ .\" @(#)telnetd.8 8.4 (Berkeley) 6/1/94 .\" $FreeBSD$ .\" -.Dd January 5, 2005 +.Dd January 9, 2005 .Dt TELNETD 8 .Os .Sh NAME @@ -251,6 +251,13 @@ Specify an alternate command to run to complete the login. The alternate command must understand the same command arguments as the standard login. .It Fl S Ar tos +Sets the IP type-of-service (TOS) option for the telnet +connection to the value +.Ar tos , +which can be a numeric TOS value or, on systems that support it, a symbolic +TOS name found in the +.Pa /etc/iptos +file. .It Fl u Ar len This option is used to specify the size of the field in the diff --git a/contrib/telnet/telnetd/telnetd.c b/contrib/telnet/telnetd/telnetd.c index 6e4bd4f..614bab9 100644 --- a/contrib/telnet/telnetd/telnetd.c +++ b/contrib/telnet/telnetd/telnetd.c @@ -131,12 +131,14 @@ char user_name[256]; int main(int argc, char *argv[]) { + u_long ultmp; struct sockaddr_storage from; int on = 1, fromlen; int ch; #if defined(IPPROTO_IP) && defined(IP_TOS) int tos = -1; #endif + char *ep; pfrontp = pbackp = ptyobuf; netip = netibuf; @@ -273,7 +275,14 @@ main(int argc, char *argv[]) "bad TOS argument '", optarg, "'; will try to use default TOS"); #else - warnx("TOS option unavailable; -S flag not supported"); +#define MAXTOS 255 + ultmp = strtoul(optarg, &ep, 0); + if (*ep || ep == optarg || ultmp > MAXTOS) + warnx("%s%s%s", + "bad TOS argument '", optarg, + "'; will try to use default TOS"); + else + tos = ultmp; #endif break; |