From: Mathew Heard Date: Tue, 29 Jun 2021 00:49:01 +0000 (+1000) Subject: perform cheap checks first X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=fd27c14b9353e7a6eef38860395383d4d1a0bec8;p=tinc perform cheap checks first minor optimization --- diff --git a/src/net_packet.c b/src/net_packet.c index c2132b8b..ff9f79cb 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -1630,7 +1630,7 @@ static void handle_incoming_vpn_packet(listen_socket_t *ls, vpn_packet_t *pkt, s pkt->offset = 2 * sizeof(node_id_t); from = lookup_node_id(SRCID(pkt)); - if(from && !memcmp(DSTID(pkt), &nullid, sizeof(nullid)) && from->status.sptps) { + if(from && from->status.sptps && !memcmp(DSTID(pkt), &nullid, sizeof(nullid))) { if(sptps_verify_datagram(&from->sptps, DATA(pkt), pkt->len - 2 * sizeof(node_id_t))) { n = from; } else { @@ -1666,7 +1666,7 @@ skip_harder: pkt->len -= pkt->offset; } - if(!memcmp(DSTID(pkt), &nullid, sizeof(nullid)) || !relay_enabled) { + if(!relay_enabled || !memcmp(DSTID(pkt), &nullid, sizeof(nullid))) { direct = true; from = n; to = myself;