diff --git a/src/redir.c b/src/redir.c index 9167f9bd..882750d0 100644 --- a/src/redir.c +++ b/src/redir.c @@ -369,18 +369,18 @@ static void remote_send_cb (EV_P_ ev_io *w, int revents) ev_timer_stop(EV_A_ &remote_send_ctx->watcher); // send destaddr - char *addr_to_send = malloc(BUF_SIZE); + char *ss_addr_to_send = malloc(BUF_SIZE); ssize_t addr_len = 0; - addr_to_send[addr_len++] = 1; + ss_addr_to_send[addr_len++] = 1; // handle IP V4 only size_t in_addr_len = sizeof(struct in_addr); - memcpy(addr_to_send + addr_len, &server->destaddr.sin_addr, in_addr_len); + memcpy(ss_addr_to_send + addr_len, &server->destaddr.sin_addr, in_addr_len); addr_len += in_addr_len; - memcpy(addr_to_send + addr_len, &server->destaddr.sin_port, 2); + memcpy(ss_addr_to_send + addr_len, &server->destaddr.sin_port, 2); addr_len += 2; - addr_to_send = ss_encrypt(BUF_SIZE, addr_to_send, &addr_len, server->e_ctx); - if (addr_to_send == NULL) + ss_addr_to_send = ss_encrypt(BUF_SIZE, ss_addr_to_send, &addr_len, server->e_ctx); + if (ss_addr_to_send == NULL) { LOGE("invalid password or cipher"); close_and_free_remote(EV_A_ remote); @@ -388,8 +388,8 @@ static void remote_send_cb (EV_P_ ev_io *w, int revents) return; } - int s = send(remote->fd, addr_to_send, addr_len, 0); - free(addr_to_send); + int s = send(remote->fd, ss_addr_to_send, addr_len, 0); + free(ss_addr_to_send); if (s < addr_len) { @@ -669,7 +669,7 @@ int main (int argc, char **argv) char *conf_path = NULL; int remote_num = 0; - addr_t remote_addr[MAX_REMOTE_NUM]; + ss_addr_t remote_addr[MAX_REMOTE_NUM]; char *remote_port = NULL; opterr = 0; @@ -777,7 +777,7 @@ int main (int argc, char **argv) // Setup proxy context struct listen_ctx listen_ctx; listen_ctx.remote_num = remote_num; - listen_ctx.remote_addr = malloc(sizeof(addr_t) * remote_num); + listen_ctx.remote_addr = malloc(sizeof(ss_addr_t) * remote_num); while (remote_num > 0) { int index = --remote_num; diff --git a/src/redir.h b/src/redir.h index 6e18e9c5..4ec0ae47 100644 --- a/src/redir.h +++ b/src/redir.h @@ -8,7 +8,7 @@ struct listen_ctx { ev_io io; - addr_t *remote_addr; + ss_addr_t *remote_addr; int remote_num; int timeout; int fd;