[zeromq-dev] [PATCH] Use strrchr to ensure we split off the last colon for the service port, IPv6 addresses have colons and will produce invalid data for the getaddrinfo lookup.

Gaspard Bucher gaspard at teti.ch
Wed Jun 29 23:49:17 CEST 2011


While we are on the IPv6 subject, are there any plans on supporting these
addresses ?

I get some zmq_connect assertion failures that originate from ip.cpp
"resolve_ip_hostname". The problem comes from transient networking states
where IPv6 is set but not IPv4 (as it seems).

I did some testing with a custom made ip resolution C program and during
these transitions, local domains like "gaspard.local." have an IPv6 but no
IPv4.

I could use a workaround by not dying on the zmq failure and keep retrying
until IPv4 is back up.

On the fun side of things, I tested lubyk's latency by creating a network
loop with PUSH/PULL sockets: http://lubyk.org/366

Cheers !

Gaspard

On Wed, Jun 29, 2011 at 11:28 PM, Andrew Thompson <andy at fud.org.nz> wrote:

> Signed-off-by: Andrew Thompson <andy at fud.org.nz>
> ---
>  src/ip.cpp |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/ip.cpp b/src/ip.cpp
> index a63a97d..6493327 100644
> --- a/src/ip.cpp
> +++ b/src/ip.cpp
> @@ -274,7 +274,7 @@ int zmq::resolve_ip_hostname (sockaddr_storage *addr_,
> socklen_t *addr_len_,
>     const char *hostname_)
>  {
>     //  Find the ':' that separates hostname name from service.
> -    const char *delimiter = strchr (hostname_, ':');
> +    const char *delimiter = strrchr (hostname_, ':');
>     if (!delimiter) {
>         errno = EINVAL;
>         return -1;
> --
> 1.7.4.1
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110629/46ad5f19/attachment.htm>


More information about the zeromq-dev mailing list