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
f25a9c83
Commit
f25a9c83
authored
Jan 21, 2016
by
Constantin Rack
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1723 from GreatFruitOmsk/master
Family is not set when resolving NIC on android.
parents
cfbeac6a
6c997477
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
8 deletions
+27
-8
tcp_address.cpp
src/tcp_address.cpp
+27
-8
No files found.
src/tcp_address.cpp
View file @
f25a9c83
...
...
@@ -124,11 +124,17 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_, bool is_
int
zmq
::
tcp_address_t
::
resolve_nic_name
(
const
char
*
nic_
,
bool
ipv6_
,
bool
is_src_
)
{
// TODO: Unused parameter, IPv6 support not implemented for AIX or HP/UX.
LIBZMQ_UNUSED
(
ipv6_
);
#if defined ZMQ_HAVE_AIX || defined ZMQ_HAVE_HPUX
// IPv6 support not implemented for AIX or HP/UX.
if
(
ipv6_
)
{
errno
=
ENODEV
;
return
-
1
;
}
#endif
// Create a socket.
const
int
sd
=
open_socket
(
AF_INET
,
SOCK_DGRAM
,
0
);
const
int
sd
=
open_socket
(
ipv6_
?
AF_INET6
:
AF_INET
,
SOCK_DGRAM
,
0
);
errno_assert
(
sd
!=
-
1
);
struct
ifreq
ifr
;
...
...
@@ -146,12 +152,25 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_, bool is_
errno
=
ENODEV
;
return
-
1
;
}
if
(
is_src_
)
memcpy
(
&
source_address
.
ipv4
.
sin_addr
,
&
((
sockaddr_in
*
)
&
ifr
.
ifr_addr
)
->
sin_addr
,
sizeof
(
struct
in_addr
));
const
int
family
=
ifr
.
ifr_addr
.
sa_family
;
if
((
family
==
AF_INET
||
(
ipv6_
&&
family
==
AF_INET6
))
&&
!
strcmp
(
nic_
,
ifr
.
ifr_name
))
{
if
(
is_src_
)
memcpy
(
&
source_address
,
&
ifr
.
ifr_addr
,
(
family
==
AF_INET
)
?
sizeof
(
struct
sockaddr_in
)
:
sizeof
(
struct
sockaddr_in6
));
else
memcpy
(
&
address
,
&
ifr
.
ifr_addr
,
(
family
==
AF_INET
)
?
sizeof
(
struct
sockaddr_in
)
:
sizeof
(
struct
sockaddr_in6
));
}
else
memcpy
(
&
address
.
ipv4
.
sin_addr
,
&
((
sockaddr_in
*
)
&
ifr
.
ifr_addr
)
->
sin_addr
,
sizeof
(
struct
in_addr
));
{
errno
=
ENODEV
;
return
-
1
;
}
return
0
;
}
...
...
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