#Bug 784: Ignore unconfigured interfaces with xdmcp

This commit is contained in:
Alexander Gottwald 2004-06-25 08:58:18 +00:00
parent c5ab3fdd92
commit 8bc0bc6d36

View File

@ -1,5 +1,5 @@
/* $Xorg: access.c,v 1.5 2001/02/09 02:05:23 xorgcvs Exp $ */ /* $Xorg: access.c,v 1.5 2001/02/09 02:05:23 xorgcvs Exp $ */
/* $XdotOrg: xc/programs/Xserver/os/access.c,v 1.1.4.3.2.3 2004/03/22 11:57:11 ago Exp $ */ /* $XdotOrg$ */
/*********************************************************** /***********************************************************
Copyright 1987, 1998 The Open Group Copyright 1987, 1998 The Open Group
@ -456,14 +456,24 @@ DefineSelf (int fd)
continue; continue;
/* /*
* ignore 'localhost' entries as they're not useful * Ignore 'localhost' entries as they're not useful
* on the other end of the wire * on the other end of the wire.
*/ */
if (len == 4 && if (len == 4 &&
addr[0] == 127 && addr[1] == 0 && addr[0] == 127 && addr[1] == 0 &&
addr[2] == 0 && addr[3] == 1) addr[2] == 0 && addr[3] == 1)
continue; continue;
/*
* Ignore '0.0.0.0' entries as they are
* returned by some OSes for unconfigured NICs but they are
* not useful on the other end of the wire.
*/
if (len == 4 &&
addr[0] == 0 && addr[1] == 0 &&
addr[2] == 0 && addr[3] == 0)
continue;
XdmcpRegisterConnection (family, (char *)addr, len); XdmcpRegisterConnection (family, (char *)addr, len);
@ -588,11 +598,15 @@ DefineSelf (int fd)
#ifdef XDMCP #ifdef XDMCP
/* /*
* If this is an Internet Address, but not the localhost * If this is an Internet Address, but not the localhost
* address (127.0.0.1), register it. * address (127.0.0.1), nor the bogus address (0.0.0.0),
* register it.
*/ */
if (family == FamilyInternet && if (family == FamilyInternet &&
!(len == 4 && addr[0] == 127 && addr[1] == 0 && !(len == 4 &&
addr[2] == 0 && addr[3] == 1) ((addr[0] == 127 && addr[1] == 0 &&
addr[2] == 0 && addr[3] == 1) ||
(addr[0] == 0 && addr[1] == 0 &&
addr[2] == 0 && addr[3] == 0)))
) )
{ {
XdmcpRegisterConnection (family, (char *)addr, len); XdmcpRegisterConnection (family, (char *)addr, len);
@ -857,6 +871,16 @@ DefineSelf (int fd)
continue; continue;
#endif #endif
/*
* Ignore '0.0.0.0' entries as they are
* returned by some OSes for unconfigured NICs but they are
* not useful on the other end of the wire.
*/
if (len == 4 &&
addr[0] == 0 && addr[1] == 0 &&
addr[2] == 0 && addr[3] == 0)
continue;
XdmcpRegisterConnection (family, (char *)addr, len); XdmcpRegisterConnection (family, (char *)addr, len);
#if defined(IPv6) && defined(AF_INET6) #if defined(IPv6) && defined(AF_INET6)
@ -979,6 +1003,7 @@ DefineSelf (int fd)
#endif #endif
) )
continue; continue;
/* /*
* ignore 'localhost' entries as they're not useful * ignore 'localhost' entries as they're not useful
* on the other end of the wire * on the other end of the wire
@ -990,6 +1015,16 @@ DefineSelf (int fd)
addr[0] == 127 && addr[1] == 0 && addr[0] == 127 && addr[1] == 0 &&
addr[2] == 0 && addr[3] == 1) addr[2] == 0 && addr[3] == 1)
continue; continue;
/*
* Ignore '0.0.0.0' entries as they are
* returned by some OSes for unconfigured NICs but they are
* not useful on the other end of the wire.
*/
if (len == 4 &&
addr[0] == 0 && addr[1] == 0 &&
addr[2] == 0 && addr[3] == 0)
continue;
#if defined(IPv6) && defined(AF_INET6) #if defined(IPv6) && defined(AF_INET6)
else if (family == FamilyInternet6 && else if (family == FamilyInternet6 &&
IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr)) IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr))