diff options
author | des <des@FreeBSD.org> | 2011-10-05 22:08:17 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2011-10-05 22:08:17 +0000 |
commit | 038442ad80c21a07c19532a176030e2ca51fdd9d (patch) | |
tree | 654e40360db9b6bb67928b3a5c1b5dbd84925000 /crypto/openssh/packet.c | |
parent | 2276ee273397e0ccd5c7911848e3de9bd91fb1c2 (diff) | |
parent | a9c7316f0b012b7e85d1a1c4d8b6ce36b9fd9604 (diff) | |
download | FreeBSD-src-038442ad80c21a07c19532a176030e2ca51fdd9d.zip FreeBSD-src-038442ad80c21a07c19532a176030e2ca51fdd9d.tar.gz |
Upgrade to OpenSSH 5.9p1.
MFC after: 3 months
Diffstat (limited to 'crypto/openssh/packet.c')
-rw-r--r-- | crypto/openssh/packet.c | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/crypto/openssh/packet.c b/crypto/openssh/packet.c index 6f2bdc3..8e8a297 100644 --- a/crypto/openssh/packet.c +++ b/crypto/openssh/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 $ */ /* $FreeBSD$ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> @@ -426,10 +426,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); @@ -443,9 +441,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. */ @@ -1756,16 +1754,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. */ |