From ba81b2f49e68aac8634b8626703b3a39d30d157b Mon Sep 17 00:00:00 2001 From: Max Lv Date: Mon, 12 Jun 2017 10:14:03 +0800 Subject: [PATCH] Decrease the visibility of fragmentation. #1524 --- src/udprelay.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/udprelay.c b/src/udprelay.c index 9690fa10..cf623953 100644 --- a/src/udprelay.c +++ b/src/udprelay.c @@ -697,8 +697,9 @@ remote_recv_cb(EV_P_ ev_io *w, int revents) ERROR("[udp] remote_recv_recvfrom"); goto CLEAN_UP; } 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; @@ -777,8 +778,9 @@ remote_recv_cb(EV_P_ ev_io *w, int revents) #endif 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); @@ -880,8 +882,9 @@ server_recv_cb(EV_P_ ev_io *w, int revents) ERROR("[udp] server_recvmsg"); goto CLEAN_UP; } 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)) { @@ -901,8 +904,9 @@ server_recv_cb(EV_P_ ev_io *w, int revents) ERROR("[udp] server_recv_recvfrom"); goto CLEAN_UP; } 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; @@ -1188,8 +1192,9 @@ server_recv_cb(EV_P_ ev_io *w, int revents) } 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); @@ -1204,8 +1209,9 @@ server_recv_cb(EV_P_ ev_io *w, int revents) int need_query = 0; 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) {