- (djm) Bug #180: Set ToS bits on IPv4-in-IPv6 mapped addresses. Based on
   patch from openssh@misc.tecq.org
diff --git a/packet.c b/packet.c
index fcd47cb..258085d 100644
--- a/packet.c
+++ b/packet.c
@@ -277,9 +277,14 @@
 	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. */