|
From: <mku...@us...> - 2014-11-12 17:31:06
|
Revision: 60219
http://sourceforge.net/p/firebird/code/60219
Author: mkubecek
Date: 2014-11-12 17:31:01 +0000 (Wed, 12 Nov 2014)
Log Message:
-----------
Improvement CORE-3226: IPv6 support (8/9) add config directive for IPV6_V6ONLY socket option
Modified Paths:
--------------
firebird/trunk/builds/install/misc/firebird.conf.in
firebird/trunk/src/common/config/config.cpp
firebird/trunk/src/common/config/config.h
firebird/trunk/src/remote/inet.cpp
Modified: firebird/trunk/builds/install/misc/firebird.conf.in
===================================================================
--- firebird/trunk/builds/install/misc/firebird.conf.in 2014-11-12 17:30:07 UTC (rev 60218)
+++ firebird/trunk/builds/install/misc/firebird.conf.in 2014-11-12 17:31:01 UTC (rev 60219)
@@ -638,6 +638,16 @@
#TcpNoNagle = 1
#
+# Allows setting of IPV6_V6ONLY socket option. If enabled, IPv6 sockets
+# allow only IPv6 communication and a separate socket must be used for
+# IPv4 and IPv6. Default is false on POSIX systems, true on Windows.
+# On Windows, "false" value can only be used since Windows Vista.
+#
+# Type: boolean
+#
+#IPv6V6Only = 0
+
+#
# Allows incoming connections to be bound to the IP address of a
# specific network card. It enables rejection of incoming connections
# through any other network interface except this one. By default,
Modified: firebird/trunk/src/common/config/config.cpp
===================================================================
--- firebird/trunk/src/common/config/config.cpp 2014-11-12 17:30:07 UTC (rev 60218)
+++ firebird/trunk/src/common/config/config.cpp 2014-11-12 17:31:01 UTC (rev 60219)
@@ -197,7 +197,8 @@
{TYPE_STRING, "WireCrypt", (ConfigValue) NULL},
{TYPE_STRING, "WireCryptPlugin", (ConfigValue) "Arc4"},
{TYPE_STRING, "KeyHolderPlugin", (ConfigValue) ""},
- {TYPE_BOOLEAN, "RemoteAccess", (ConfigValue) true}
+ {TYPE_BOOLEAN, "RemoteAccess", (ConfigValue) true},
+ {TYPE_BOOLEAN, "IPv6V6Only", (ConfigValue) false}
};
/******************************************************************************
@@ -438,6 +439,11 @@
return get<bool>(KEY_TCP_NO_NAGLE);
}
+bool Config::getIPv6V6Only() const
+{
+ return get<bool>(KEY_IPV6_V6ONLY);
+}
+
int Config::getDefaultDbCachePages() const
{
int rc = get<int>(KEY_DEFAULT_DB_CACHE_PAGES);
Modified: firebird/trunk/src/common/config/config.h
===================================================================
--- firebird/trunk/src/common/config/config.h 2014-11-12 17:30:07 UTC (rev 60218)
+++ firebird/trunk/src/common/config/config.h 2014-11-12 17:31:01 UTC (rev 60219)
@@ -135,6 +135,7 @@
KEY_PLUG_WIRE_CRYPT,
KEY_PLUG_KEY_HOLDER,
KEY_REMOTE_ACCESS,
+ KEY_IPV6_V6ONLY,
MAX_CONFIG_KEY // keep it last
};
@@ -228,6 +229,9 @@
// Disable Nagle algorithm
bool getTcpNoNagle() const;
+ // Let IPv6 socket accept only IPv6 packets
+ bool getIPv6V6Only() const;
+
// Default database cache size
int getDefaultDbCachePages() const;
Modified: firebird/trunk/src/remote/inet.cpp
===================================================================
--- firebird/trunk/src/remote/inet.cpp 2014-11-12 17:30:07 UTC (rev 60218)
+++ firebird/trunk/src/remote/inet.cpp 2014-11-12 17:31:01 UTC (rev 60219)
@@ -864,7 +864,15 @@
**************************************/
int n;
+ int ipv6_v6only = port->getPortConfig()->getIPv6V6Only() ? 1 : 0;
+ n = setsockopt(port->port_handle, IPPROTO_IPV6, IPV6_V6ONLY,
+ (SCHAR*) &ipv6_v6only, sizeof(ipv6_v6only));
+ if (n == -1)
+ {
+ gds__log("setsockopt: error setting IPV6_V6ONLY to %d", ipv6_v6only);
+ }
+
if (flag & SRVR_multi_client)
{
struct linger lingerInfo;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|