[Tcsh] [PATCH] REMOTEHOST causes hang with IPv6 addresses

Chuck Anderson cra at fea.st
Fri Feb 24 00:51:11 UTC 2023


Please consider applying this patch to fix DNS-related hangs on shell
initialization caused by IPv6 addresses in utmp.

See also https://bugzilla.redhat.com/show_bug.cgi?id=2173067

------------------------------------------------------------------------

Workaround DNS resolution hang with IPv6 remotehost on shell init

The REMOTEHOST implementation is splitting the remote host info from
utmp on the first colon.  As the comment indicates, it doesn't work
with IPv6 addresses.  Just #ifdef 0 out this code in the same
tradition of all the other #ifdef 0's spread throughout tcsh,
including an earlier one related to DNS resolution.  This patch
resolves a DNS hang when attempting to do a DNS lookup on a partial
IPv6 address during shell initialization.

	    /* Look for host:display.screen */
	    /*
	     * There is conflict with IPv6 address and X DISPLAY.  So,
	     * we assume there is no IPv6 address in utmp and don't
	     * touch here.
	     */
	    if ((sptr = strchr(name, ':')) != NULL)
		*sptr = '\0';

Signed-off-by: Chuck Anderson <cra at fea.st>

diff --git a/tc.func.c b/tc.func.c
index 1c1bf77..75aee55 100644
--- a/tc.func.c
+++ b/tc.func.c
@@ -1942,7 +1942,8 @@ getremotehost(int dest_fd)
 	if (name != NULL && *name != '\0' && *name != ':') {
 	    struct in_addr addr;
 	    char *sptr;
-
+	    sptr = name;
+#if 0
 	    /* Look for host:display.screen */
 	    /*
 	     * There is conflict with IPv6 address and X DISPLAY.  So,
@@ -1951,6 +1952,7 @@ getremotehost(int dest_fd)
 	     */
 	    if ((sptr = strchr(name, ':')) != NULL)
 		*sptr = '\0';
+#endif
 	    /* Leave IPv4 address as is */
 	    /*
 	     * we use inet_addr here, not inet_aton because many systems


More information about the Tcsh mailing list