X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;ds=sidebyside;f=src%2Fnet_packet.c;h=6fea959fc841379368de187183f5725686718214;hb=3eb6e723216460fcdc69d4324f5a996852cfc06d;hp=5bdcb1aabc27a679503cdeaad635366d16a1700e;hpb=ca7502b6de1e1ae49a62ad6b7a7ae8b760fa51ff;p=tinc diff --git a/src/net_packet.c b/src/net_packet.c index 5bdcb1aa..6fea959f 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); @@ -1642,6 +1643,7 @@ void broadcast_packet(const node_t *from, vpn_packet_t *packet) { break; + case BMODE_NONE: default: break; }