diff --git a/wireguard_proto.cpp b/wireguard_proto.cpp index 5ea0966..f24a1e2 100644 --- a/wireguard_proto.cpp +++ b/wireguard_proto.cpp @@ -281,7 +281,7 @@ WgKeypair *WgDevice::LookupKeypairInAddrEntryMap(const IpAddr &addr, uint32 slot auto it = addr_entry_lookup_.find(addr_x); if (it == addr_entry_lookup_.end()) return NULL; - WgAddrEntry *addr_entry = it->second; + WgAddrEntry *addr_entry = (WgAddrEntry*)it->second; return addr_entry->keys[slot]; } @@ -300,7 +300,7 @@ void WgDevice::UpdateKeypairAddrEntry_Locked(const IpAddr &addr, WgKeypair *keyp if (keypair->addr_entry != NULL) EraseKeypairAddrEntry_Locked(keypair); - WgAddrEntry **aep = &addr_entry_lookup_[addr_x], *ae; + WgAddrEntry **aep = (WgAddrEntry**)&addr_entry_lookup_[addr_x], *ae; if ((ae = *aep) == NULL) { *aep = ae = new WgAddrEntry(addr_x); diff --git a/wireguard_proto.h b/wireguard_proto.h index 3280285..ec8afc3 100644 --- a/wireguard_proto.h +++ b/wireguard_proto.h @@ -409,8 +409,8 @@ private: WG_HASHTABLE_IMPL, KeyIdHasher> key_id_lookup_; // Mapping from IPV4 IP/PORT to WgPeer*, so we can find the peer when a key id is - // not explicitly included. - WG_HASHTABLE_IMPL addr_entry_lookup_; + // not explicitly included. Use void* here so we can reuse the same template instance. + WG_HASHTABLE_IMPL addr_entry_lookup_; WG_DECLARE_RWLOCK(addr_entry_lookup_lock_); // Mapping from peer id to peer. This may be accessed only from MT.