From 7c17e16fea391d3f5972ae9042b2f27bdd7a9bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Gallou=C3=ABt?= Date: Mon, 9 Sep 2019 16:13:16 +0000 Subject: [PATCH] Block on sendmsg and revert 4a68866 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adrien Gallouët --- mud | 2 +- src/bind.c | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/mud b/mud index 6623be1..2c9d971 160000 --- a/mud +++ b/mud @@ -1 +1 @@ -Subproject commit 6623be1e6928576775f5db3de1b5a47344d03cdb +Subproject commit 2c9d9714379b21a8c2107bed6ab2bf25d9ddf4e6 diff --git a/src/bind.c b/src/bind.c index ae4d1c4..77f4941 100644 --- a/src/bind.c +++ b/src/bind.c @@ -249,17 +249,10 @@ gt_bind(int argc, char **argv) } if (FD_ISSET(mud_fd, &rfds)) { - int n = 1000; + const int r = mud_recv(mud, buf, sizeof(buf)); - while (n--) { - const int r = mud_recv(mud, buf, sizeof(buf)); - - if (r <= 0) - break; - - if (ip_is_valid(buf, r)) - tun_write(tun_fd, buf, (size_t)r); - } + if (r > 0 && ip_is_valid(buf, r)) + tun_write(tun_fd, buf, (size_t)r); } if (FD_ISSET(ctl_fd, &rfds)) {