Bug #38473 The MGM API function ndb_mgm_listen_event does not use bind-address parameter.
Submitted: 30 Jul 2008 23:03 Modified: 21 Nov 2008 15:17
Reporter: Anatoly Pidruchny (Candidate Quality Contributor)
Status: Closed
Category:Server: NDBAPI Severity:S3 (Non-critical)
Version:6.2.15 OS:Any
Assigned to: Tomas Ulin Target Version:
Triage: Needs Triage: D4 (Minor)

[30 Jul 2008 23:03] Anatoly Pidruchny
Description:
Please look at the ndb_mgm_listen_event_internal function in the source file
storage/ndb/src/mgmapi.cpp, from line 1662:

  const char *hostname= ndb_mgm_get_connected_host(handle);
  int port= ndb_mgm_get_connected_port(handle);
  SocketClient s(hostname, port);
  const NDB_SOCKET_TYPE sockfd = s.connect();

A new connection is created to the Management Server, but what is missing is binding the
socket to the local address when bindaddress is set. In the function ndb_mgm_connect,
lines 542 to 568, there is code that binds the socket to the local address if bindaddress
is set, before connecting to the Management Server. The same code is supposed to be
present also in ndb_mgm_listen_event_internal function.

How to repeat:
On a multi-homed server it is necessary to run a ndbd process with --bind-address
parameter that select a second (non-default) network interface. Then you can see that it
creates a connection to the Management Server from the first (default) network
interface.

Suggested fix:
Copy-paste lines 542 to 568 before calling s.connect() in ndb_mgm_listen_event_internal
function.
[31 Jul 2008 19:08] Hartmut Holzgraefe
triage reasoning:

D4 - minor as it doesn't actually break anything
W3 - can be solved using firewall rules but that isn't really practical
I4 - i don't think that bind-address is used that often yet
[17 Nov 2008 15:21] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/58959

2748 Tomas Ulin	2008-11-17
      Bug #38473  The MGM API function ndb_mgm_listen_event does not use bind-address
parameter. + extend ndb connectstring to take bind address parameter
[17 Nov 2008 15:23] Bugs System
Pushed into 5.1.29-ndb-6.3.19  (revid:tomas.ulin@sun.com-20081117142048-jjbu7fvi7fr12jco)
(version source revid:tomas.ulin@sun.com-20081117142048-jjbu7fvi7fr12jco) (pib:5)
[18 Nov 2008 9:36] Bugs System
Pushed into 5.1.29-ndb-6.4.0  (revid:tomas.ulin@sun.com-20081117142048-jjbu7fvi7fr12jco)
(version source revid:tomas.ulin@sun.com-20081118083442-0towxfxe5hh7z56f) (pib:5)
[21 Nov 2008 15:17] Jon Stephens
Documented in the NDB-6.3.19 changelog as follows:

        The MGM API function ndb_mgm_listen_event() ignored bind addresses.

        As part of this fix, it is now possible to specify bind addresses in
        connect strings. See -The Cluster Connectstring- for
        more information.