Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility issues #66

Merged
merged 2 commits into from
Apr 19, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
make compiler stop complaining
  • Loading branch information
clowwindy committed Apr 19, 2014
commit 81159f987112489304546e09abf1d08dfaf453c5
9 changes: 5 additions & 4 deletions src/udprelay.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@ static void remote_recv_cb (EV_P_ ev_io *w, int revents)

struct sockaddr src_addr;
socklen_t src_addr_len = sizeof(src_addr);
unsigned int addr_header_len = remote_ctx->addr_header_len;
char *buf = malloc(BUF_SIZE);

// recv
Expand Down Expand Up @@ -523,12 +522,11 @@ static void remote_recv_cb (EV_P_ ev_io *w, int revents)
}
// server may return using a different address type other than the type we
// have used during sending
addr_header_len = len;

#ifdef UDPRELAY_TUNNEL
// Construct packet
buf_len -= addr_header_len;
memmove(buf, buf + addr_header_len, buf_len);
buf_len -= len;
memmove(buf, buf + len, buf_len);
#else
// Construct packet
char *tmpbuf = malloc(buf_len + 3);
Expand All @@ -541,6 +539,9 @@ static void remote_recv_cb (EV_P_ ev_io *w, int revents)
#endif

#ifdef UDPRELAY_REMOTE

unsigned int addr_header_len = remote_ctx->addr_header_len;

// Construct packet
char *tmpbuf = malloc(buf_len + addr_header_len);
memcpy(tmpbuf, remote_ctx->addr_header, addr_header_len);
Expand Down