mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Add filter_subnet_table bif
This bif works similar to the matching_subnet bif. The difference is that, instead of returning a vector of the subnets that match, we return a filtered view of the original set/table only containing the changed subnets. This commit also fixes a small bug in TableVal::UpdateTimestamp (ReadOperation only has to be called when LoggingAccess() is true).
This commit is contained in:
parent
f5ce4785ea
commit
a6cb85d86a
7 changed files with 153 additions and 23 deletions
|
@ -62,9 +62,9 @@ void* PrefixTable::Insert(const Val* value, void* data)
|
|||
}
|
||||
}
|
||||
|
||||
list<IPPrefix> PrefixTable::FindAll(const IPAddr& addr, int width) const
|
||||
list<tuple<IPPrefix,void*>> PrefixTable::FindAll(const IPAddr& addr, int width) const
|
||||
{
|
||||
std::list<IPPrefix> out;
|
||||
std::list<tuple<IPPrefix,void*>> out;
|
||||
prefix_t* prefix = MakePrefix(addr, width);
|
||||
|
||||
int elems = 0;
|
||||
|
@ -73,14 +73,14 @@ list<IPPrefix> PrefixTable::FindAll(const IPAddr& addr, int width) const
|
|||
patricia_search_all(tree, prefix, &list, &elems);
|
||||
|
||||
for ( int i = 0; i < elems; ++i )
|
||||
out.push_back(PrefixToIPPrefix(list[i]->prefix));
|
||||
out.push_back(std::make_tuple(PrefixToIPPrefix(list[i]->prefix), list[i]->data));
|
||||
|
||||
Deref_Prefix(prefix);
|
||||
free(list);
|
||||
return out;
|
||||
}
|
||||
|
||||
list<IPPrefix> PrefixTable::FindAll(const SubNetVal* value) const
|
||||
list<tuple<IPPrefix,void*>> PrefixTable::FindAll(const SubNetVal* value) const
|
||||
{
|
||||
return FindAll(value->AsSubNet().Prefix(), value->AsSubNet().LengthIPv6());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue