mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +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.
|
||||
type Directions_and_Hosts: enum {
|
||||
Inbound, Outbound,
|
||||
LocalHosts, RemoteHosts,
|
||||
Enabled, Disabled
|
||||
type DirectionsAndHosts: enum {
|
||||
Inbound, Outbound, Bidirectional,
|
||||
LocalHosts, RemoteHosts, AllHosts,
|
||||
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;
|
||||
|
||||
return ( d == Enabled ||
|
||||
return ( d == Bidirectional ||
|
||||
(d == Outbound && is_local_addr(id$orig_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 == RemoteHosts && !is_local_addr(ip)) );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue