On Wed, Nov 19, 2014 at 11:07:31PM +0100, [email protected] wrote:
>
> I will try tommorow
Thank you.
> But if you have Win7pro install xpmode ;)
I don't. Actually, my only Windows system is a virtual machine with
Windows XP. But I don't have any development tools on it, I'm only using
it to update maps in my TomTom GPS.
BtW, I found that on Linux with IPv6 supported but disabled in kernel
(either via sysctl or kernel command line parameter), glibc version of
getaddrinfo() returns EAI_NONAME. So current version of the patch
(attached) uses
(n == EAI_FAMILY || n == EAI_ADDRFAMILY ||
(!host_str && n == EAI_NONAME))
Hopefully this will catch all cases of missing/disabled IPv6 (and
nothing it shouldn't).
Michal Kubecek
>From 14ba01488a207d2f5006239ffe856b064e02e131 Mon Sep 17 00:00:00 2001
From: Michal Kubecek <[email protected]>
Date: Wed, 19 Nov 2014 12:40:53 +0100
Subject: [PATCH] Fix server address resolution on systems without IPv6
support.
We should only use AF_INET6 in getaddrinfo() hints if host string is
empty (so that we are listening on a wildcard address. If host string is
non-empty, let getaddrinfo() decide suitable address family. As a bonus,
this prevents server from binding to v6-mapped address if an IPv4
address is used for RemotBindAddress configuration directive.
Also fall back to AF_UNSPEC if getaddrinfo() fails with error code which
may be caused by IPv6 support missing or disabled.
---
src/remote/inet.cpp | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/src/remote/inet.cpp b/src/remote/inet.cpp
index 3696ef7..dff717b 100644
--- a/src/remote/inet.cpp
+++ b/src/remote/inet.cpp
@@ -869,7 +869,7 @@ rem_port* INET_connect(const TEXT* name,
// Prepare hints
struct addrinfo gai_hints;
memset(&gai_hints, 0, sizeof(gai_hints));
- gai_hints.ai_family = (packet ? AF_UNSPEC : AF_INET6);
+ gai_hints.ai_family = ((packet || host.hasData()) ? AF_UNSPEC : AF_INET6);
gai_hints.ai_socktype = SOCK_STREAM;
#ifndef WIN_NT
@@ -882,14 +882,28 @@ rem_port* INET_connect(const TEXT* name,
const char* host_str = (host.hasData() ? host.c_str() : NULL);
struct addrinfo* gai_result;
- int n = getaddrinfo(host_str, protocol.c_str(), &gai_hints, &gai_result);
+ bool retry_gai;
+ int n;
- if (n && (protocol == FB_SERVICE_NAME))
+ do
{
- // Try hard-wired translation of "gds_db" to "3050"
- protocol.printf("%hu", FB_SERVICE_PORT);
+ retry_gai = false;
n = getaddrinfo(host_str, protocol.c_str(), &gai_hints, &gai_result);
- }
+
+ if ((n == EAI_FAMILY || n == EAI_ADDRFAMILY || (!host_str && n == EAI_NONAME)) &&
+ (gai_hints.ai_family == AF_INET6))
+ {
+ // May be on a system without IPv6 support, try IPv4
+ gai_hints.ai_family = AF_UNSPEC;
+ retry_gai = true;
+ }
+ if ((n == EAI_SERVICE) && (protocol == FB_SERVICE_NAME))
+ {
+ // Try hard-wired translation of "gds_db" to "3050"
+ protocol.printf("%hu", FB_SERVICE_PORT);
+ retry_gai = true;
+ }
+ } while (retry_gai);
if (n)
{
--
1.8.4.5
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel