mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
Refactoring various usages of new IPAddr class.
Reducing number of places that internal representation was exposed via GetBytes/CopyIPv6. Also fixed a bug in remask_addr bif.
This commit is contained in:
parent
d887eb3178
commit
d7dafe2fe2
24 changed files with 301 additions and 267 deletions
|
@ -65,15 +65,14 @@ OSFingerprint::OSFingerprint(FingerprintMode arg_mode)
|
|||
|
||||
bool OSFingerprint::CacheMatch(const IPAddr& addr, int id)
|
||||
{
|
||||
uint32 bytes[4];
|
||||
addr.CopyIPv6(bytes);
|
||||
HashKey key = HashKey(bytes, 4);
|
||||
HashKey* key = addr.GetHashKey();
|
||||
int* pid = new int;
|
||||
*pid=id;
|
||||
int* prev = os_matches.Insert(&key, pid);
|
||||
int* prev = os_matches.Insert(key, pid);
|
||||
bool ret = (prev ? *prev != id : 1);
|
||||
if (prev)
|
||||
delete prev;
|
||||
delete key;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue