[PATCH] XDMCP: For IPv6 add IPv6 link local addresses to the end of the list

Egbert Eich eich at freedesktop.org
Fri Feb 7 04:43:20 PST 2014


It would be nice if someone took a look at this issue. So far
noone has commented on this patch.

Cheers,
	Egbert.


On Wed, Aug 14, 2013 at 06:17:59PM +0200, Egbert Eich wrote:
> From: Reinhard Max <max at suse.de>
> 
> For IPv6 add a link local addresses to the end of the list passed to
> the XDMCP servers.
> Reason: for link local addresses the XDMCP server would need to either
> know the interface thru a scope identifier or try all available interfaces.
> If they don't this address will fail in which case the XDMCP server
> could still try the other addresses passed - however some only try
> the first address and then give up.
> Even if this seems to be the wrong place to fix this it seems to be
> easier than fixing all display servers.
> 
> Signed-off-by: Egbert Eich <eich at freedesktop.org>
> ---
>  os/access.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 45 insertions(+)
> 
> diff --git a/os/access.c b/os/access.c
> index 88a44d9..2767fe3 100644
> --- a/os/access.c
> +++ b/os/access.c
> @@ -505,6 +505,12 @@ DefineSelf(int fd)
>      unsigned char *addr;
>      int family;
>      register HOST *host;
> +    struct ipv6_locallink {
> +        unsigned char *addr;
> +        int len;
> +    } *linklocal_list = NULL;
> +    int num_linklocals = 0;
> +    int i;
>  
>  #ifndef HAVE_GETIFADDRS
>  
> @@ -602,6 +608,20 @@ DefineSelf(int fd)
>              else if (family == FamilyInternet6 &&
>                       IN6_IS_ADDR_LOOPBACK((struct in6_addr *) addr))
>                  continue;
> +            /* Register IPv6 link local addresses (fe80::/10) at the end,
> +             * because they need a scope identifier, which we have no way
> +             * of telling to the other end.
> +             */
> +
> +            if (family == FamilyInternet6 &&
> +                IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr)) {
> +                linklocal_list = realloc(linklocal_list,
> +                                         sizeof(struct ipv6_locallink)
> +                                         * ++num_linklocals);
> +                linklocal_list[num_linklocals - 1].len = len;
> +                linklocal_list[num_linklocals - 1].addr = addr;
> +                continue;
> +            }
>  #endif
>  
>              /*
> @@ -667,6 +687,11 @@ DefineSelf(int fd)
>          }
>  #endif                          /* XDMCP */
>      }
> +    for (i = 0; i < num_linklocals; i++)
> +        XdmcpRegisterConnection (FamilyInternet6,
> +                                 (char *)linklocal_list[i].addr,
> +                                 linklocal_list[i].len);
> +
>      if (bufptr != buf)
>          free(bufptr);
>  #else                           /* HAVE_GETIFADDRS */
> @@ -735,6 +760,19 @@ DefineSelf(int fd)
>              else if (family == FamilyInternet6 &&
>                       IN6_IS_ADDR_LOOPBACK((struct in6_addr *) addr))
>                  continue;
> +            /* Register IPv6 link local addresses (fe80::/10) at the end,
> +             * because they need a scope identifier, which we have no way
> +             * of telling to the other end.
> +             */
> +            if (family == FamilyInternet6 &&
> +                +IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr)) {
> +                linklocal_list = realloc(linklocal_list,
> +                                         sizeof(struct ipv6_locallink)
> +                                         * ++num_linklocals);
> +                linklocal_list[num_linklocals - 1].len = len;
> +                linklocal_list[num_linklocals - 1].addr = addr;
> +                continue;
> +            }
>  #endif
>              XdmcpRegisterConnection(family, (char *) addr, len);
>  #if defined(IPv6) && defined(AF_INET6)
> @@ -752,9 +790,16 @@ DefineSelf(int fd)
>  #endif                          /* XDMCP */
>  
>      }                           /* for */
> +
> +    for (i = 0; i < num_linklocals; i++)
> +        XdmcpRegisterConnection (FamilyInternet6,
> +                                 (char *)linklocal_list[i].addr,
> +                                 linklocal_list[i].len);
>      freeifaddrs(ifap);
>  #endif                          /* HAVE_GETIFADDRS */
>  
> +    free(linklocal_list);
> +
>      /*
>       * add something of FamilyLocalHost
>       */
> -- 
> 1.8.1.4


More information about the xorg-devel mailing list