From 71676c43098dbfbc5be092dcd3108390166cf1a5 Mon Sep 17 00:00:00 2001 From: fengdaolong Date: Sat, 29 Aug 2020 01:33:06 +0800 Subject: [PATCH] Prevent allocation duplicate IP. --- src/sn_utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sn_utils.c b/src/sn_utils.c index 6550ad4..86d7e11 100644 --- a/src/sn_utils.c +++ b/src/sn_utils.c @@ -997,6 +997,7 @@ static int process_udp(n2n_sn_t * sss, memcpy(ack.edgeMac, reg.edgeMac, sizeof(n2n_mac_t)); if ((reg.dev_addr.net_addr == 0) || (reg.dev_addr.net_addr == 0xFFFFFFFF) || (reg.dev_addr.net_bitlen == 0) || ((reg.dev_addr.net_addr & 0xFFFF0000) == 0xA9FE0000 /* 169.254.0.0 */)) { + memset(&ipaddr, 0, sizeof(n2n_ip_subnet_t)); assign_one_ip_addr(comm, &ipaddr); ack.dev_addr.net_addr = ipaddr.net_addr; ack.dev_addr.net_bitlen = ipaddr.net_bitlen;