Subject: pkg/9458: editors/emacs doesn't fallback to IPv4 services
To: None <gnats-bugs@gnats.netbsd.org>
From: IWAMOTO Toshihiro <iwamoto@sat.t.u-tokyo.ac.jp>
List: netbsd-bugs
Date: 02/20/2000 23:39:46
>Number:         9458
>Category:       pkg
>Synopsis:       editors/emacs doesn't fallback to IPv4 services
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager (NetBSD software packages system bug manager)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 20 23:39:00 2000
>Last-Modified:
>Originator:     
>Organization:
Univ. of Tokyo
>Release:        NetBSD-current/20000220
>Environment:
	
System: NetBSD een.sat.t.u-tokyo.ac.jp 1.4S NetBSD 1.4S (EEN) #3: Thu Feb 17 19:25:49 JST 2000 iwamoto@een.sat.t.u-tokyo.ac.jp:/usr/src/syssrc/sys/arch/i386/compile/EEN i386


>Description:
	emacs doesn't fallback to IPv4 service port when a service
	is listening on IPv4 only. While pkgsrc's IPv6 patch seems
	to have something like a fallback action, this doesn't work.
>How-To-Repeat:
	Try to establish a TCP connection to a host with IPv6 address
	but listening in IPv4 only:
	(open-network-stream "hoge" nil "v6.capable.host" "v4-only-service")
>Fix:
	The following patch is against pkgsrc-patched process.c
--- emacs-20.5/src/process.c.pkgsrc     Fri Feb 18 15:48:12 2000
+++ emacs-20.5/src/process.c    Mon Feb 21 16:08:37 2000
@@ -1905,7 +1905,8 @@
       immediate_quit = 0;
   }

-  for (lres = res; lres ; lres = lres->ai_next){ /* address loop */
+  lres = res;
+  addrloop: /* address loop */
       s = socket(lres->ai_family, lres->ai_socktype, lres->ai_protocol);
       if (s < 0)
         report_file_error ("error creating socket", Fcons (name, Qnil));
@@ -1948,11 +1949,15 @@
             if (interrupt_input)
                 request_sigio ();

+            if (lres->ai_next) {
+                lres = lres->ai_next;
+                goto addrloop;
+            }
+
             errno = xerrno;
             report_file_error ("connection failed",
                                Fcons (host, Fcons (name, Qnil)));
         }
-  } /* address loop */
   freeaddrinfo(res);
 #else /* HAVE_GETADDRINFO */

>Audit-Trail:
>Unformatted: