summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2010-11-20 15:19:38 +1100
committerDamien Miller <djm@mindrot.org>2010-11-20 15:19:38 +1100
commit0dac6fb6b228a96f4ab3717e3d73871595a291a8 (patch)
tree7eae6f1e6a39fb7d608a05250f4749a77a914814 /packet.c
parent4499f4cc20eee7e0f67b35f5a5c6078bf07dcbc0 (diff)
- djm@cvs.openbsd.org 2010/11/13 23:27:51
[clientloop.c misc.c misc.h packet.c packet.h readconf.c readconf.h] [servconf.c servconf.h session.c ssh.c ssh_config.5 sshd_config.5] allow ssh and sshd to set arbitrary TOS/DSCP/QoS values instead of hardcoding lowdelay/throughput. bz#1733 patch from philipp AT redfish-solutions.com; ok markus@ deraadt@
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/packet.c b/packet.c
index 698920013..012c39a3c 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.c,v 1.171 2010/11/05 02:46:47 djm Exp $ */ 1/* $OpenBSD: packet.c,v 1.172 2010/11/13 23:27:50 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1750,7 +1750,7 @@ packet_not_very_much_data_to_write(void)
1750} 1750}
1751 1751
1752static void 1752static void
1753packet_set_tos(int interactive) 1753packet_set_tos(int tos)
1754{ 1754{
1755#if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN) 1755#if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN)
1756 int tos = interactive ? IPTOS_LOWDELAY : IPTOS_THROUGHPUT; 1756 int tos = interactive ? IPTOS_LOWDELAY : IPTOS_THROUGHPUT;
@@ -1758,6 +1758,7 @@ packet_set_tos(int interactive)
1758 if (!packet_connection_is_on_socket() || 1758 if (!packet_connection_is_on_socket() ||
1759 !packet_connection_is_ipv4()) 1759 !packet_connection_is_ipv4())
1760 return; 1760 return;
1761 debug3("%s: set IP_TOS 0x%02x", __func__, tos);
1761 if (setsockopt(active_state->connection_in, IPPROTO_IP, IP_TOS, &tos, 1762 if (setsockopt(active_state->connection_in, IPPROTO_IP, IP_TOS, &tos,
1762 sizeof(tos)) < 0) 1763 sizeof(tos)) < 0)
1763 error("setsockopt IP_TOS %d: %.100s:", 1764 error("setsockopt IP_TOS %d: %.100s:",
@@ -1768,7 +1769,7 @@ packet_set_tos(int interactive)
1768/* Informs that the current session is interactive. Sets IP flags for that. */ 1769/* Informs that the current session is interactive. Sets IP flags for that. */
1769 1770
1770void 1771void
1771packet_set_interactive(int interactive) 1772packet_set_interactive(int interactive, int qos_interactive, int qos_bulk)
1772{ 1773{
1773 if (active_state->set_interactive_called) 1774 if (active_state->set_interactive_called)
1774 return; 1775 return;
@@ -1781,7 +1782,7 @@ packet_set_interactive(int interactive)
1781 if (!packet_connection_is_on_socket()) 1782 if (!packet_connection_is_on_socket())
1782 return; 1783 return;
1783 set_nodelay(active_state->connection_in); 1784 set_nodelay(active_state->connection_in);
1784 packet_set_tos(interactive); 1785 packet_set_tos(interactive ? qos_interactive : qos_bulk);
1785} 1786}
1786 1787
1787/* Returns true if the current connection is interactive. */ 1788/* Returns true if the current connection is interactive. */