Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2155

Bug in unreleased code: Client pool cannot connect with IPv6 address like "[::1]"

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.7.0
    • Affects Version/s: None
    • Component/s: libmongoc, network
    • None

      Bug in unreleased code, introduced on master during 1.7 development. This bug does not affect released versions.

      The driver correctly strips the "[" and "]" characters from the host in a URI like "mongodb://[::1]" before calling getaddrinfo on the host in mongoc_topology_scanner_node_connect_tcp(). In single-client mode, that is the only getaddrinfo call; the connection established by the topology scanner is also used for application operations.

      In pooled mode, however, there is a second path for establishing connections for application operations, in mongoc_client_connect_tcp. This second path does not strip "[" and "]" from the hostname, and so it calls getaddrinfo on a misformatted string like "[::1]" instead of the intended "::1".

      Connecting to "mongodb://[::1]" in pooled mode fails, therefore, with an error like "Failed to resolve [::1]".

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: