X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet_packet.c;h=28459ce52aa5425638d04bed3ecb94ca2a72cb7c;hb=421aa3815645b2835c89799e4db91cf35466542b;hp=5bdcb1aabc27a679503cdeaad635366d16a1700e;hpb=ca7502b6de1e1ae49a62ad6b7a7ae8b760fa51ff;p=tinc diff --git a/src/net_packet.c b/src/net_packet.c index 5bdcb1aa..28459ce5 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -53,6 +53,7 @@ #include "protocol.h" #include "route.h" #include "utils.h" +#include "random.h" /* The minimum size of a probe is 14 bytes, but since we normally use CBC mode encryption, we can add a few extra random bytes without increasing the @@ -1257,7 +1258,7 @@ static length_t choose_initial_maxmtu(node_t *n) { if(connect(sock, &sa->sa, SALEN(sa->sa))) { logger(DEBUG_TRAFFIC, LOG_ERR, "Connecting MTU assessment socket for %s (%s) failed: %s", n->name, n->hostname, sockstrerror(sockerrno)); - close(sock); + closesocket(sock); return MTU; } @@ -1266,11 +1267,11 @@ static length_t choose_initial_maxmtu(node_t *n) { if(getsockopt(sock, IPPROTO_IP, IP_MTU, (void *)&ip_mtu, &ip_mtu_len)) { logger(DEBUG_TRAFFIC, LOG_ERR, "getsockopt(IP_MTU) on %s (%s) failed: %s", n->name, n->hostname, sockstrerror(sockerrno)); - close(sock); + closesocket(sock); return MTU; } - close(sock); + closesocket(sock); if(ip_mtu < MINMTU) { logger(DEBUG_TRAFFIC, LOG_ERR, "getsockopt(IP_MTU) on %s (%s) returned absurdly small value: %d", n->name, n->hostname, ip_mtu);