Commit 53e5a9a6 authored by Luca Boccassi's avatar Luca Boccassi

Problem: zmq_connect with IPv6 "source:port;dest:port" format is broken

Solution: allow for '[' character when doing the basic sanity check
on the TCP endpoint.
Also add unit tests for both IPv4 and IPv6 source;dest format.
parent c1d07c6c
......@@ -843,7 +843,7 @@ int zmq::socket_base_t::connect (const char *addr_)
while (isalnum (*check)
|| isxdigit (*check)
|| *check == '.' || *check == '-' || *check == ':' || *check == '%'
|| *check == ';' || *check == ']' || *check == '_'
|| *check == ';' || *check == '[' || *check == ']' || *check == '_'
) {
check++;
}
......
......@@ -88,7 +88,7 @@ void test_multi_connect_ipv4 (void)
assert (rc == 0);
rc = zmq_connect (sc, "tcp://127.0.0.1:5561");
assert (rc == 0);
rc = zmq_connect (sc, "tcp://127.0.0.1:5562");
rc = zmq_connect (sc, "tcp://127.0.0.1:5564;127.0.0.1:5562");
assert (rc == 0);
bounce (sb0, sc);
......@@ -101,7 +101,7 @@ void test_multi_connect_ipv4 (void)
rc = zmq_disconnect (sc, "tcp://127.0.0.1:5560");
assert (rc == 0);
rc = zmq_disconnect (sc, "tcp://127.0.0.1:5562");
rc = zmq_disconnect (sc, "tcp://127.0.0.1:5564;127.0.0.1:5562");
assert (rc == 0);
rc = zmq_disconnect (sc, "tcp://127.0.0.1:5561");
assert (rc == 0);
......@@ -214,7 +214,7 @@ void test_multi_connect_ipv6 (void)
assert (rc == 0);
rc = zmq_connect (sc, "tcp://[::1]:5561");
assert (rc == 0);
rc = zmq_connect (sc, "tcp://[::1]:5562");
rc = zmq_connect (sc, "tcp://[::1]:5564;[::1]:5562");
assert (rc == 0);
bounce (sb0, sc);
......@@ -227,7 +227,7 @@ void test_multi_connect_ipv6 (void)
rc = zmq_disconnect (sc, "tcp://[::1]:5560");
assert (rc == 0);
rc = zmq_disconnect (sc, "tcp://[::1]:5562");
rc = zmq_disconnect (sc, "tcp://[::1]:5564;[::1]:5562");
assert (rc == 0);
rc = zmq_disconnect (sc, "tcp://[::1]:5561");
assert (rc == 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment