X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;ds=sidebyside;f=src%2Fnet_packet.c;h=459b24134b1f325a6546ef9b7b6a3e04a557b7de;hb=28b7a53b693f6b4e70218a926e68a36ece54cda1;hp=89172670e43766adb0b6822fb1218a4c6bd3e995;hpb=0912276c6467aa3ee6f570b31245367319da572a;p=tinc diff --git a/src/net_packet.c b/src/net_packet.c index 89172670..459b2413 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -1,7 +1,7 @@ /* net_packet.c -- Handles in- and outgoing VPN packets Copyright (C) 1998-2005 Ivo Timmermans, - 2000-2021 Guus Sliepen + 2000-2022 Guus Sliepen 2010 Timothy Redaelli 2010 Brandon Black @@ -992,8 +992,8 @@ bool send_sptps_data(node_t *to, node_t *from, int type, const void *data, size_ overhead += sizeof(to->id) + sizeof(from->id); } - uint8_t buf[len + overhead]; - uint8_t *buf_ptr = buf; + char buf[len + overhead]; + char *buf_ptr = buf; if(relay_supported) { if(direct) { @@ -1165,7 +1165,7 @@ static void send_udp_probe_packet(node_t *n, size_t len) { vpn_packet_t packet; if(len > sizeof(packet.data)) { - logger(DEBUG_TRAFFIC, LOG_INFO, "Truncating probe length %zu to %s (%s)", len, n->name, n->hostname); + logger(DEBUG_TRAFFIC, LOG_INFO, "Truncating probe length %lu to %s (%s)", (unsigned long)len, n->name, n->hostname); len = sizeof(packet.data); } @@ -1175,7 +1175,7 @@ static void send_udp_probe_packet(node_t *n, size_t len) { packet.len = len; packet.priority = 0; - logger(DEBUG_TRAFFIC, LOG_INFO, "Sending UDP probe length %zu to %s (%s)", len, n->name, n->hostname); + logger(DEBUG_TRAFFIC, LOG_INFO, "Sending UDP probe length %lu to %s (%s)", (unsigned long)len, n->name, n->hostname); send_udppacket(n, &packet); } @@ -1261,7 +1261,7 @@ static length_t choose_initial_maxmtu(node_t *n) { int ip_mtu; socklen_t ip_mtu_len = sizeof(ip_mtu); - if(getsockopt(sock, IPPROTO_IP, IP_MTU, &ip_mtu, &ip_mtu_len)) { + 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); return MTU; @@ -1424,7 +1424,7 @@ static void try_mtu(node_t *n) { on the precise MTU as we are approaching it. The last probe of the cycle is always 1 byte in size - this is to make sure we'll get at least one reply per cycle so that we can make progress. */ - offset = (length_t) powf(interval, multiplier * cycle_position / ((float) probes_per_cycle - 1.0f)); + offset = lrintf(powf(interval, multiplier * cycle_position / (float)(probes_per_cycle - 1))); } length_t maxmtu = n->maxmtu;