Browse Source

connectd: handle IPv6 correctly.

Untested, but the current code is clearly wrong (caught by gcc-4.8 -O3).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
htlc_accepted_hook
Rusty Russell 5 years ago
parent
commit
9820d0664b
  1. 11
      connectd/tor.c

11
connectd/tor.c

@ -45,8 +45,8 @@ static struct io_plan *connect_finish2(struct io_conn *conn,
struct connecting_socks *connect)
{
status_io(LOG_IO_IN, "proxy",
(connect->buffer + SIZE_OF_RESPONSE - SIZE_OF_IPV4_RESPONSE),
SIZE_OF_IPV6_RESPONSE - SIZE_OF_RESPONSE - SIZE_OF_IPV4_RESPONSE);
connect->buffer + SIZE_OF_RESPONSE + SIZE_OF_IPV4_RESPONSE,
SIZE_OF_IPV6_RESPONSE - SIZE_OF_IPV4_RESPONSE);
status_trace("Now try LN connect out for host %s", connect->host);
return connection_out(conn, connect->connect);
}
@ -59,11 +59,12 @@ static struct io_plan *connect_finish(struct io_conn *conn,
if ( connect->buffer[1] == '\0') {
if ( connect->buffer[3] == SOCKS_TYP_IPV6) {
/* Read rest of response */
return io_read(conn,
(connect->buffer + SIZE_OF_RESPONSE -
SIZE_OF_IPV4_RESPONSE),
connect->buffer + SIZE_OF_RESPONSE +
SIZE_OF_IPV4_RESPONSE,
SIZE_OF_IPV6_RESPONSE -
SIZE_OF_RESPONSE - SIZE_OF_IPV4_RESPONSE,
SIZE_OF_IPV4_RESPONSE,
&connect_finish2, connect);
} else if ( connect->buffer[3] == SOCKS_TYP_IPV4) {

Loading…
Cancel
Save