mirror of git://anongit.mindrot.org/openssh.git
- djm@cvs.openbsd.org 2011/05/06 21:14:05
[packet.c packet.h] set traffic class for IPv6 traffic as we do for IPv4 TOS; patch from lionel AT mamane.lu via Colin Watson in bz#1855; ok markus@
This commit is contained in:
parent
78c40c321b
commit
d2ac5d74b4
|
@ -14,6 +14,11 @@
|
|||
- djm@cvs.openbsd.org 2011/05/06 02:05:41
|
||||
[sshconnect2.c]
|
||||
fix memory leak; bz#1849 ok dtucker@
|
||||
- djm@cvs.openbsd.org 2011/05/06 21:14:05
|
||||
[packet.c packet.h]
|
||||
set traffic class for IPv6 traffic as we do for IPv4 TOS;
|
||||
patch from lionel AT mamane.lu via Colin Watson in bz#1855;
|
||||
ok markus@
|
||||
|
||||
20110510
|
||||
- (dtucker) [openbsd-compat/openssl-compat.{c,h}] Bug #1882: fix
|
||||
|
|
44
packet.c
44
packet.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: packet.c,v 1.172 2010/11/13 23:27:50 djm Exp $ */
|
||||
/* $OpenBSD: packet.c,v 1.173 2011/05/06 21:14:05 djm Exp $ */
|
||||
/*
|
||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||
|
@ -422,10 +422,8 @@ packet_set_state(int mode, u_int32_t seqnr, u_int64_t blocks, u_int32_t packets,
|
|||
state->bytes = bytes;
|
||||
}
|
||||
|
||||
/* returns 1 if connection is via ipv4 */
|
||||
|
||||
int
|
||||
packet_connection_is_ipv4(void)
|
||||
static int
|
||||
packet_connection_af(void)
|
||||
{
|
||||
struct sockaddr_storage to;
|
||||
socklen_t tolen = sizeof(to);
|
||||
|
@ -439,9 +437,9 @@ packet_connection_is_ipv4(void)
|
|||
#ifdef IPV4_IN_IPV6
|
||||
if (to.ss_family == AF_INET6 &&
|
||||
IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)&to)->sin6_addr))
|
||||
return 1;
|
||||
return AF_INET;
|
||||
#endif
|
||||
return 0;
|
||||
return to.ss_family;
|
||||
}
|
||||
|
||||
/* Sets the connection into non-blocking mode. */
|
||||
|
@ -1752,16 +1750,30 @@ packet_not_very_much_data_to_write(void)
|
|||
static void
|
||||
packet_set_tos(int tos)
|
||||
{
|
||||
#if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN)
|
||||
if (!packet_connection_is_on_socket() ||
|
||||
!packet_connection_is_ipv4())
|
||||
#ifndef IP_TOS_IS_BROKEN
|
||||
if (!packet_connection_is_on_socket())
|
||||
return;
|
||||
debug3("%s: set IP_TOS 0x%02x", __func__, tos);
|
||||
if (setsockopt(active_state->connection_in, IPPROTO_IP, IP_TOS, &tos,
|
||||
sizeof(tos)) < 0)
|
||||
error("setsockopt IP_TOS %d: %.100s:",
|
||||
tos, strerror(errno));
|
||||
#endif
|
||||
switch (packet_connection_af()) {
|
||||
# ifdef IP_TOS
|
||||
case AF_INET:
|
||||
debug3("%s: set IP_TOS 0x%02x", __func__, tos);
|
||||
if (setsockopt(active_state->connection_in,
|
||||
IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0)
|
||||
error("setsockopt IP_TOS %d: %.100s:",
|
||||
tos, strerror(errno));
|
||||
break;
|
||||
# endif /* IP_TOS */
|
||||
# ifdef IPV6_TCLASS
|
||||
case AF_INET6:
|
||||
debug3("%s: set IPV6_TCLASS 0x%02x", __func__, tos);
|
||||
if (setsockopt(active_state->connection_in,
|
||||
IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos)) < 0)
|
||||
error("setsockopt IPV6_TCLASS %d: %.100s:",
|
||||
tos, strerror(errno));
|
||||
break;
|
||||
}
|
||||
# endif /* IPV6_TCLASS */
|
||||
#endif /* IP_TOS_IS_BROKEN */
|
||||
}
|
||||
|
||||
/* Informs that the current session is interactive. Sets IP flags for that. */
|
||||
|
|
3
packet.h
3
packet.h
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: packet.h,v 1.55 2010/11/13 23:27:50 djm Exp $ */
|
||||
/* $OpenBSD: packet.h,v 1.56 2011/05/06 21:14:05 djm Exp $ */
|
||||
|
||||
/*
|
||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||
|
@ -92,7 +92,6 @@ int packet_have_data_to_write(void);
|
|||
int packet_not_very_much_data_to_write(void);
|
||||
|
||||
int packet_connection_is_on_socket(void);
|
||||
int packet_connection_is_ipv4(void);
|
||||
int packet_remaining(void);
|
||||
void packet_send_ignore(int);
|
||||
void packet_add_padding(u_char);
|
||||
|
|
Loading…
Reference in New Issue