summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--packet.c49
2 files changed, 22 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index 892c87e24..8a8fc00bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -59,6 +59,9 @@
59 [session.c] 59 [session.c]
60 Make sure $SHELL points to the shell from the password file, even if shell 60 Make sure $SHELL points to the shell from the password file, even if shell
61 is overridden from login.conf; bug#453; semen at online.sinor.ru; ok millert@ 61 is overridden from login.conf; bug#453; semen at online.sinor.ru; ok millert@
62 - markus@cvs.openbsd.org 2002/12/10 19:26:50
63 [packet.c]
64 move tos handling to packet_set_tos; ok provos/henning/deraadt
62 65
6320021205 6620021205
64 - (djm) PERL-free fixpaths from stuge-openssh-unix-dev@cdy.org 67 - (djm) PERL-free fixpaths from stuge-openssh-unix-dev@cdy.org
@@ -894,4 +897,4 @@
894 save auth method before monitor_reset_key_state(); bugzilla bug #284; 897 save auth method before monitor_reset_key_state(); bugzilla bug #284;
895 ok provos@ 898 ok provos@
896 899
897$Id: ChangeLog,v 1.2531 2002/12/23 02:26:08 mouring Exp $ 900$Id: ChangeLog,v 1.2532 2002/12/23 02:41:41 mouring Exp $
diff --git a/packet.c b/packet.c
index 0a8baa5b2..d06ac904a 100644
--- a/packet.c
+++ b/packet.c
@@ -37,7 +37,7 @@
37 */ 37 */
38 38
39#include "includes.h" 39#include "includes.h"
40RCSID("$OpenBSD: packet.c,v 1.100 2002/11/21 22:45:31 markus Exp $"); 40RCSID("$OpenBSD: packet.c,v 1.101 2002/12/10 19:26:50 markus Exp $");
41 41
42#include "xmalloc.h" 42#include "xmalloc.h"
43#include "buffer.h" 43#include "buffer.h"
@@ -1314,16 +1314,26 @@ packet_not_very_much_data_to_write(void)
1314 return buffer_len(&output) < 128 * 1024; 1314 return buffer_len(&output) < 128 * 1024;
1315} 1315}
1316 1316
1317void
1318packet_set_tos(int interactive)
1319{
1320 int tos = interactive ? IPTOS_LOWDELAY : IPTOS_THROUGHPUT;
1321
1322 if (!packet_connection_is_on_socket() ||
1323 !packet_connection_is_ipv4())
1324 return;
1325 if (setsockopt(connection_in, IPPROTO_IP, IP_TOS, &tos,
1326 sizeof(tos)) < 0)
1327 error("setsockopt IP_TOS %d: %.100s:",
1328 tos, strerror(errno));
1329}
1330
1317/* Informs that the current session is interactive. Sets IP flags for that. */ 1331/* Informs that the current session is interactive. Sets IP flags for that. */
1318 1332
1319void 1333void
1320packet_set_interactive(int interactive) 1334packet_set_interactive(int interactive)
1321{ 1335{
1322 static int called = 0; 1336 static int called = 0;
1323#if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN)
1324 int lowdelay = IPTOS_LOWDELAY;
1325 int throughput = IPTOS_THROUGHPUT;
1326#endif
1327 1337
1328 if (called) 1338 if (called)
1329 return; 1339 return;
@@ -1334,35 +1344,12 @@ packet_set_interactive(int interactive)
1334 1344
1335 /* Only set socket options if using a socket. */ 1345 /* Only set socket options if using a socket. */
1336 if (!packet_connection_is_on_socket()) 1346 if (!packet_connection_is_on_socket())
1337 return; 1347 if (interactive)
1338 /*
1339 * IPTOS_LOWDELAY and IPTOS_THROUGHPUT are IPv4 only
1340 */
1341 if (interactive) {
1342 /*
1343 * Set IP options for an interactive connection. Use
1344 * IPTOS_LOWDELAY and TCP_NODELAY.
1345 */
1346#if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN)
1347 if (packet_connection_is_ipv4()) {
1348 if (setsockopt(connection_in, IPPROTO_IP, IP_TOS,
1349 &lowdelay, sizeof(lowdelay)) < 0)
1350 error("setsockopt IPTOS_LOWDELAY: %.100s",
1351 strerror(errno));
1352 }
1353#endif
1354 set_nodelay(connection_in); 1348 set_nodelay(connection_in);
1355 } else if (packet_connection_is_ipv4()) {
1356 /*
1357 * Set IP options for a non-interactive connection. Use
1358 * IPTOS_THROUGHPUT.
1359 */
1360#if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN) 1349#if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN)
1361 if (setsockopt(connection_in, IPPROTO_IP, IP_TOS, &throughput, 1350 packet_set_tos(interactive);
1362 sizeof(throughput)) < 0)
1363 error("setsockopt IPTOS_THROUGHPUT: %.100s", strerror(errno));
1364#endif 1351#endif
1365 } 1352
1366} 1353}
1367 1354
1368/* Returns true if the current connection is interactive. */ 1355/* Returns true if the current connection is interactive. */