X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet_packet.c;h=217518061a15a30a15837e5fe7d1afd9b3f95a86;hb=ca989c0c8b19901cbd7664a9d2b42aa85c9c176e;hp=5709d49a93962bcfaac3ab11a00f58a7eedfd426;hpb=f6e87ab476a0faf8b124ecaaa27f967d825e6457;p=tinc diff --git a/src/net_packet.c b/src/net_packet.c index 5709d49a..21751806 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -773,7 +773,7 @@ static void send_udppacket(node_t *n, vpn_packet_t *origpkt) { listen_socket[sock].priority = origpriority; switch(sa->sa.sa_family) { -#if defined(IPPROTO_IP) && defined(IP_TOS) +#if defined(IP_TOS) case AF_INET: logger(DEBUG_TRAFFIC, LOG_DEBUG, "Setting IPv4 outgoing packet priority to %d", origpriority); @@ -784,7 +784,7 @@ static void send_udppacket(node_t *n, vpn_packet_t *origpkt) { break; #endif -#if defined(IPPROTO_IPV6) & defined(IPV6_TCLASS) +#if defined(IPV6_TCLASS) case AF_INET6: logger(DEBUG_TRAFFIC, LOG_DEBUG, "Setting IPv6 outgoing packet priority to %d", origpriority); @@ -832,12 +832,12 @@ bool send_sptps_data(node_t *to, node_t *from, int type, const void *data, size_ if(type == SPTPS_HANDSHAKE || tcponly || (!direct && !relay_supported) || (type != PKT_PROBE && (len - SPTPS_DATAGRAM_OVERHEAD) > relay->minmtu)) { if(type != SPTPS_HANDSHAKE && (to->nexthop->connection->options >> 24) >= 7) { - char buf[len + sizeof(to->id) + sizeof from->id]; + char buf[len + sizeof(to->id) + sizeof(from->id)]; char *buf_ptr = buf; memcpy(buf_ptr, &to->id, sizeof(to->id)); - buf_ptr += sizeof to->id; + buf_ptr += sizeof(to->id); memcpy(buf_ptr, &from->id, sizeof(from->id)); - buf_ptr += sizeof from->id; + buf_ptr += sizeof(from->id); memcpy(buf_ptr, data, len); logger(DEBUG_TRAFFIC, LOG_INFO, "Sending packet from %s (%s) to %s (%s) via %s (%s) (TCP)", from->name, from->hostname, to->name, to->hostname, to->nexthop->name, to->nexthop->hostname); return send_sptps_tcppacket(to->nexthop->connection, buf, sizeof(buf)); @@ -860,7 +860,7 @@ bool send_sptps_data(node_t *to, node_t *from, int type, const void *data, size_ size_t overhead = 0; if(relay_supported) { - overhead += sizeof(to->id) + sizeof from->id; + overhead += sizeof(to->id) + sizeof(from->id); } char buf[len + overhead]; @@ -871,14 +871,14 @@ bool send_sptps_data(node_t *to, node_t *from, int type, const void *data, size_ /* Inform the recipient that this packet was sent directly. */ node_id_t nullid = {}; memcpy(buf_ptr, &nullid, sizeof(nullid)); - buf_ptr += sizeof nullid; + buf_ptr += sizeof(nullid); } else { memcpy(buf_ptr, &to->id, sizeof(to->id)); - buf_ptr += sizeof to->id; + buf_ptr += sizeof(to->id); } memcpy(buf_ptr, &from->id, sizeof(from->id)); - buf_ptr += sizeof from->id; + buf_ptr += sizeof(from->id); } @@ -929,7 +929,7 @@ bool receive_sptps_record(void *handle, uint8_t type, const void *data, uint16_t if(!from->status.validkey) { from->status.validkey = true; from->status.waitingforkey = false; - logger(DEBUG_META, LOG_INFO, "SPTPS key exchange with %s (%s) succesful", from->name, from->hostname); + logger(DEBUG_META, LOG_INFO, "SPTPS key exchange with %s (%s) successful", from->name, from->hostname); } return true;