summaryrefslogtreecommitdiff
path: root/os
diff options
context:
space:
mode:
authorEgbert Eich <eich@suse.de>2004-01-29 08:08:57 +0000
committerEgbert Eich <eich@suse.de>2004-01-29 08:08:57 +0000
commit3c64b65d805915e5c5628663113c54c3e9c3013b (patch)
treedff84b1be15ae6a4658af2168ca50278bf044b5a /os
parent2ec70aa70133190ad31a83114fdb9a218e6aa8e6 (diff)
Importing vendor version xf86-012804-2330 on Thu Jan 29 00:06:33 PST 2004xf86-012804-2330
Diffstat (limited to 'os')
-rw-r--r--os/access.c59
-rw-r--r--os/utils.c20
-rw-r--r--os/xdmcp.c45
3 files changed, 99 insertions, 25 deletions
diff --git a/os/access.c b/os/access.c
index 77dcebe20..14b61839c 100644
--- a/os/access.c
+++ b/os/access.c
@@ -45,7 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
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 @@ DefineLocalHost:
#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 @@ DefineSelf (int fd)
#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 @@ DefineSelf (int fd)
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 @@ DefineSelf (int fd)
/*
* 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;
diff --git a/os/utils.c b/os/utils.c
index e01793604..924d97471 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -49,7 +49,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
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>
@@ -244,6 +244,7 @@ LockServer(void)
int lfd, i, haslock, l_pid, t;
char *tmppath = NULL;
int len;
+ char port[20];
if (nolock) return;
/*
@@ -258,13 +259,14 @@ LockServer(void)
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
@@ -359,7 +361,7 @@ LockServer(void)
*/
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.");
}
}
@@ -584,8 +586,10 @@ ProcessCommandLine(int argc, char *argv[])
defaultKeyboardControl.autoRepeat = TRUE;
-#ifdef PART_NET
- PartialNetwork = TRUE;
+#ifdef NO_PART_NET
+ PartialNetwork = FALSE;
+#else
+ PartialNetwork = TRUE;
#endif
for ( i = 1; i < argc; i++ )
diff --git a/os/xdmcp.c b/os/xdmcp.c
index d9aa52716..cbd43f45b 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -13,7 +13,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 */
@@ -758,14 +758,6 @@ XdmcpSelectHost(
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;
@@ -1161,7 +1153,7 @@ send_query_msg(void)
socketfd = xdmcpSocket6;
#endif
XdmcpFlush (socketfd, &buffer, (XdmcpNetaddr) &ManagerAddress,
- sizeof (ManagerAddress));
+ ManagerAddressLen);
}
}
@@ -1213,9 +1205,19 @@ send_request_msg(void)
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;
@@ -1246,8 +1248,27 @@ send_request_msg(void)
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@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);