0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-15 02:07:59 +08:00

Merge pull request #3377 from sigiesec/fix-3376

Fix handling of random port numbers with tipc
This commit is contained in:
Luca Boccassi 2019-02-01 11:02:24 +01:00 committed by GitHub
commit 1aa6f7070c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 9 deletions

View File

@ -55,10 +55,6 @@ zmq::tipc_address_t::tipc_address_t (const sockaddr *sa, socklen_t sa_len)
_random = false;
}
zmq::tipc_address_t::~tipc_address_t ()
{
}
void zmq::tipc_address_t::set_random ()
{
_random = true;

View File

@ -50,7 +50,6 @@ class tipc_address_t
public:
tipc_address_t ();
tipc_address_t (const sockaddr *sa, socklen_t sa_len);
~tipc_address_t ();
// This function sets up the address "{type, lower, upper}" for TIPC transport
int resolve (const char *name);
@ -69,9 +68,6 @@ class tipc_address_t
private:
bool _random;
struct sockaddr_tipc address;
tipc_address_t (const tipc_address_t &);
const tipc_address_t &operator= (const tipc_address_t &);
};
}

View File

@ -166,7 +166,7 @@ int zmq::tipc_listener_t::set_address (const char *addr_)
if (rc != 0)
goto error;
tipc_address_t addr ((struct sockaddr *) &ss, sl);
address = tipc_address_t ((struct sockaddr *) &ss, sl);
}

View File

@ -91,6 +91,9 @@ void test_tipc_port_identity ()
rc = sscanf (&endpoint[0], "tipc://<%u.%u.%u:%u>", &z, &c, &n, &ref);
TEST_ASSERT_EQUAL_INT (4, rc);
TEST_ASSERT_NOT_EQUAL_MESSAGE (
0, ref, "tipc port number must not be 0 after random assignment");
rc = zmq_connect (sc, endpoint);
TEST_ASSERT_EQUAL_INT (0, rc);