mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Changes in response to Johanna's code review.
This commit is contained in:
parent
2f05318a08
commit
56e234a762
3 changed files with 18 additions and 6 deletions
|
@ -996,7 +996,7 @@ const UDP_ACTIVE = 1; ##< Endpoint has sent something.
|
|||
const ignore_checksums = F &redef;
|
||||
|
||||
## Checksums are ignored for all packets with a src address within this set of
|
||||
## addresses. Useful for cases where a host might be seeing packets collected
|
||||
## networks. Useful for cases where a host might be seeing packets collected
|
||||
## from local hosts before checksums were applied by hardware. This frequently
|
||||
## manifests when sniffing a local management interface on a host and Zeek sees
|
||||
## packets before the hardware has had a chance to apply the checksums.
|
||||
|
|
10
src/Val.cc
10
src/Val.cc
|
@ -1991,9 +1991,15 @@ ValPtr TableVal::FindOrDefault(const ValPtr& index)
|
|||
return Default(index);
|
||||
}
|
||||
|
||||
bool TableVal::Contains(const IPAddr& addr)
|
||||
const bool TableVal::Contains(const IPAddr& addr)
|
||||
{
|
||||
return subnets ? subnets->Lookup(addr, true) != 0 : false;
|
||||
if ( ! subnets )
|
||||
{
|
||||
reporter->InternalError("LookupSubnets called on wrong table type");
|
||||
return false;
|
||||
}
|
||||
|
||||
return (subnets->Lookup(addr, true) != 0);
|
||||
}
|
||||
|
||||
Val* TableVal::Lookup(Val* index, bool use_default_val)
|
||||
|
|
12
src/Val.h
12
src/Val.h
|
@ -906,9 +906,15 @@ public:
|
|||
[[deprecated("Remove in v4.1. Use Find() or FindOrDefault().")]]
|
||||
Val* Lookup(Val* index, bool use_default_val = true);
|
||||
|
||||
// Returns true if this is a table[subnet]/set[subnet] and the
|
||||
// given address was found in the table. Otherwise returns false.
|
||||
bool Contains(const IPAddr& addr);
|
||||
/**
|
||||
* Returns true if this is a table[subnet]/set[subnet] and the
|
||||
* given address was found in the table. Otherwise returns false.
|
||||
* @param addr The address to look for.
|
||||
* @return Boolean value to indicate if addr is in the table or set. If
|
||||
* self is not a table[subnet]/set[subnet] an internal error will be
|
||||
* generated and false will be returned.
|
||||
*/
|
||||
bool Contains(const IPAddr& addr) const;
|
||||
|
||||
// For a table[subnet]/set[subnet], return all subnets that cover
|
||||
// the given subnet.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue