From 970eb1389929cda70c7bf43cf3058f86c436ba99 Mon Sep 17 00:00:00 2001 From: Mike Karels Date: Thu, 28 Jun 1990 00:07:58 -0800 Subject: [PATCH] add IP type-of-service without gettos (at least for now) SCCS-vsn: libexec/telnetd/telnetd.c 5.44 SCCS-vsn: libexec/telnetd/defs.h 5.7 SCCS-vsn: libexec/telnetd/Makefile 5.9 --- usr/src/libexec/telnetd/Makefile | 3 +-- usr/src/libexec/telnetd/defs.h | 4 +++- usr/src/libexec/telnetd/telnetd.c | 37 +++++++++---------------------- 3 files changed, 15 insertions(+), 29 deletions(-) diff --git a/usr/src/libexec/telnetd/Makefile b/usr/src/libexec/telnetd/Makefile index 5baa4d7b51..40ba8cd97e 100644 --- a/usr/src/libexec/telnetd/Makefile +++ b/usr/src/libexec/telnetd/Makefile @@ -1,7 +1,6 @@ -# @(#)Makefile 5.8 (Berkeley) %G% +# @(#)Makefile 5.9 (Berkeley) %G% PROG= telnetd -CFLAGS+=-DNEED_GETTOS SRCS= get_date.c gettytab.c global.c slc.c state.c sys_term.c telnetd.c \ termstat.c utility.c DPADD= ${LIBUTIL} ${LIBTERM} diff --git a/usr/src/libexec/telnetd/defs.h b/usr/src/libexec/telnetd/defs.h index 11e56be16b..b33b31ca8f 100644 --- a/usr/src/libexec/telnetd/defs.h +++ b/usr/src/libexec/telnetd/defs.h @@ -4,7 +4,7 @@ * * %sccs.include.redist.c% * - * @(#)defs.h 5.6 (Berkeley) %G% + * @(#)defs.h 5.7 (Berkeley) %G% */ /* @@ -42,6 +42,8 @@ #include #include +#include +#include #include diff --git a/usr/src/libexec/telnetd/telnetd.c b/usr/src/libexec/telnetd/telnetd.c index fb7bcf7b92..3817f94f8e 100644 --- a/usr/src/libexec/telnetd/telnetd.c +++ b/usr/src/libexec/telnetd/telnetd.c @@ -12,7 +12,7 @@ char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)telnetd.c 5.43 (Berkeley) %G%"; +static char sccsid[] = "@(#)telnetd.c 5.44 (Berkeley) %G%"; #endif /* not lint */ #include "telnetd.h" @@ -36,36 +36,16 @@ int lowpty = 0, highpty; /* low, high pty numbers */ int debug = 0; char *progname; -#if defined(IP_TOS) && defined(NEED_GETTOS) -struct tosent { - char *t_name; /* name */ - char **t_aliases; /* alias list */ - char *t_proto; /* protocol */ - int t_tos; /* Type Of Service bits */ -}; - -struct tosent * -gettosbyname(name, proto) -char *name, *proto; -{ - static struct tosent te; - static char *aliasp = 0; - - te.t_name = name; - te.t_aliases = &aliasp; - te.t_proto = proto; - te.t_tos = 020; /* Low Delay bit */ - return(&te); -} -#endif - main(argc, argv) char *argv[]; { struct sockaddr_in from; int on = 1, fromlen; #ifdef IP_TOS + int tos; +#ifdef CRAY struct tosent *tp; +#endif #endif /* IP_TOS */ pfrontp = pbackp = ptyobuf; @@ -214,8 +194,13 @@ top: } #ifdef IP_TOS - if ((tp = gettosbyname("telnet", "tcp")) && - (setsockopt(0, IPPROTO_IP, IP_TOS, &tp->t_tos, sizeof(int)) < 0)) +#ifdef CRAY + if (tp = gettosbyname("telnet", "tcp")) + tos = tp->t_tos; + else +#endif /* CRAY */ + tos = IPTOS_LOWDELAY; + if (setsockopt(0, IPPROTO_IP, IP_TOS, &tos, sizeof(int)) < 0) syslog(LOG_WARNING, "setsockopt (IP_TOS): %m"); #endif /* IP_TOS */ net = 0; -- 2.20.1