mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Updates for directions-and-hosts
This commit is contained in:
parent
844afba017
commit
dc7229f15a
1 changed files with 9 additions and 11 deletions
|
@ -1,26 +1,24 @@
|
||||||
# Some enums for deciding what and when to log.
|
# Some enums for deciding what and when to log.
|
||||||
type Directions_and_Hosts: enum {
|
type DirectionsAndHosts: enum {
|
||||||
Inbound, Outbound,
|
Inbound, Outbound, Bidirectional,
|
||||||
LocalHosts, RemoteHosts,
|
LocalHosts, RemoteHosts, AllHosts,
|
||||||
Enabled, Disabled
|
NoHosts, Disabled
|
||||||
};
|
};
|
||||||
const DIRECTIONS = set(Inbound, Outbound, Enabled, Disabled);
|
|
||||||
const HOSTS = set(LocalHosts, RemoteHosts, Enabled, Disabled);
|
|
||||||
|
|
||||||
function id_matches_directions(id: conn_id, d: Directions_and_Hosts): bool
|
function id_matches_directions(id: conn_id, d: DirectionsAndHosts): bool
|
||||||
{
|
{
|
||||||
if ( d == Disabled ) return F;
|
if ( d == Disabled ) return F;
|
||||||
|
|
||||||
return ( d == Enabled ||
|
return ( d == Bidirectional ||
|
||||||
(d == Outbound && is_local_addr(id$orig_h)) ||
|
(d == Outbound && is_local_addr(id$orig_h)) ||
|
||||||
(d == Inbound && is_local_addr(id$resp_h)) );
|
(d == Inbound && is_local_addr(id$resp_h)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function addr_matches_hosts(ip: addr, h: Directions_and_Hosts): bool
|
function addr_matches_hosts(ip: addr, h: DirectionsAndHosts): bool
|
||||||
{
|
{
|
||||||
if ( h == Disabled ) return F;
|
if ( h == Disabled || h == NoHosts ) return F;
|
||||||
|
|
||||||
return ( h == Enabled ||
|
return ( h == AllHosts ||
|
||||||
(h == LocalHosts && is_local_addr(ip)) ||
|
(h == LocalHosts && is_local_addr(ip)) ||
|
||||||
(h == RemoteHosts && !is_local_addr(ip)) );
|
(h == RemoteHosts && !is_local_addr(ip)) );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue