Merge pull request #71 from jagerman/disable-ipv6

Disable IPv6 by default
This commit is contained in:
Jason Rhinelander 2021-12-02 19:06:50 -04:00 committed by GitHub
commit 3d178ce3ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View File

@ -17,7 +17,7 @@ cmake_minimum_required(VERSION 3.7)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "macOS deployment target (Apple clang only)")
project(liboxenmq
VERSION 1.2.9
VERSION 1.2.10
LANGUAGES CXX C)
include(GNUInstallDirs)

View File

@ -40,7 +40,9 @@ void OxenMQ::setup_external_socket(zmq::socket_t& socket) {
socket.set(zmq::sockopt::reconnect_ivl_max, (int) RECONNECT_INTERVAL_MAX.count());
socket.set(zmq::sockopt::handshake_ivl, (int) HANDSHAKE_TIME.count());
socket.set(zmq::sockopt::maxmsgsize, MAX_MSG_SIZE);
socket.set(zmq::sockopt::ipv6, 1);
if (IPV6)
socket.set(zmq::sockopt::ipv6, 1);
if (CONN_HEARTBEAT > 0s) {
socket.set(zmq::sockopt::heartbeat_ivl, (int) CONN_HEARTBEAT.count());
if (CONN_HEARTBEAT_TIMEOUT > 0s)

View File

@ -296,6 +296,15 @@ public:
*/
int SOCKET_UID = -1;
/** If true then enable IPv6 connectivity on incoming/outgoing sockets. This is disabled by
* default because enabling it in libzmq breaks IPv4-only clients trying to connect to
* dual-stack IPv6+IPv4 hosts by hostname (the client will *only* try IPv6 if it finds an IPv6
* address, even if it has no IPv6 connectivity).
*
* This only has an effect for sockets created *after* it is changed.
*/
bool IPV6 = false;
/// A special TaggedThreadID value that always refers to the proxy thread; the main use of this is
/// to direct very simple batch completion jobs to be executed directly in the proxy thread.
inline static constexpr TaggedThreadID run_in_proxy{-1};