NetBSD Problem Report #47225
From www@NetBSD.org Wed Nov 21 09:27:28 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
by www.NetBSD.org (Postfix) with ESMTP id 2A6D363DCB2
for <gnats-bugs@gnats.NetBSD.org>; Wed, 21 Nov 2012 09:27:28 +0000 (UTC)
Message-Id: <20121121092727.73A8063DCB2@www.NetBSD.org>
Date: Wed, 21 Nov 2012 09:27:27 +0000 (UTC)
From: jungleji@gmail.com
Reply-To: jungleji@gmail.com
To: gnats-bugs@NetBSD.org
Subject: gnutls-cli do not resovle hostname with ipv4
X-Send-Pr-Version: www-1.0
>Number: 47225
>Category: pkg
>Synopsis: gnutls-cli do not resovle hostname with ipv4
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bsiegert
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Nov 21 09:30:01 +0000 2012
>Closed-Date: Thu Dec 10 20:13:45 +0000 2015
>Last-Modified: Thu Dec 10 20:13:45 +0000 2015
>Originator: Ji YongGang
>Release: NetBSD 6.0
>Organization:
>Environment:
NetBSD netbsd32 6.0 NetBSD 6.0 (GENERIC) #0: Mon Oct 22 14:50:20 HKT 2012 jungle@netbsd32:/usr/obj/sys/arch/i386/compile/GENERIC i386
>Description:
gnutls-cli command from gnutls(3.0.25) package only resolve hostname in ipv6, if ipv6 is unavailable, it will quit without try to resolve with ipv4.
>How-To-Repeat:
gnutls version:
$ gnutls-cli --version
gnutls-cli 3.0.25
Copyright (C) 2000-2012 Free Software Foundation, all rights reserved.
This is free software. It is licensed for use, modification and
redistribution under the terms of the
GNU General Public License, version 3 or later
<http://gnu.org/licenses/gpl.html>
please send bug reports to: bug-gnutls@gnu.org
Connect to gmail smtp server:
$ gnutls-cli -V -p 587 -s smtp.gmail.com
Error setting the x509 trust file
Resolving 'smtp.gmail.com'...
Connecting to '2a00:1450:400c:c00::6c:587'...
Cannot connect to smtp.gmail.com:587: No route to host
>Fix:
>Release-Note:
>Audit-Trail:
From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc:
Subject: Re: pkg/47225: gnutls-cli do not resovle hostname with ipv4
Date: Fri, 23 Nov 2012 14:36:41 +0100
On Wed, Nov 21, 2012 at 09:30:01AM +0000, jungleji@gmail.com wrote:
> >Number: 47225
> >Category: pkg
> >Synopsis: gnutls-cli do not resovle hostname with ipv4
...
> $ gnutls-cli --version
> gnutls-cli 3.0.25
> Copyright (C) 2000-2012 Free Software Foundation, all rights reserved.
> This is free software. It is licensed for use, modification and
> redistribution under the terms of the
> GNU General Public License, version 3 or later
> <http://gnu.org/licenses/gpl.html>
>
>
> please send bug reports to: bug-gnutls@gnu.org
>
>
> Connect to gmail smtp server:
>
> $ gnutls-cli -V -p 587 -s smtp.gmail.com
> Error setting the x509 trust file
> Resolving 'smtp.gmail.com'...
> Connecting to '2a00:1450:400c:c00::6c:587'...
> Cannot connect to smtp.gmail.com:587: No route to host
Please report this bug upstream. It seems that gnutls-cli is not
iterating over the available IPv{4,6} addresses.
Thomas
From: Ji YongGang <jungleji@gmail.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/47225: gnutls-cli do not resovle hostname with ipv4
Date: Wed, 28 Nov 2012 13:43:29 +0800
--Multipart_Wed_Nov_28_13:43:29_2012-1
Content-Type: text/plain; charset=US-ASCII
Upstream maintainer had been reported this issue:
http://lists.gnu.org/archive/html/gnutls-devel/2012-11/threads.html#00041
and fixed it in gnutls git HEAD.
I made a patch for gnutls-3.0.25 in current pkgsrc, see attachment,
and it works well now.
$ gnutls-cli -V -p 587 -s smtp.gmail.com
Error setting the x509 trust file
Resolving 'smtp.gmail.com'...
Connecting to '2a00:1450:4013:c01::6d:587'...
Cannot connect to 2a00:1450:4013:c01::6d:587: No route to host
Connecting to '74.125.136.108:587'...
- Simple Client Mode:
- Received[44]: 220 mx.google.com ESMTP u45sm38815070eep.0
quit
- Sent: 5 bytes
- Received[49]: 221 2.0.0 closing connection u45sm38815070eep.0
- Peer has closed the GnuTLS connection
--Multipart_Wed_Nov_28_13:43:29_2012-1
Content-Type: text/plain; type=patch; charset=US-ASCII
Content-Disposition: attachment; filename="gnutls-3.0.25.diff"
Content-Transfer-Encoding: 7bit
diff -ruN gnutls.orig/distinfo gnutls/distinfo
--- gnutls.orig/distinfo 2012-11-28 12:37:37.000000000 +0800
+++ gnutls/distinfo 2012-11-28 13:05:23.000000000 +0800
@@ -4,5 +4,9 @@
RMD160 (gnutls-3.0.25.tar.xz) = 9af7f5d35f6b0000c06f07e4ec749e9fd663843e
Size (gnutls-3.0.25.tar.xz) = 4657300 bytes
SHA1 (patch-ae) = 71fbbeb43ac1689fca6fec7f8348d8534c1dc38a
-SHA1 (patch-gl_stdio.in.h) = b5802da2cccddd6fab73bd39c49f7d62bef58464
-SHA1 (patch-lib_nettle_egd.c) = b7e9769e8c620519c43ca7b7481a558e9d389c68
+SHA1 (patch-gl_stdio.in.h) = 2dedbd5074feaf25ebc3606d93300f98ba21b989
+SHA1 (patch-lib_nettle_egd.c) = 1c3780674ac98c2eafba36f6724cb3b60a6c1447
+SHA1 (patch-src_cli.c) = 6302731771b5c986468bcece66f0101c433f1bc9
+SHA1 (patch-src_ocsptool-common.c) = 1391b75943ef523fdb84a8fdf7095ec6edaafe0d
+SHA1 (patch-src_socket.c) = 8a0dc13d32cd70453fb1d6f56ff4049eab1154cf
+SHA1 (patch-src_socket.h) = acaabe7b08b33da6c00313796c92ea12b1d27742
diff -ruN gnutls.orig/patches/patch-src_cli.c gnutls/patches/patch-src_cli.c
--- gnutls.orig/patches/patch-src_cli.c 1970-01-01 08:00:00.000000000 +0800
+++ gnutls/patches/patch-src_cli.c 2012-11-28 12:38:51.000000000 +0800
@@ -0,0 +1,20 @@
+$NetBSD$
+
+--- src/cli.c.orig 2012-10-04 16:58:25.000000000 +0000
++++ src/cli.c
+@@ -870,7 +870,6 @@ main (int argc, char **argv)
+ init_global_tls_stuff ();
+
+ socket_open (&hd, hostname, service, udp);
+- socket_connect (&hd);
+
+ hd.session = init_tls_session (hostname);
+ if (starttls)
+@@ -924,7 +923,6 @@ main (int argc, char **argv)
+ printf
+ ("\n\n- Connecting again- trying to resume previous session\n");
+ socket_open (&hd, hostname, service, udp);
+- socket_connect (&hd);
+ }
+ else
+ {
diff -ruN gnutls.orig/patches/patch-src_ocsptool-common.c gnutls/patches/patch-src_ocsptool-common.c
--- gnutls.orig/patches/patch-src_ocsptool-common.c 1970-01-01 08:00:00.000000000 +0800
+++ gnutls/patches/patch-src_ocsptool-common.c 2012-11-28 12:38:51.000000000 +0800
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- src/ocsptool-common.c.orig 2012-04-12 20:05:11.000000000 +0000
++++ src/ocsptool-common.c
+@@ -191,7 +191,6 @@ socket_st hd;
+ headers_size = strlen(headers);
+
+ socket_open(&hd, hostname, service, 0);
+- socket_connect (&hd);
+
+ socket_send(&hd, headers, headers_size);
+ socket_send(&hd, req.data, req.size);
diff -ruN gnutls.orig/patches/patch-src_socket.c gnutls/patches/patch-src_socket.c
--- gnutls.orig/patches/patch-src_socket.c 1970-01-01 08:00:00.000000000 +0800
+++ gnutls/patches/patch-src_socket.c 2012-11-28 13:05:52.000000000 +0800
@@ -0,0 +1,92 @@
+$NetBSD$
+
+--- src/socket.c.orig 2012-04-12 20:05:11.000000000 +0000
++++ src/socket.c
+@@ -121,22 +121,6 @@ socket_bye (socket_st * socket)
+ }
+
+ void
+-socket_connect (const socket_st * hd)
+-{
+- int err;
+-
+- printf ("Connecting to '%s:%s'...\n", hd->ip, hd->service);
+-
+- err = connect (hd->fd, hd->ptr->ai_addr, hd->ptr->ai_addrlen);
+- if (err < 0)
+- {
+- fprintf (stderr, "Cannot connect to %s:%s: %s\n", hd->hostname,
+- hd->service, strerror (errno));
+- exit (1);
+- }
+-}
+-
+-void
+ socket_open (socket_st * hd, const char *hostname, const char *service, int udp)
+ {
+ struct addrinfo hints, *res, *ptr;
+@@ -167,34 +151,46 @@ socket_open (socket_st * hd, const char
+ NI_NUMERICHOST | NI_NUMERICSERV)) != 0)
+ {
+ fprintf (stderr, "getnameinfo(): %s\n", gai_strerror (err));
+- freeaddrinfo (res);
+- exit (1);
++ continue;
++ }
++
++ if (hints.ai_socktype == SOCK_DGRAM)
++ {
++#if defined(IP_DONTFRAG)
++ int yes = 1;
++ if (setsockopt (sd, IPPROTO_IP, IP_DONTFRAG,
++ (const void *) &yes, sizeof (yes)) < 0)
++ perror ("setsockopt(IP_DF) failed");
++#elif defined(IP_MTU_DISCOVER)
++ int yes = IP_PMTUDISC_DO;
++ if (setsockopt(sd, IPPROTO_IP, IP_MTU_DISCOVER,
++ (const void*) &yes, sizeof (yes)) < 0)
++ perror ("setsockopt(IP_DF) failed");
++#endif
++ }
++
++ printf ("Connecting to '%s:%s'...\n", buffer, portname);
++
++ err = connect (sd, ptr->ai_addr, ptr->ai_addrlen);
++ if (err < 0)
++ {
++ fprintf (stderr, "Cannot connect to %s:%s: %s\n", buffer,
++ portname, strerror (errno));
++ continue;
+ }
+
+ break;
+ }
+
++ if (err != 0)
++ exit(1);
++
+ if (sd == -1)
+ {
+- fprintf (stderr, "socket(): %s\n", strerror (errno));
++ fprintf (stderr, "Could not find a supported socket\n");
+ exit (1);
+ }
+
+- if (hints.ai_socktype == SOCK_DGRAM)
+- {
+-#if defined(IP_DONTFRAG)
+- int yes = 1;
+- if (setsockopt (sd, IPPROTO_IP, IP_DONTFRAG,
+- (const void *) &yes, sizeof (yes)) < 0)
+- perror ("setsockopt(IP_DF) failed");
+-#elif defined(IP_MTU_DISCOVER)
+- int yes = IP_PMTUDISC_DO;
+- if (setsockopt(sd, IPPROTO_IP, IP_MTU_DISCOVER,
+- (const void*) &yes, sizeof (yes)) < 0)
+- perror ("setsockopt(IP_DF) failed");
+-#endif
+- }
+-
+ hd->secure = 0;
+ hd->fd = sd;
+ hd->hostname = strdup (hostname);
diff -ruN gnutls.orig/patches/patch-src_socket.h gnutls/patches/patch-src_socket.h
--- gnutls.orig/patches/patch-src_socket.h 1970-01-01 08:00:00.000000000 +0800
+++ gnutls/patches/patch-src_socket.h 2012-11-28 12:38:51.000000000 +0800
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- src/socket.h.orig 2012-04-12 20:05:11.000000000 +0000
++++ src/socket.h
+@@ -16,7 +16,6 @@ ssize_t socket_recv (const socket_st * s
+ ssize_t socket_send (const socket_st * socket, const void *buffer,
+ int buffer_size);
+ void socket_open (socket_st * hd, const char *hostname, const char *service, int udp);
+-void socket_connect (const socket_st * hd);
+ void socket_bye (socket_st * socket);
+
+ void sockets_init (void);
--Multipart_Wed_Nov_28_13:43:29_2012-1--
Responsible-Changed-From-To: pkg-manager->bsiegert
Responsible-Changed-By: bsiegert@NetBSD.org
Responsible-Changed-When: Sat, 08 Aug 2015 13:03:08 +0000
Responsible-Changed-Why:
State-Changed-From-To: open->feedback
State-Changed-By: bsiegert@NetBSD.org
State-Changed-When: Sat, 08 Aug 2015 13:03:08 +0000
State-Changed-Why:
gnutls is at 3.3.15 now. Does the problem still occur?
State-Changed-From-To: feedback->closed
State-Changed-By: bsiegert@NetBSD.org
State-Changed-When: Thu, 10 Dec 2015 20:13:45 +0000
State-Changed-Why:
Feedback timeout, and the previous comments suggest that this is fixed.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.