Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
23d08c20
Commit
23d08c20
authored
Apr 07, 2016
by
Pieter Hintjens
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1888 from bluca/ipv6_downgrade
Problem: zmq_bind IPv4 fallback still tries IPv6
parents
82513060
9cf6f85a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
tcp_connecter.cpp
src/tcp_connecter.cpp
+14
-0
tcp_listener.cpp
src/tcp_listener.cpp
+3
-7
No files found.
src/tcp_connecter.cpp
View file @
23d08c20
...
...
@@ -271,6 +271,20 @@ int zmq::tcp_connecter_t::open ()
// Create the socket.
s
=
open_socket
(
tcp_addr
->
family
(),
SOCK_STREAM
,
IPPROTO_TCP
);
// IPv6 address family not supported, try automatic downgrade to IPv4.
if
(
s
==
-
1
&&
tcp_addr
->
family
()
==
AF_INET6
&&
errno
==
EAFNOSUPPORT
&&
options
.
ipv6
)
{
rc
=
addr
->
resolved
.
tcp_addr
->
resolve
(
addr
->
address
.
c_str
(),
false
,
false
);
if
(
rc
!=
0
)
{
LIBZMQ_DELETE
(
addr
->
resolved
.
tcp_addr
);
return
-
1
;
}
s
=
open_socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
}
#ifdef ZMQ_HAVE_WINDOWS
if
(
s
==
INVALID_SOCKET
)
{
errno
=
wsa_error_to_errno
(
WSAGetLastError
());
...
...
src/tcp_listener.cpp
View file @
23d08c20
...
...
@@ -178,19 +178,15 @@ int zmq::tcp_listener_t::set_address (const char *addr_)
// Create a listening socket.
s
=
open_socket
(
address
.
family
(),
SOCK_STREAM
,
IPPROTO_TCP
);
#ifdef ZMQ_HAVE_WINDOWS
if
(
s
==
INVALID_SOCKET
)
errno
=
wsa_error_to_errno
(
WSAGetLastError
());
#endif
// IPv6 address family not supported, try automatic downgrade to IPv4.
if
(
address
.
family
()
==
AF_INET6
if
(
s
==
-
1
&&
address
.
family
()
==
AF_INET6
&&
errno
==
EAFNOSUPPORT
&&
options
.
ipv6
)
{
rc
=
address
.
resolve
(
addr_
,
true
,
tru
e
);
rc
=
address
.
resolve
(
addr_
,
true
,
fals
e
);
if
(
rc
!=
0
)
return
rc
;
s
=
::
socket
(
address
.
family
()
,
SOCK_STREAM
,
IPPROTO_TCP
);
s
=
open_socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
}
#ifdef ZMQ_HAVE_WINDOWS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment