GH-1080: Rename conflicting NetControl::DROP enum definitions

``NetControl::DROP`` had 3 conflicting definitions that could potentially
be used incorrectly without any warnings or type-checking errors.
Such enum redefinition conflicts are now caught and treated as errors,
so the ``NetControl::DROP`` enums had to be renamed:

* The use as enum of type ``Log::ID`` is renamed to ``NetControl::DROP_LOG``

* The use as enum of type ``NetControl::CatchReleaseInfo`` is renamed to
  ``NetControl::DROP_REQUESTED``

* The use as enum of type ``NetControl::RuleType`` is unchanged and still
  named ``NetControl::DROP``
This commit is contained in:
Jon Siwek 2020-07-31 16:09:58 -07:00
parent 8517d70e52
commit 613b27eec7
6 changed files with 55 additions and 26 deletions

View file

@ -5,7 +5,7 @@
module NetControl;
export {
redef enum Log::ID += { DROP };
redef enum Log::ID += { DROP_LOG };
## Stops all packets involving an IP address from being forwarded.
##
@ -57,7 +57,7 @@ export {
event zeek_init() &priority=5
{
Log::create_stream(NetControl::DROP, [$columns=DropInfo, $ev=log_netcontrol_drop, $path="netcontrol_drop"]);
Log::create_stream(NetControl::DROP_LOG, [$columns=DropInfo, $ev=log_netcontrol_drop, $path="netcontrol_drop"]);
}
function drop_connection(c: conn_id, t: interval, location: string &default="") : string
@ -79,7 +79,7 @@ function drop_connection(c: conn_id, t: interval, location: string &default="")
if ( location != "" )
log$location=location;
Log::write(DROP, log);
Log::write(DROP_LOG, log);
return id;
}
@ -103,7 +103,7 @@ function drop_address(a: addr, t: interval, location: string &default="") : stri
if ( location != "" )
log$location=location;
Log::write(DROP, log);
Log::write(DROP_LOG, log);
return id;
}