1
0
Fork 0
mirror of https://github.com/yarrick/iodine.git synced 2025-04-10 04:21:01 +00:00

window size zero (-W0) drops packets from client tun device

This commit is contained in:
Masaq- 2017-04-04 20:00:10 +00:00
parent b4f42ec82d
commit 94251811da
2 changed files with 4 additions and 4 deletions

View file

@ -1015,7 +1015,7 @@ tunnel_tun()
if (this.conn == CONN_DNS_NULL) { if (this.conn == CONN_DNS_NULL) {
/* Check if outgoing buffer can hold data */ /* Check if outgoing buffer can hold data */
if (window_buffer_available(this.outbuf) < (read / MAX_FRAGSIZE) + 1) { if ((0 == this.windowsize_up && 0 != this.outbuf->numitems) || window_buffer_available(this.outbuf) < (read / MAX_FRAGSIZE) + 1) {
DEBUG(1, " Outgoing buffer full (%" L "u/%" L "u), not adding data!", DEBUG(1, " Outgoing buffer full (%" L "u/%" L "u), not adding data!",
this.outbuf->numitems, this.outbuf->length); this.outbuf->numitems, this.outbuf->length);
return -1; return -1;
@ -1340,7 +1340,7 @@ client_tunnel()
FD_ZERO(&fds); FD_ZERO(&fds);
maxfd = 0; maxfd = 0;
if (this.conn != CONN_DNS_NULL || window_buffer_available(this.outbuf) > 1) { if (this.conn != CONN_DNS_NULL || 0 == this.windowsize_up || window_buffer_available(this.outbuf) > 1) {
/* Fill up outgoing buffer with available data if it has enough space /* Fill up outgoing buffer with available data if it has enough space
* The windowing protocol manages data retransmits, timeouts etc. */ * The windowing protocol manages data retransmits, timeouts etc. */
if (this.use_remote_forward) { if (this.use_remote_forward) {
@ -2702,7 +2702,7 @@ client_handshake()
return -1; return -1;
/* init windowing protocol */ /* init windowing protocol */
this.outbuf = window_buffer_init(64, this.windowsize_up, this.maxfragsize_up, WINDOW_SENDING); this.outbuf = window_buffer_init(64, (0 == this.windowsize_up ? 1 : this.windowsize_up), this.maxfragsize_up, WINDOW_SENDING);
this.outbuf->timeout = ms_to_timeval(this.downstream_timeout_ms); this.outbuf->timeout = ms_to_timeval(this.downstream_timeout_ms);
/* Incoming buffer max fragsize doesn't matter */ /* Incoming buffer max fragsize doesn't matter */
this.inbuf = window_buffer_init(64, this.windowsize_down, MAX_FRAGSIZE, WINDOW_RECVING); this.inbuf = window_buffer_init(64, this.windowsize_down, MAX_FRAGSIZE, WINDOW_RECVING);

View file

@ -669,7 +669,7 @@ main(int argc, char **argv)
} }
int max_ws = MAX_SEQ_ID / 2; int max_ws = MAX_SEQ_ID / 2;
if (this.windowsize_up < 1 || this.windowsize_down < 1 || if (this.windowsize_up < 0 || this.windowsize_down < 1 ||
this.windowsize_up > max_ws || this.windowsize_down > max_ws) { this.windowsize_up > max_ws || this.windowsize_down > max_ws) {
warnx("Window sizes (-w or -W) must be between 0 and %d!", max_ws); warnx("Window sizes (-w or -W) must be between 0 and %d!", max_ws);
usage(); usage();