From aa100c546c110c9d9f06ec67c8f28771a30f014b Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 26 Apr 2002 16:54:34 +1000 Subject: [PATCH] - (djm) Bug #180: Set ToS bits on IPv4-in-IPv6 mapped addresses. Based on patch from openssh@misc.tecq.org --- ChangeLog | 4 +++- packet.c | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d91fdfb1..da3c1e8da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ - (djm) Bug #137, #209: fix make problems for scard/Ssh.bin, do uudecode during distprep only - (djm) Disable PAM password expiry until a complete fix for bug #188 exists + - (djm) Bug #180: Set ToS bits on IPv4-in-IPv6 mapped addresses. Based on + patch from openssh@misc.tecq.org 20020425 - (stevesk) [defines.h] remove USE_TIMEVAL; unused @@ -513,4 +515,4 @@ - (stevesk) entropy.c: typo in debug message - (djm) ssh-keygen -i needs seeded RNG; report from markus@ -$Id: ChangeLog,v 1.2087 2002/04/26 01:27:24 djm Exp $ +$Id: ChangeLog,v 1.2088 2002/04/26 06:54:34 djm Exp $ diff --git a/packet.c b/packet.c index fcd47cbce..258085d29 100644 --- a/packet.c +++ b/packet.c @@ -277,9 +277,14 @@ packet_connection_is_ipv4(void) memset(&to, 0, sizeof(to)); if (getsockname(connection_out, (struct sockaddr *)&to, &tolen) < 0) return 0; - if (to.ss_family != AF_INET) - return 0; - return 1; + if (to.ss_family == AF_INET) + return 1; +#ifdef IPV4_IN_IPV6 + if (to.ss_family == AF_INET6 && + IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)&to)->sin6_addr)) + return 1; +#endif + return 0; } /* Sets the connection into non-blocking mode. */