Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6 Link-local addresses don`t work on Linux systems #4108

Closed
stanmcs opened this issue Dec 22, 2020 · 1 comment · Fixed by #4109
Closed

IPv6 Link-local addresses don`t work on Linux systems #4108

stanmcs opened this issue Dec 22, 2020 · 1 comment · Fixed by #4109

Comments

@stanmcs
Copy link

stanmcs commented Dec 22, 2020

Issue description

Fix in #3716 introduces new problem in ZeroMq 4.3.3.
It is not possible to connect by using IPv6 link-local address.

Part of ip_resolver.cpp

unsigned int zmq::ip_resolver_t::do_if_nametoindex (const char *ifname_)
{
#if _WIN32_WINNT > _WIN32_WINNT_WINXP && !defined ZMQ_HAVE_WINDOWS_UWP         \
  && !defined ZMQ_HAVE_VXWORKS
    return if_nametoindex (ifname_);
#else
    LIBZMQ_UNUSED (ifname_);
    // The function 'if_nametoindex' is not supported on Windows XP.
    // If we are targeting XP using a vxxx_xp toolset then fail.
    // This is brutal as this code could be run on later windows clients
    // meaning the IPv6 zone_id cannot have an interface name.
    // This could be fixed with a runtime check.
    return 0;
#endif
}

Probably bug is also present in udp_address.cpp

#if _WIN32_WINNT > _WIN32_WINNT_WINXP && !defined ZMQ_HAVE_WINDOWS_UWP         \
  && !defined ZMQ_HAVE_VXWORKS
            _bind_interface = if_nametoindex (src_name.c_str ());
            if (_bind_interface == 0) {
                //  Error, probably not an interface name.
                _bind_interface = -1;
            }
#endif

Environment

  • libzmq version 4.3.3
  • OS: Ubuntu 20.04

Minimal test code / Steps to reproduce the issue

Use zmq_connect with IPv6 link local address like:

zmq_connect (requester, "tcp://[fe80::213:b4ff:feff:ff02%br-9bd5d0e6c8ca]:1234")

Its not possible to connect on Linux systems.

What's the actual result? (include assertion message & call stack if applicable)

Function do_if_nametoindex always returns 0.

What's the expected result?

Function do_if_nametoindex should return network interface ID.

@bluca
Copy link
Member

bluca commented Dec 23, 2020

Could you send a PR to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants