NetBSD Problem Report #9458
Received: (qmail 22095 invoked from network); 21 Feb 2000 07:37:22 -0000
Message-Id: <200002210736.QAA27932@een.sat.t.u-tokyo.ac.jp>
Date: Mon, 21 Feb 2000 16:36:31 +0900 (JST)
From: IWAMOTO Toshihiro <iwamoto@sat.t.u-tokyo.ac.jp>
Reply-To: IWAMOTO Toshihiro <iwamoto@sat.t.u-tokyo.ac.jp>
To: gnats-bugs@gnats.netbsd.org
Subject: editors/emacs doesn't fallback to IPv4 services
X-Send-Pr-Version: 3.95
>Number: 9458
>Category: pkg
>Synopsis: editors/emacs doesn't fallback to IPv4 services
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: pkg-manager
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Feb 20 23:39:00 +0000 2000
>Closed-Date: Thu Mar 16 15:41:25 +0000 2000
>Last-Modified: Thu Mar 16 15:45:47 +0000 2000
>Originator:
>Release: NetBSD-current/20000220
>Organization:
Univ. of Tokyo
>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 */
>Release-Note:
>Audit-Trail:
From: minoura@netbsd.org (MINOURA Makoto)
To: IWAMOTO Toshihiro <iwamoto@sat.t.u-tokyo.ac.jp>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: pkg/9458: editors/emacs doesn't fallback to IPv4 services
Date: 02 Mar 2000 23:10:54 +0900
|> In <200002210736.QAA27932@een.sat.t.u-tokyo.ac.jp>
|> IT = IWAMOTO Toshihiro <iwamoto@sat.t.u-tokyo.ac.jp> wrote:
IT> >Synopsis: editors/emacs doesn't fallback to IPv4 services
Recent changes of mine should fix this problem.
Right?
--
Minoura Makoto <minoura@netbsd.org> or <minoura@kw.netlaputa.ne.jp>
From: IWAMOTO Toshihiro <iwamoto@sat.t.u-tokyo.ac.jp>
To: minoura@netbsd.org
Cc: iwamoto@sat.t.u-tokyo.ac.jp, gnats-bugs@gnats.netbsd.org
Subject: Re: pkg/9458: editors/emacs doesn't fallback to IPv4 services
Date: Thu, 02 Mar 2000 23:39:39 +0900
At 02 Mar 2000 23:10:54 +0900,
MINOURA Makoto <minoura@netbsd.org> wrote:
> |> In <200002210736.QAA27932@een.sat.t.u-tokyo.ac.jp>
> |> IT = IWAMOTO Toshihiro <iwamoto@sat.t.u-tokyo.ac.jp> wrote:
>
> IT> >Synopsis: editors/emacs doesn't fallback to IPv4 services
>
> Recent changes of mine should fix this problem.
> Right?
We must exit from "address loop" immediately after a successful
connection, or there will be duplicate network connections if the peer
supports both v4 and v6 connection.
Although I didn't tested your code, your fix seems to be wrong. Did
you try "netstat" after a open-network-stream call? Aren't there
appearing duplicate network connections for single function call?
--- src/process.c.orig Thu Jul 8 00:36:24 1999
+++ src/process.c Sun Feb 27 16:03:33 2000
[snip]
@@ -1846,6 +1882,84 @@
[snip]
+ for (lres = res; lres ; lres = lres->ai_next){ /* address loop */
[snip]
+ if (connect(s, lres->ai_addr, lres->ai_addrlen) == -1
+ && errno != EISCONN)
+ {
[snip]
+ if (lres == NULL) {
+
+ if (interrupt_input)
+ request_sigio ();
+
+ errno = saved_errno;
+ report_file_error ("connection failed",
+ Fcons (host, Fcons (name, Qnil)));
+ }
+ }
There should be a break sentence here.
+ } /* address loop */
Regards,
IWAMOTO Toshihiro
From: minoura@netbsd.org (MINOURA Makoto)
To: IWAMOTO Toshihiro <iwamoto@sat.t.u-tokyo.ac.jp>
Cc: gnats-bugs@netbsd.org
Subject: Re: pkg/9458: editors/emacs doesn't fallback to IPv4 services
Date: 03 Mar 2000 23:21:45 +0900
|> In <y9j66v5phas.wl@vega.sat.t.u-tokyo.ac.jp>
|> IT = IWAMOTO Toshihiro <iwamoto@sat.t.u-tokyo.ac.jp> wrote:
IT> Although I didn't tested your code, your fix seems to be wrong. Did
IT> you try "netstat" after a open-network-stream call? Aren't there
IT> appearing duplicate network connections for single function call?
You are right.
I'll try your patch. Thanks.
--
Minoura Makoto <minoura@netbsd.org> or <minoura@kw.netlaputa.ne.jp>
State-Changed-From-To: open->feedback
State-Changed-By: minoura
State-Changed-When: Thu Mar 9 08:01:11 PST 2000
State-Changed-Why:
Should be fixed with the patch made by Love <lha@stacken.kth.se>,
with a fix by the originator.
State-Changed-From-To: feedback->closed
State-Changed-By: minoura
State-Changed-When: Thu Mar 16 07:41:25 PST 2000
State-Changed-Why:
Replaced the patch with the one included in the PR, correcting
insufficient error handling.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.