[Xorg-commit] xc/programs/Xserver/os access.c,1.1.4.2,1.1.4.3 utils.c,1.1.4.4,1.1.4.5 xdmcp.c,1.1.4.4,1.1.4.5

Kaleb Keithley xorg-commit at pdx.freedesktop.org
Wed May 9 17:30:30 EEST 2007


Committed by: kaleb

Update of /cvs/xorg/xc/programs/Xserver/os
In directory pdx:/home/kaleb/xorg/xc.XORG-CURRENT/programs/Xserver/os

Modified Files:
      Tag: XORG-CURRENT
	access.c utils.c xdmcp.c 
Log Message:
merge most of XFree86 RC3 (4.3.99.903) from vendor branch.
bug #214


Index: access.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/os/access.c,v
retrieving revision 1.1.4.2
retrieving revision 1.1.4.3
diff -u -d -r1.1.4.2 -r1.1.4.3
--- a/access.c	26 Nov 2003 22:49:06 -0000	1.1.4.2
+++ b/access.c	23 Feb 2004 21:37:27 -0000	1.1.4.3
@@ -45,7 +45,7 @@
 SOFTWARE.
 
 ******************************************************************/
-/* $XFree86: xc/programs/Xserver/os/access.c,v 3.50 2003/11/03 05:12:00 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/os/access.c,v 3.54 2004/01/03 17:38:39 herrb Exp $ */
 
 #ifdef WIN32
 #include <X11/Xwinsock.h>
@@ -645,6 +645,20 @@
 #include <arpa/inet.h>
 #endif
 
+#if defined(IPv6) && defined(AF_INET6)
+static void
+in6_fillscopeid(struct sockaddr_in6 *sin6)
+{
+#if defined(__KAME__)
+	if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
+		sin6->sin6_scope_id =
+			ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]);
+		sin6->sin6_addr.s6_addr[2] = sin6->sin6_addr.s6_addr[3] = 0;
+	}
+#endif
+}
+#endif
+
 void
 DefineSelf (int fd)
 {
@@ -761,6 +775,10 @@
 #endif /* DNETCONN */
         if (family == -1 || family == FamilyLocal)
 	    continue;
+#if defined(IPv6) && defined(AF_INET6)
+	if (family == FamilyInternet6) 
+	    in6_fillscopeid((struct sockaddr_in6 *)&IFR_IFR_ADDR);
+#endif
 #ifdef DEF_SELF_DEBUG
 	if (family == FamilyInternet) 
 	    ErrorF("Xserver: DefineSelf(): ifname = %s, addr = %d.%d.%d.%d\n",
@@ -898,10 +916,24 @@
 	family = ConvertAddr(ifr->ifa_addr, &len, (pointer *)&addr);
 	if (family == -1 || family == FamilyLocal) 
 	    continue;
+#if defined(IPv6) && defined(AF_INET6)
+	if (family == FamilyInternet6) 
+	    in6_fillscopeid((struct sockaddr_in6 *)ifr->ifa_addr);
+#endif
+
 #ifdef DEF_SELF_DEBUG
 	if (family == FamilyInternet) 
 	    ErrorF("Xserver: DefineSelf(): ifname = %s, addr = %d.%d.%d.%d\n",
 		   ifr->ifa_name, addr[0], addr[1], addr[2], addr[3]);
+#if defined(IPv6) && defined(AF_INET6)
+	else if (family == FamilyInternet6) {
+		char cp[INET6_ADDRSTRLEN];
+
+		inet_ntop(AF_INET6, addr, cp, sizeof(cp));
+		ErrorF("Xserver: DefineSelf(): ifname = %s addr = %s\n",
+		    ifr->ifa_name, cp);
+	}
+#endif
 #endif /* DEF_SELF_DEBUG */
 	for (host = selfhosts; 
 	     host != NULL && !addrEqual(family, addr, len, host);
@@ -923,17 +955,34 @@
 	    /*
 	     * If this isn't an Internet Address, don't register it.
 	     */
-	    if (family != FamilyInternet) 
+	    if (family != FamilyInternet
+#if defined(IPv6) && defined(AF_INET6)
+		&& family != FamilyInternet6
+#endif
+	    )
 		continue;
 	    /* 
-	     * ignore 'localhost' entries as they're not usefule
+	     * ignore 'localhost' entries as they're not useful
 	     * on the other end of the wire
 	     */
-	    if (len == 4 && 
+	    if (ifr->ifa_flags & IFF_LOOPBACK) 
+		    continue;
+
+	    if (family == FamilyInternet && 
 		addr[0] == 127 && addr[1] == 0 &&
-		addr[2] == 0 && addr[2] == 1) 
+		addr[2] == 0 && addr[3] == 1) 
+		continue;
+#if defined(IPv6) && defined(AF_INET6)
+	    else if (family == FamilyInternet6 && 
+	      IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr))
 		continue;
+#endif
 	    XdmcpRegisterConnection(family, (char *)addr, len);
+#if defined(IPv6) && defined(AF_INET6)
+	    if (family == FamilyInternet6) 
+		/* IPv6 doesn't support broadcasting, so we drop out here */
+		continue;
+#endif
 	    if ((ifr->ifa_flags & IFF_BROADCAST) &&
 		(ifr->ifa_flags & IFF_UP))
 		broad_addr = *ifr->ifa_broadaddr;

Index: utils.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/os/utils.c,v
retrieving revision 1.1.4.4
retrieving revision 1.1.4.5
diff -u -d -r1.1.4.4 -r1.1.4.5
--- a/utils.c	18 Dec 2003 19:29:15 -0000	1.1.4.4
+++ b/utils.c	23 Feb 2004 21:37:27 -0000	1.1.4.5
@@ -50,7 +50,7 @@
 OR PERFORMANCE OF THIS SOFTWARE.
 
 */
-/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.95 2003/10/01 18:36:38 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.97 2004/01/09 00:35:06 dawes Exp $ */
 
 #ifdef __CYGWIN__
 #include <stdlib.h>
@@ -245,6 +245,7 @@
   int lfd, i, haslock, l_pid, t;
   char *tmppath = NULL;
   int len;
+  char port[20];
 
   if (nolock) return;
   /*
@@ -259,13 +260,14 @@
     FatalError("No TMP dir found\n");
 #endif
 
+  sprintf(port, "%d", atoi(display));
   len = strlen(LOCK_PREFIX) > strlen(LOCK_TMP_PREFIX) ? strlen(LOCK_PREFIX) :
 						strlen(LOCK_TMP_PREFIX);
-  len += strlen(tmppath) + strlen(display) + strlen(LOCK_SUFFIX) + 1;
+  len += strlen(tmppath) + strlen(port) + strlen(LOCK_SUFFIX) + 1;
   if (len > sizeof(LockFile))
-    FatalError("Display name `%s' is too long\n", display);
-  (void)sprintf(tmp, "%s" LOCK_TMP_PREFIX "%s" LOCK_SUFFIX, tmppath, display);
-  (void)sprintf(LockFile, "%s" LOCK_PREFIX "%s" LOCK_SUFFIX, tmppath, display);
+    FatalError("Display name `%s' is too long\n", port);
+  (void)sprintf(tmp, "%s" LOCK_TMP_PREFIX "%s" LOCK_SUFFIX, tmppath, port);
+  (void)sprintf(LockFile, "%s" LOCK_PREFIX "%s" LOCK_SUFFIX, tmppath, port);
 
   /*
    * Create a temporary file containing our PID.  Attempt three times
@@ -360,7 +362,7 @@
          */
         unlink(tmp);
 	FatalError("Server is already active for display %s\n%s %s\n%s\n",
-		   display, "\tIf this server is no longer running, remove",
+		   port, "\tIf this server is no longer running, remove",
 		   LockFile, "\tand start again.");
       }
     }
@@ -585,8 +587,10 @@
 
     defaultKeyboardControl.autoRepeat = TRUE;
 
-#ifdef PART_NET
-	PartialNetwork = TRUE;
+#ifdef NO_PART_NET
+    PartialNetwork = FALSE;
+#else
+    PartialNetwork = TRUE;
 #endif
 
     for ( i = 1; i < argc; i++ )

Index: xdmcp.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/os/xdmcp.c,v
retrieving revision 1.1.4.4
retrieving revision 1.1.4.5
diff -u -d -r1.1.4.4 -r1.1.4.5
--- a/xdmcp.c	6 Dec 2003 13:24:29 -0000	1.1.4.4
+++ b/xdmcp.c	23 Feb 2004 21:37:27 -0000	1.1.4.5
@@ -14,7 +14,7 @@
  * without express or implied warranty.
  *
  */
-/* $XFree86: xc/programs/Xserver/os/xdmcp.c,v 3.29 2003/11/22 04:51:02 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/os/xdmcp.c,v 3.32 2004/01/01 17:09:29 herrb Exp $ */
 
 #ifdef WIN32
 /* avoid conflicting definitions */
@@ -759,14 +759,6 @@
     int			host_len,
     ARRAY8Ptr		AuthenticationName)
 {
-#if defined(IPv6) && defined(AF_INET6)
-    /* Don't need list of addresses for host anymore */
-    if (mgrAddrFirst != NULL) {
-	freeaddrinfo(mgrAddrFirst);
-	mgrAddrFirst = NULL;
-	mgrAddr = NULL;
-    }
-#endif
     state = XDM_START_CONNECTION;
     memmove(&req_sockaddr, host_sockaddr, host_len);
     req_socklen = host_len;
@@ -1162,7 +1154,7 @@
 	    socketfd = xdmcpSocket6;
 #endif	
 	XdmcpFlush (socketfd, &buffer, (XdmcpNetaddr) &ManagerAddress,
-		    sizeof (ManagerAddress));
+		    ManagerAddressLen);
     }
 }
 
@@ -1214,9 +1206,19 @@
     XdmcpHeader	    header;
     int		    length;
     int		    i;
+    CARD16	    XdmcpConnectionType;
     ARRAY8	    authenticationData;
     int		    socketfd = xdmcpSocket;
 
+    switch (SOCKADDR_FAMILY(ManagerAddress))
+    {
+    case AF_INET:	XdmcpConnectionType=FamilyInternet; break;
+#if defined(IPv6) && defined(AF_INET6)
+    case AF_INET6:	XdmcpConnectionType=FamilyInternet6; break;
+#endif
+    default:		XdmcpConnectionType=0xffff; break;
+    }
+
     header.version = XDM_PROTOCOL_VERSION;
     header.opcode = (CARD16) REQUEST;
 
@@ -1247,8 +1249,27 @@
 	return;
     }
     XdmcpWriteCARD16 (&buffer, DisplayNumber);
-    XdmcpWriteARRAY16 (&buffer, &ConnectionTypes);
-    XdmcpWriteARRAYofARRAY8 (&buffer, &ConnectionAddresses);
+    XdmcpWriteCARD8 (&buffer, ConnectionTypes.length);
+
+    /* The connection array is send reordered, so that connections of	*/
+    /* the same address type as the XDMCP manager connection are send	*/
+    /* first. This works around a bug in xdm. mario at klebsch.de 		*/
+    for (i = 0; i < (int)ConnectionTypes.length; i++)
+	if (ConnectionTypes.data[i]==XdmcpConnectionType)
+	    XdmcpWriteCARD16 (&buffer, ConnectionTypes.data[i]);
+    for (i = 0; i < (int)ConnectionTypes.length; i++)
+	if (ConnectionTypes.data[i]!=XdmcpConnectionType)
+	    XdmcpWriteCARD16 (&buffer, ConnectionTypes.data[i]);
+
+    XdmcpWriteCARD8 (&buffer, ConnectionAddresses.length);
+    for (i = 0; i < (int)ConnectionAddresses.length; i++)
+	if ( (i<ConnectionTypes.length) && 
+	     (ConnectionTypes.data[i]==XdmcpConnectionType) )
+	    XdmcpWriteARRAY8 (&buffer, &ConnectionAddresses.data[i]);
+    for (i = 0; i < (int)ConnectionAddresses.length; i++)
+	if ( (i>=ConnectionTypes.length) ||
+	     (ConnectionTypes.data[i]!=XdmcpConnectionType) )
+	    XdmcpWriteARRAY8 (&buffer, &ConnectionAddresses.data[i]);
 
     XdmcpWriteARRAY8 (&buffer, AuthenticationName);
     XdmcpWriteARRAY8 (&buffer, &authenticationData);





More information about the xorg-commit mailing list