From: Guus Sliepen Date: Mon, 22 Oct 2018 15:20:30 +0000 (+0200) Subject: Prevent sptps_test from sending overly large UDP packets. X-Git-Tag: release-1.1pre18~37 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=c33dd41c07c4c4578f546798264b7f467d6a7866;p=tinc Prevent sptps_test from sending overly large UDP packets. This fixes the test suite on macOS, which has a lo0 interface with an MTU of 16384, which is smaller than the maximum packet size we could send. --- diff --git a/src/sptps_test.c b/src/sptps_test.c index 0452b25c..ea81a28d 100644 --- a/src/sptps_test.c +++ b/src/sptps_test.c @@ -370,6 +370,7 @@ int main(int argc, char *argv[]) { } char buf[65535] = ""; + size_t readsize = datagram ? 1460u : sizeof(buf); fd_set fds; FD_ZERO(&fds); @@ -387,7 +388,7 @@ int main(int argc, char *argv[]) { } if(FD_ISSET(in, &fds)) { - ssize_t len = read(in, buf, sizeof(buf)); + ssize_t len = read(in, buf, readsize); if(len < 0) { fprintf(stderr, "Could not read from stdin: %s\n", strerror(errno));