Prevent sptps_test from sending overly large UDP packets.
authorGuus Sliepen <guus@tinc-vpn.org>
Mon, 22 Oct 2018 15:20:30 +0000 (17:20 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Mon, 22 Oct 2018 15:20:30 +0000 (17:20 +0200)
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.

src/sptps_test.c

index 0452b25..ea81a28 100644 (file)
@@ -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));