Browse Source

Decrease the visibility of fragmentation. #1524

pull/1525/head
Max Lv 7 years ago
parent
commit
ba81b2f49e
1 changed files with 18 additions and 12 deletions
  1. 30
      src/udprelay.c

30
src/udprelay.c

@ -697,8 +697,9 @@ remote_recv_cb(EV_P_ ev_io *w, int revents)
ERROR("[udp] remote_recv_recvfrom"); ERROR("[udp] remote_recv_recvfrom");
goto CLEAN_UP; goto CLEAN_UP;
} else if (r > packet_size) { } else if (r > packet_size) {
LOGE("[udp] remote_recv_recvfrom fragmentation");
goto CLEAN_UP;
if (verbose) {
LOGI("[udp] remote_recv_recvfrom fragmentation");
}
} }
buf->len = r; buf->len = r;
@ -777,8 +778,9 @@ remote_recv_cb(EV_P_ ev_io *w, int revents)
#endif #endif
if (buf->len > packet_size) { if (buf->len > packet_size) {
LOGE("[udp] remote_recv_sendto fragmentation");
goto CLEAN_UP;
if (verbose) {
LOGI("[udp] remote_recv_sendto fragmentation");
}
} }
size_t remote_src_addr_len = get_sockaddr_len((struct sockaddr *)&remote_ctx->src_addr); size_t remote_src_addr_len = get_sockaddr_len((struct sockaddr *)&remote_ctx->src_addr);
@ -880,8 +882,9 @@ server_recv_cb(EV_P_ ev_io *w, int revents)
ERROR("[udp] server_recvmsg"); ERROR("[udp] server_recvmsg");
goto CLEAN_UP; goto CLEAN_UP;
} else if (buf->len > packet_size) { } else if (buf->len > packet_size) {
ERROR("[udp] UDP server_recv_recvmsg fragmentation");
goto CLEAN_UP;
if (verbose) {
LOGI("[udp] UDP server_recv_recvmsg fragmentation");
}
} }
if (get_dstaddr(&msg, &dst_addr)) { if (get_dstaddr(&msg, &dst_addr)) {
@ -901,8 +904,9 @@ server_recv_cb(EV_P_ ev_io *w, int revents)
ERROR("[udp] server_recv_recvfrom"); ERROR("[udp] server_recv_recvfrom");
goto CLEAN_UP; goto CLEAN_UP;
} else if (r > packet_size) { } else if (r > packet_size) {
ERROR("[udp] server_recv_recvfrom fragmentation");
goto CLEAN_UP;
if (verbose) {
LOGI("[udp] server_recv_recvfrom fragmentation");
}
} }
buf->len = r; buf->len = r;
@ -1188,8 +1192,9 @@ server_recv_cb(EV_P_ ev_io *w, int revents)
} }
if (buf->len > packet_size) { if (buf->len > packet_size) {
LOGE("[udp] server_recv_sendto fragmentation");
goto CLEAN_UP;
if (verbose) {
LOGI("[udp] server_recv_sendto fragmentation");
}
} }
int s = sendto(remote_ctx->fd, buf->data, buf->len, 0, remote_addr, remote_addr_len); int s = sendto(remote_ctx->fd, buf->data, buf->len, 0, remote_addr, remote_addr_len);
@ -1204,8 +1209,9 @@ server_recv_cb(EV_P_ ev_io *w, int revents)
int need_query = 0; int need_query = 0;
if (buf->len - addr_header_len > packet_size) { if (buf->len - addr_header_len > packet_size) {
LOGE("[udp] server_recv_sendto fragmentation");
goto CLEAN_UP;
if (verbose) {
LOGE("[udp] server_recv_sendto fragmentation");
}
} }
if (remote_ctx != NULL) { if (remote_ctx != NULL) {

Loading…
Cancel
Save