[tor-bugs] #32314 [Core Tor/Tor]: Can't connect to literal IPv6 address containing double colon

Tor Bug Tracker & Wiki blackhole at torproject.org
Sun Nov 10 21:40:59 UTC 2019


#32314: Can't connect to literal IPv6 address containing double colon
--------------------------+------------------------------------
 Reporter:  liberat       |          Owner:  (none)
     Type:  defect        |         Status:  new
 Priority:  Medium        |      Milestone:  Tor: 0.4.3.x-final
Component:  Core Tor/Tor  |        Version:  Tor: 0.4.1.6
 Severity:  Normal        |     Resolution:
 Keywords:                |  Actual Points:
Parent ID:                |         Points:
 Reviewer:                |        Sponsor:
--------------------------+------------------------------------

Comment (by liberat):

 A less disruptive way to fix the issue would be to do something like this
 (untested):

 {{{
 --- a/src/core/or/connection_edge.c
 +++ b/src/core/or/connection_edge.c
 @@ -3063,6 +3063,7 @@
  MOCK_IMPL(int,
  connection_ap_handshake_send_begin,(entry_connection_t *ap_conn))
  {
 +  const char *address;
    char payload[CELL_PAYLOAD_SIZE];
    int payload_len;
    int begin_type;
 @@ -3092,10 +3093,16 @@
    /* Set up begin cell flags. */
    edge_conn->begincell_flags =
 connection_ap_get_begincell_flags(ap_conn);

 -  tor_snprintf(payload,RELAY_PAYLOAD_SIZE, "%s:%d",
 -               (circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL) ?
 -                 ap_conn->socks_request->address : "",
 -               ap_conn->socks_request->port);
 +  address = ((circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL) ?
 +             ap_conn->socks_request->address : "");
 +  if (strchr(address, ':') && address[0] != '[') {
 +    tor_snprintf(payload,RELAY_PAYLOAD_SIZE, "[%s]:%d",
 +                 address, ap_conn->socks_request->port);
 +  }
 +  else {
 +    tor_snprintf(payload,RELAY_PAYLOAD_SIZE, "%s:%d",
 +                 address, ap_conn->socks_request->port);
 +  }
    payload_len = (int)strlen(payload)+1;
    if (payload_len <= RELAY_PAYLOAD_SIZE - 4 &&
 edge_conn->begincell_flags) {
      set_uint32(payload + payload_len, htonl(edge_conn->begincell_flags));
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/32314#comment:5>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list