From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19569 invoked by alias); 12 Feb 2014 20:10:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 19559 invoked by uid 89); 12 Feb 2014 20:10:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Feb 2014 20:10:15 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1CKABCL013624 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 12 Feb 2014 15:10:11 -0500 Received: from host2.jankratochvil.net (ovpn-116-93.ams2.redhat.com [10.36.116.93]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s1CKA2Ke032679 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 12 Feb 2014 15:10:05 -0500 Date: Wed, 12 Feb 2014 20:10:00 -0000 From: Jan Kratochvil To: Paul Fertser Cc: Eli Zaretskii , gdb-patches@sourceware.org, ktietz@redhat.com Subject: Re: [PATCH v3] Add IPv6 support for outgoing remote TCP connections Message-ID: <20140212201002.GA26835@host2.jankratochvil.net> References: <20140210195758.GA16956@host2.jankratochvil.net> <1392148089-18253-1-git-send-email-fercerpav@gmail.com> <20140212165318.GA8969@host2.jankratochvil.net> <20140212173205.GC26683@home.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140212173205.GC26683@home.lan> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2014-02/txt/msg00436.txt.bz2 Hi Paul, On Wed, 12 Feb 2014 18:32:05 +0100, Paul Fertser wrote: > On Wed, Feb 12, 2014 at 05:53:18PM +0100, Jan Kratochvil wrote: > > > +AC_SEARCH_LIBS(getaddrinfo, [socket network net], [], [], [-lnsl]) > > > > Where is it stated in gnulib? I could not find it. > > http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=m4/getaddrinfo.m4;h=2e66584865e9b45c201219071a5abc454ef43937;hb=HEAD#l21 > > -lnsl is needed per Oracle getaddrinfo man page. Thanks, fine with it now. > > > + for (rp = result; ; rp = rp->ai_next ? rp->ai_next : result) > > > + { > > > + scb->fd = gdb_socket_cloexec (rp->ai_family, rp->ai_socktype, > > > + rp->ai_protocol); > > > > > > - if (scb->fd == -1) > > > - return -1; > > > + if (scb->fd == -1) > > > + continue; > > > > Neither 'return -1' nor 'continue' are right here. It should not lock-up if > > none of the sockets can be created, it should return so that the error gets > > reported. > > Indeed, thank you for spotting this! So can it be fprintf_unfiltered + > return -1 here? Currently I think it should do: any_socket_opened = 0; for (rp = result; ; rp = rp->ai_next ? rp->ai_next : result) { scb->fd = gdb_socket_cloexec (...); if (scb->fd == -1) { if (rp->ai_next == NULL && (!any_socket_opened || !tcp_auto_retry)) return -1; continue; } any_socket_opened = 1; [...] } It is not perfect for the case if (rp->ai_next == NULL && any_socket_opened && !tcp_auto_retry) as errno will be returned from the failed gdb_socket_cloexec() while it would be more appropriate to return errno from formerly failed connect(). But I do not think it matters too much, sure it can be also fixed. But that "return -1" part also depends on the requested gai_strerror() implementation - currently the caller always calls perror_with_name() which will be no longer right with gai_strerror(). I also think that it does not behave correctly now with: set tcp auto-retry off It will abort on first IPv6 "connection refused" despite IMO it should still try even the IPv4 entry (although only once due to "set tcp auto-retry off"). > I'm still puzzled about native windows behaviour; at least when run > with wine this code I proposed performs differently compared to > GNU/Linux, but I think it is the case with the unmodified code too. I do not think the Wine run is too important. I was trying to use Wine to test the MinGW port before but I do not find the Wine run of MinGW GDB usable for too may other reasons. After the IPv6 patch gets finalized we can ask someone with native MS-Windows access to verify the behavior. Nice you have found this difference. Thanks, Jan