[Bug 180] New: [PATCH] sshd sets no ToS bit on connections with IPv4-mapped IPv6 addresses

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Fri Mar 22 22:56:07 EST 2002


http://bugzilla.mindrot.org/show_bug.cgi?id=180

           Summary: [PATCH] sshd sets no ToS bit on connections with IPv4-
                    mapped IPv6 addresses
           Product: Portable OpenSSH
           Version: -current
          Platform: ix86
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: sshd
        AssignedTo: openssh-unix-dev at mindrot.org
        ReportedBy: openssh at misc.tecq.org


sshd recognises IPv4-mapped IPv6 addresses as non-IPv4 connections and therefore
does not set the ToS bit.

The following patch solves this problem. Compatibility checks with
kerberos-enabled systems may be needed.

--- openssh-3.1p1/packet.c      Tue Mar  5 02:31:29 2002
+++ openssh-3.1p1-v4inv6-ToS/packet.c   Thu Mar 21 13:43:01 2002
@@ -178,13 +178,24 @@
 {
        struct sockaddr_storage to;
        socklen_t tolen = sizeof(to);
+       struct sockaddr_in6 *to6;

        memset(&to, 0, sizeof(to));
        if (getsockname(connection_out, (struct sockaddr *)&to, &tolen) < 0)
                return 0;
-       if (to.ss_family != AF_INET)
+       switch (to.ss_family) {
+       case AF_INET:
+               return 1;
+#ifdef IPV4_IN_IPV6
+       case AF_INET6:
+               to6 = (struct sockaddr_in6 *)&to;
+               if (IN6_IS_ADDR_V4MAPPED(&to6->sin6_addr))
+                       return 1;
                return 0;
-       return 1;
+#endif
+       default:
+               return 0;
+       }
 }



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the openssh-unix-dev mailing list