diff options
Diffstat (limited to 'xhost.c')
-rw-r--r-- | xhost.c | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -394,11 +394,21 @@ change_host(Display *dpy, char *name, Bool add) name += 3; } if (family == FamilyWild && (cp = strchr(lname, ':'))) { - *cp = '\0'; - fprintf (stderr, "%s: unknown address family \"%s\"\n", - ProgramName, lname); - free(lname); - return 0; +#ifdef IPv6 + /* + * Check to see if inet_pton() can grok it as an IPv6 address + */ + if (inet_pton(AF_INET6, lname, &addr6.s6_addr) == 1) { + family = FamilyInternet6; + } else +#endif + { + *cp = '\0'; + fprintf (stderr, "%s: unknown address family \"%s\"\n", + ProgramName, lname); + free(lname); + return 0; + } } free(lname); |