- markus@cvs.openbsd.org 2002/12/10 19:26:50
[packet.c] move tos handling to packet_set_tos; ok provos/henning/deraadt
This commit is contained in:
parent
46767607e2
commit
a743398d04
|
@ -59,6 +59,9 @@
|
|||
[session.c]
|
||||
Make sure $SHELL points to the shell from the password file, even if shell
|
||||
is overridden from login.conf; bug#453; semen at online.sinor.ru; ok millert@
|
||||
- markus@cvs.openbsd.org 2002/12/10 19:26:50
|
||||
[packet.c]
|
||||
move tos handling to packet_set_tos; ok provos/henning/deraadt
|
||||
|
||||
20021205
|
||||
- (djm) PERL-free fixpaths from stuge-openssh-unix-dev@cdy.org
|
||||
|
@ -894,4 +897,4 @@
|
|||
save auth method before monitor_reset_key_state(); bugzilla bug #284;
|
||||
ok provos@
|
||||
|
||||
$Id: ChangeLog,v 1.2531 2002/12/23 02:26:08 mouring Exp $
|
||||
$Id: ChangeLog,v 1.2532 2002/12/23 02:41:41 mouring Exp $
|
||||
|
|
49
packet.c
49
packet.c
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: packet.c,v 1.100 2002/11/21 22:45:31 markus Exp $");
|
||||
RCSID("$OpenBSD: packet.c,v 1.101 2002/12/10 19:26:50 markus Exp $");
|
||||
|
||||
#include "xmalloc.h"
|
||||
#include "buffer.h"
|
||||
|
@ -1314,16 +1314,26 @@ packet_not_very_much_data_to_write(void)
|
|||
return buffer_len(&output) < 128 * 1024;
|
||||
}
|
||||
|
||||
void
|
||||
packet_set_tos(int interactive)
|
||||
{
|
||||
int tos = interactive ? IPTOS_LOWDELAY : IPTOS_THROUGHPUT;
|
||||
|
||||
if (!packet_connection_is_on_socket() ||
|
||||
!packet_connection_is_ipv4())
|
||||
return;
|
||||
if (setsockopt(connection_in, IPPROTO_IP, IP_TOS, &tos,
|
||||
sizeof(tos)) < 0)
|
||||
error("setsockopt IP_TOS %d: %.100s:",
|
||||
tos, strerror(errno));
|
||||
}
|
||||
|
||||
/* Informs that the current session is interactive. Sets IP flags for that. */
|
||||
|
||||
void
|
||||
packet_set_interactive(int interactive)
|
||||
{
|
||||
static int called = 0;
|
||||
#if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN)
|
||||
int lowdelay = IPTOS_LOWDELAY;
|
||||
int throughput = IPTOS_THROUGHPUT;
|
||||
#endif
|
||||
|
||||
if (called)
|
||||
return;
|
||||
|
@ -1334,35 +1344,12 @@ packet_set_interactive(int interactive)
|
|||
|
||||
/* Only set socket options if using a socket. */
|
||||
if (!packet_connection_is_on_socket())
|
||||
return;
|
||||
/*
|
||||
* IPTOS_LOWDELAY and IPTOS_THROUGHPUT are IPv4 only
|
||||
*/
|
||||
if (interactive) {
|
||||
/*
|
||||
* Set IP options for an interactive connection. Use
|
||||
* IPTOS_LOWDELAY and TCP_NODELAY.
|
||||
*/
|
||||
#if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN)
|
||||
if (packet_connection_is_ipv4()) {
|
||||
if (setsockopt(connection_in, IPPROTO_IP, IP_TOS,
|
||||
&lowdelay, sizeof(lowdelay)) < 0)
|
||||
error("setsockopt IPTOS_LOWDELAY: %.100s",
|
||||
strerror(errno));
|
||||
}
|
||||
#endif
|
||||
if (interactive)
|
||||
set_nodelay(connection_in);
|
||||
} else if (packet_connection_is_ipv4()) {
|
||||
/*
|
||||
* Set IP options for a non-interactive connection. Use
|
||||
* IPTOS_THROUGHPUT.
|
||||
*/
|
||||
#if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN)
|
||||
if (setsockopt(connection_in, IPPROTO_IP, IP_TOS, &throughput,
|
||||
sizeof(throughput)) < 0)
|
||||
error("setsockopt IPTOS_THROUGHPUT: %.100s", strerror(errno));
|
||||
packet_set_tos(interactive);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Returns true if the current connection is interactive. */
|
||||
|
|
Loading…
Reference in New Issue