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
6853e3f9
Commit
6853e3f9
authored
Apr 09, 2017
by
Luca Boccassi
Committed by
GitHub
Apr 09, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2514 from lytboris/freebsd-enable-ai_v4mapped
re-enable AI_V4MAPPED on FreeBSD & DragonFlyBSD
parents
63e1984a
ef8b0c60
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
7 deletions
+22
-7
tcp_address.cpp
src/tcp_address.cpp
+22
-7
No files found.
src/tcp_address.cpp
View file @
6853e3f9
...
...
@@ -448,12 +448,10 @@ int zmq::tcp_address_t::resolve_interface (const char *interface_, bool ipv6_, b
// service-name irregularity due to indeterminate socktype.
req
.
ai_flags
=
AI_PASSIVE
|
AI_NUMERICHOST
;
#if defined AI_V4MAPPED
&& !defined ZMQ_HAVE_FREEBSD && !defined ZMQ_HAVE_DRAGONFLY
#if defined AI_V4MAPPED
// In this API we only require IPv4-mapped addresses when
// no native IPv6 interfaces are available (~AI_ALL).
// This saves an additional DNS roundtrip for IPv4 addresses.
// Note: While the AI_V4MAPPED flag is defined on FreeBSD system,
// it is not supported here. See libzmq issue #331.
if
(
req
.
ai_family
==
AF_INET6
)
req
.
ai_flags
|=
AI_V4MAPPED
;
#endif
...
...
@@ -463,6 +461,15 @@ int zmq::tcp_address_t::resolve_interface (const char *interface_, bool ipv6_, b
rc
=
getaddrinfo
(
interface_
,
NULL
,
&
req
,
&
res
);
#if defined AI_V4MAPPED
// Some OS do have AI_V4MAPPED defined but it is not supported in getaddrinfo()
// returning EAI_BADFLAGS. Detect this and retry
if
(
rc
==
EAI_BADFLAGS
&&
(
req
.
ai_flags
&
AI_V4MAPPED
))
{
req
.
ai_flags
&=
~
AI_V4MAPPED
;
rc
=
getaddrinfo
(
interface_
,
NULL
,
&
req
,
&
res
);
}
#endif
#if defined ZMQ_HAVE_WINDOWS
// Resolve specific case on Windows platform when using IPv4 address
// with ZMQ_IPv6 socket option.
...
...
@@ -509,12 +516,10 @@ int zmq::tcp_address_t::resolve_hostname (const char *hostname_, bool ipv6_, boo
// doesn't really matter, since it's not included in the addr-output.
req
.
ai_socktype
=
SOCK_STREAM
;
#if defined AI_V4MAPPED
&& !defined ZMQ_HAVE_FREEBSD && !defined ZMQ_HAVE_DRAGONFLY
#if defined AI_V4MAPPED
// In this API we only require IPv4-mapped addresses when
// no native IPv6 interfaces are available.
// This saves an additional DNS roundtrip for IPv4 addresses.
// Note: While the AI_V4MAPPED flag is defined on FreeBSD system,
// it is not supported here. See libzmq issue #331.
if
(
req
.
ai_family
==
AF_INET6
)
req
.
ai_flags
|=
AI_V4MAPPED
;
#endif
...
...
@@ -526,7 +531,17 @@ int zmq::tcp_address_t::resolve_hostname (const char *hostname_, bool ipv6_, boo
#else
addrinfo
*
res
;
#endif
const
int
rc
=
getaddrinfo
(
hostname_
,
NULL
,
&
req
,
&
res
);
int
rc
=
getaddrinfo
(
hostname_
,
NULL
,
&
req
,
&
res
);
#if defined AI_V4MAPPED
// Some OS do have AI_V4MAPPED defined but it is not supported in getaddrinfo()
// returning EAI_BADFLAGS. Detect this and retry
if
(
rc
==
EAI_BADFLAGS
&&
(
req
.
ai_flags
&
AI_V4MAPPED
))
{
req
.
ai_flags
&=
~
AI_V4MAPPED
;
rc
=
getaddrinfo
(
hostname_
,
NULL
,
&
req
,
&
res
);
}
#endif
if
(
rc
)
{
switch
(
rc
)
{
case
EAI_MEMORY
:
...
...
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