|
@ -622,7 +622,6 @@ static void server_recv_cb (EV_P_ ev_io *w, int revents) |
|
|
|
|
|
|
|
|
if (remote_ctx == NULL) |
|
|
if (remote_ctx == NULL) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
struct addrinfo hints; |
|
|
struct addrinfo hints; |
|
|
struct addrinfo *result; |
|
|
struct addrinfo *result; |
|
|
|
|
|
|
|
@ -667,8 +666,8 @@ static void server_recv_cb (EV_P_ ev_io *w, int revents) |
|
|
freeaddrinfo(result); |
|
|
freeaddrinfo(result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
buf_len -= 3; |
|
|
|
|
|
memmove(buf, buf + 3, buf_len); |
|
|
|
|
|
|
|
|
buf_len -= offset; |
|
|
|
|
|
memmove(buf, buf + offset, buf_len); |
|
|
|
|
|
|
|
|
buf = ss_encrypt_all(BUF_SIZE, buf, &buf_len, server_ctx->method); |
|
|
buf = ss_encrypt_all(BUF_SIZE, buf, &buf_len, server_ctx->method); |
|
|
|
|
|
|
|
@ -681,9 +680,6 @@ static void server_recv_cb (EV_P_ ev_io *w, int revents) |
|
|
|
|
|
|
|
|
#else |
|
|
#else |
|
|
|
|
|
|
|
|
buf_len -= (offset + addr_header_len); |
|
|
|
|
|
memmove(buf, buf + (offset + addr_header_len), buf_len); |
|
|
|
|
|
|
|
|
|
|
|
if (remote_ctx == NULL) |
|
|
if (remote_ctx == NULL) |
|
|
{ |
|
|
{ |
|
|
struct addrinfo hints; |
|
|
struct addrinfo hints; |
|
@ -701,7 +697,8 @@ static void server_recv_cb (EV_P_ ev_io *w, int revents) |
|
|
goto CLEAN_UP; |
|
|
goto CLEAN_UP; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
struct query_ctx *query_ctx = new_query_ctx(query, buf, buf_len); |
|
|
|
|
|
|
|
|
struct query_ctx *query_ctx = new_query_ctx(query, buf + addr_header_len, |
|
|
|
|
|
buf_len - addr_header_len); |
|
|
query_ctx->server_ctx = server_ctx; |
|
|
query_ctx->server_ctx = server_ctx; |
|
|
query_ctx->addr_header_len = addr_header_len; |
|
|
query_ctx->addr_header_len = addr_header_len; |
|
|
query_ctx->src_addr = src_addr; |
|
|
query_ctx->src_addr = src_addr; |
|
@ -713,7 +710,8 @@ static void server_recv_cb (EV_P_ ev_io *w, int revents) |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
int s = sendto(remote_ctx->fd, buf, buf_len, 0, &remote_ctx->dst_addr, sizeof(remote_ctx->dst_addr)); |
|
|
|
|
|
|
|
|
int s = sendto(remote_ctx->fd, buf + addr_header_len, |
|
|
|
|
|
buf_len - addr_header_len, 0, &remote_ctx->dst_addr, sizeof(remote_ctx->dst_addr)); |
|
|
|
|
|
|
|
|
if (s == -1) |
|
|
if (s == -1) |
|
|
{ |
|
|
{ |
|
|