From: Guus Sliepen Date: Tue, 9 Jun 2020 21:12:44 +0000 (+0200) Subject: Check whether IP_MTU is defined. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=ed210eb557e7fb5edbac89ff43a573ae84a941f9;p=meshlink Check whether IP_MTU is defined. --- diff --git a/src/utcp-test.c b/src/utcp-test.c index d1fb606f..f48ac694 100644 --- a/src/utcp-test.c +++ b/src/utcp-test.c @@ -157,11 +157,15 @@ static ssize_t do_send(struct utcp *utcp, const void *data, size_t len) { } static void set_mtu(struct utcp *u, int s) { +#ifdef IP_MTU + if(!mtu) { socklen_t optlen = sizeof(mtu); getsockopt(s, IPPROTO_IP, IP_MTU, &mtu, &optlen); } +#endif + if(!mtu || mtu == 65535) { mtu = 1500; }