Remove deprecated attributes.

To be more exact: &encrypt, &mergeable, &rotate_interval, &rotate_size

Also removes no longer used redef-able constants:
log_rotate_interval, log_max_size, log_encryption_key

GH-243
This commit is contained in:
Johanna Amann 2019-05-20 14:04:04 -07:00
parent 0080c5ea09
commit 1ff2894af2
17 changed files with 17 additions and 561 deletions

9
NEWS
View file

@ -295,6 +295,9 @@ Removed Functionality
- ``remote_trace_sync_interval``
- ``remote_trace_sync_peers``
- ``remote_check_sync_consistency``
- ``log_rotate_interval``
- ``log_max_size``
- ``log_encryption_key``
- The following constants were used as part of deprecated functionality in version 2.6
or below and are removed from this release:
@ -311,9 +314,9 @@ Removed Functionality
- Broccoli, which had been deprecated in version 2.6 and was no longer built by default
was removed from the source tree.
- Support for the &persistent and the &synchronized attributes, which were deprecated
in Bro 2.6, was removed. The ``-g`` command-line option (dump-config) which relied on
this functionality was also removed.
- Support for the &persistent, &synchronized, &mergeable, &encrypt, &rotate_interval,
and &rotate_size attributes, which were deprecated in Bro 2.6, was removed. The ``-g``
command-line option (dump-config) which relied on this functionality was also removed.
- Removed the BroControl ``update`` command, which was deprecated in Bro 2.6.

View file

@ -4588,18 +4588,9 @@ const cmd_line_bpf_filter = "" &redef;
## the current/maximum limit on open files for the process.
const max_files_in_cache = 0 &redef;
## Deprecated.
const log_rotate_interval = 0 sec &redef;
## Deprecated.
const log_rotate_base_time = "0:00" &redef;
## Deprecated.
const log_max_size = 0.0 &redef;
## Deprecated.
const log_encryption_key = "<undefined>" &redef;
## Write profiling info into this file in regular intervals. The easiest way to
## activate profiling is loading :doc:`/scripts/policy/misc/profiling.zeek`.
##

View file

@ -11,11 +11,9 @@ const char* attr_name(attr_tag t)
{
static const char* attr_names[int(NUM_ATTRS)] = {
"&optional", "&default", "&redef",
"&rotate_interval", "&rotate_size",
"&add_func", "&delete_func", "&expire_func",
"&read_expire", "&write_expire", "&create_expire",
"&encrypt",
"&raw_output", "&mergeable", "&priority",
"&raw_output", "&priority",
"&group", "&log", "&error_handler", "&type_column",
"(&tracked)", "&deprecated",
};
@ -357,21 +355,6 @@ void Attributes::CheckAttr(Attr* a)
}
break;
case ATTR_ROTATE_INTERVAL:
if ( type->Tag() != TYPE_FILE )
Error("&rotate_interval only applicable to files");
break;
case ATTR_ROTATE_SIZE:
if ( type->Tag() != TYPE_FILE )
Error("&rotate_size only applicable to files");
break;
case ATTR_ENCRYPT:
if ( type->Tag() != TYPE_FILE )
Error("&encrypt only applicable to files");
break;
case ATTR_EXPIRE_READ:
case ATTR_EXPIRE_WRITE:
case ATTR_EXPIRE_CREATE:
@ -446,11 +429,6 @@ void Attributes::CheckAttr(Attr* a)
Error("&raw_output only applicable to files");
break;
case ATTR_MERGEABLE:
if ( type->Tag() != TYPE_TABLE )
Error("&mergeable only applicable to tables/sets");
break;
case ATTR_PRIORITY:
Error("&priority only applicable to event bodies");
break;

View file

@ -15,17 +15,13 @@ typedef enum {
ATTR_OPTIONAL,
ATTR_DEFAULT,
ATTR_REDEF,
ATTR_ROTATE_INTERVAL,
ATTR_ROTATE_SIZE,
ATTR_ADD_FUNC,
ATTR_DEL_FUNC,
ATTR_EXPIRE_FUNC,
ATTR_EXPIRE_READ,
ATTR_EXPIRE_WRITE,
ATTR_EXPIRE_CREATE,
ATTR_ENCRYPT,
ATTR_RAW_OUTPUT,
ATTR_MERGEABLE,
ATTR_PRIORITY,
ATTR_GROUP,
ATTR_LOG,

View file

@ -18,15 +18,10 @@
#include <errno.h>
#include <unistd.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/err.h>
#include <algorithm>
#include "File.h"
#include "Type.h"
#include "Timer.h"
#include "Expr.h"
#include "NetVar.h"
#include "Net.h"
@ -34,46 +29,6 @@
#include "Event.h"
#include "Reporter.h"
// Timer which on dispatching rotates the file.
class RotateTimer : public Timer {
public:
RotateTimer(double t, BroFile* f, bool arg_raise) : Timer(t, TIMER_ROTATE)
{ file = f; raise = arg_raise; name = copy_string(f->Name()); }
~RotateTimer();
void Dispatch(double t, int is_expire);
protected:
BroFile* file;
bool raise;
const char* name;
};
RotateTimer::~RotateTimer()
{
if ( file->rotate_timer == this )
file->rotate_timer = 0;
delete [] name;
}
void RotateTimer::Dispatch(double t, int is_expire)
{
file->rotate_timer = 0;
if ( ! is_expire )
{
if ( raise )
{
Ref(file);
mgr.QueueEvent(rotate_interval, {new Val(file)});
}
file->InstallRotateTimer();
}
}
// The following could in principle be part of a "file manager" object.
#define MAX_FILE_CACHE_SIZE 512
@ -81,9 +36,6 @@ static int num_files_in_cache = 0;
static BroFile* head = 0;
static BroFile* tail = 0;
double BroFile::default_rotation_interval = 0;
double BroFile::default_rotation_size = 0;
// Maximizes the number of open file descriptors and returns the number
// that we should use for the cache.
static int maximize_num_fds()
@ -119,9 +71,6 @@ BroFile::BroFile(FILE* arg_f)
name = access = 0;
t = base_type(TYPE_STRING);
is_open = (f != 0);
if ( f )
UpdateFileSize();
}
BroFile::BroFile(FILE* arg_f, const char* arg_name, const char* arg_access)
@ -132,9 +81,6 @@ BroFile::BroFile(FILE* arg_f, const char* arg_name, const char* arg_access)
access = copy_string(arg_access);
t = base_type(TYPE_STRING);
is_open = (f != 0);
if ( f )
UpdateFileSize();
}
BroFile::BroFile(const char* arg_name, const char* arg_access, BroType* arg_t)
@ -193,16 +139,6 @@ bool BroFile::Open(FILE* file, const char* mode)
f = file;
if ( default_rotation_interval &&
(! attrs || ! attrs->FindAttr(ATTR_ROTATE_INTERVAL)) )
rotate_interval = default_rotation_interval;
if ( default_rotation_size &&
(! attrs || ! attrs->FindAttr(ATTR_ROTATE_SIZE)) )
rotate_size = default_rotation_size;
InstallRotateTimer();
if ( ! f )
{
if ( ! mode )
@ -221,7 +157,6 @@ bool BroFile::Open(FILE* file, const char* mode)
is_open = okay_to_manage = 1;
InsertAtBeginning();
UpdateFileSize();
}
else
{
@ -243,7 +178,6 @@ BroFile::~BroFile()
delete [] name;
delete [] access;
delete [] cipher_buffer;
#ifdef USE_PERFTOOLS_DEBUG
heap_checker->UnIgnoreObject(this);
@ -255,18 +189,11 @@ void BroFile::Init()
is_open = okay_to_manage = is_in_cache = 0;
position = 0;
next = prev = 0;
rotate_timer = 0;
rotate_interval = 0.0;
rotate_size = current_size = 0.0;
open_time = 0;
attrs = 0;
buffered = true;
print_hook = true;
raw_output = false;
t = 0;
pub_key = 0;
cipher_ctx = 0;
cipher_buffer = 0;
#ifdef USE_PERFTOOLS_DEBUG
heap_checker->IgnoreObject(this);
@ -317,7 +244,6 @@ FILE* BroFile::BringIntoCache()
}
RaiseOpenEvent();
UpdateFileSize();
if ( fseek(f, position, SEEK_SET) < 0 )
{
@ -354,17 +280,9 @@ void BroFile::SetBuf(bool arg_buffered)
int BroFile::Close()
{
if ( rotate_timer )
{
timer_mgr->Cancel(rotate_timer);
rotate_timer = 0;
}
if ( ! is_open )
return 1;
FinishEncrypt();
// Do not close stdin/stdout/stderr.
if ( f == stdin || f == stdout || f == stderr )
return 0;
@ -515,33 +433,8 @@ void BroFile::SetAttrs(Attributes* arg_attrs)
attrs = arg_attrs;
Ref(attrs);
Attr* ef = attrs->FindAttr(ATTR_ROTATE_INTERVAL);
if ( ef )
rotate_interval = ef->AttrExpr()->ExprVal()->AsInterval();
ef = attrs->FindAttr(ATTR_ROTATE_SIZE);
if ( ef )
rotate_size = ef->AttrExpr()->ExprVal()->AsDouble();
ef = attrs->FindAttr(ATTR_ENCRYPT);
if ( ef )
{
if ( ef->AttrExpr() )
InitEncrypt(ef->AttrExpr()->ExprVal()->AsString()->CheckString());
else
InitEncrypt(opt_internal_string("log_encryption_key")->CheckString());
}
if ( attrs->FindAttr(ATTR_RAW_OUTPUT) )
EnableRawOutput();
InstallRotateTimer();
}
void BroFile::SetRotateInterval(double secs)
{
rotate_interval = secs;
InstallRotateTimer();
}
RecordVal* BroFile::Rotate()
@ -575,178 +468,17 @@ RecordVal* BroFile::Rotate()
return info;
}
void BroFile::InstallRotateTimer()
{
if ( terminating )
return;
if ( rotate_timer )
{
timer_mgr->Cancel(rotate_timer);
rotate_timer = 0;
}
if ( rotate_interval )
{
// When this is called for the first time, network_time can
// still be zero. If so, we set a timer which fires
// immediately but doesn't rotate when it expires.
if ( ! network_time )
rotate_timer = new RotateTimer(1, this, false);
else
{
if ( ! open_time )
open_time = network_time;
const char* base_time = log_rotate_base_time ?
log_rotate_base_time->AsString()->CheckString() : 0;
double base = parse_rotate_base_time(base_time);
double delta_t =
calc_next_rotate(network_time, rotate_interval, base);
rotate_timer = new RotateTimer(network_time + delta_t,
this, true);
}
timer_mgr->Add(rotate_timer);
}
}
void BroFile::SetDefaultRotation(double interval, double max_size)
{
for ( BroFile* f = head; f; f = f->next )
{
if ( ! (f->attrs && f->attrs->FindAttr(ATTR_ROTATE_INTERVAL)) )
{
f->rotate_interval = interval;
f->InstallRotateTimer();
}
if ( ! (f->attrs && f->attrs->FindAttr(ATTR_ROTATE_SIZE)) )
f->rotate_size = max_size;
}
default_rotation_interval = interval;
default_rotation_size = max_size;
}
void BroFile::CloseCachedFiles()
{
BroFile* next;
for ( BroFile* f = head; f; f = next )
{
// Send final rotate events (immediately).
if ( f->rotate_interval )
{
Ref(f);
Event* event = new Event(::rotate_interval, {new Val(f)});
mgr.Dispatch(event, true);
}
if ( f->rotate_size )
{
Ref(f);
Event* event = new ::Event(::rotate_size, {new Val(f)});
mgr.Dispatch(event, true);
}
next = f->next;
if ( f->is_in_cache )
f->Close();
}
}
void BroFile::InitEncrypt(const char* keyfile)
{
if ( ! (pub_key || keyfile) )
return;
if ( ! pub_key )
{
FILE* key = fopen(keyfile, "r");
if ( ! key )
{
reporter->Error("can't open key file %s: %s", keyfile, strerror(errno));
Close();
return;
}
pub_key = PEM_read_PUBKEY(key, 0, 0, 0);
if ( ! pub_key )
{
reporter->Error("can't read key from %s: %s", keyfile,
ERR_error_string(ERR_get_error(), 0));
Close();
return;
}
}
// Depending on the OpenSSL version, EVP_*_cbc()
// returns a const or a non-const.
EVP_CIPHER* cipher_type = (EVP_CIPHER*) EVP_bf_cbc();
cipher_ctx = EVP_CIPHER_CTX_new();
unsigned char secret[EVP_PKEY_size(pub_key)];
unsigned char* psecret = secret;
unsigned int secret_len;
int iv_len = EVP_CIPHER_iv_length(cipher_type);
unsigned char iv[iv_len];
if ( ! EVP_SealInit(cipher_ctx, cipher_type, &psecret,
(int*) &secret_len, iv, &pub_key, 1) )
{
reporter->Error("can't init cipher context for %s: %s", keyfile,
ERR_error_string(ERR_get_error(), 0));
Close();
return;
}
secret_len = htonl(secret_len);
if ( fwrite("BROENC1", 7, 1, f) < 1 ||
fwrite(&secret_len, sizeof(secret_len), 1, f) < 1 ||
fwrite(secret, ntohl(secret_len), 1, f) < 1 ||
fwrite(iv, iv_len, 1, f) < 1 )
{
reporter->Error("can't write header to log file %s: %s",
name, strerror(errno));
Close();
return;
}
int buf_size = MIN_BUFFER_SIZE + EVP_CIPHER_block_size(cipher_type);
cipher_buffer = new unsigned char[buf_size];
}
void BroFile::FinishEncrypt()
{
if ( ! is_open )
return;
if ( ! pub_key )
return;
if ( cipher_ctx )
{
int outl;
EVP_SealFinal(cipher_ctx, cipher_buffer, &outl);
if ( outl && fwrite(cipher_buffer, outl, 1, f) < 1 )
{
reporter->Error("write error for %s: %s",
name, strerror(errno));
return;
}
EVP_CIPHER_CTX_free(cipher_ctx);
cipher_ctx = 0;
}
}
int BroFile::Write(const char* data, int len)
{
if ( ! is_open )
@ -758,50 +490,9 @@ int BroFile::Write(const char* data, int len)
if ( ! len )
len = strlen(data);
if ( cipher_ctx )
{
while ( len )
{
int outl;
int inl = min(+MIN_BUFFER_SIZE, len);
if ( ! EVP_SealUpdate(cipher_ctx, cipher_buffer, &outl,
(unsigned char*)data, inl) )
{
reporter->Error("encryption error for %s: %s",
name,
ERR_error_string(ERR_get_error(), 0));
Close();
return 0;
}
if ( outl && fwrite(cipher_buffer, outl, 1, f) < 1 )
{
reporter->Error("write error for %s: %s",
name, strerror(errno));
Close();
return 0;
}
data += inl;
len -= inl;
}
return 1;
}
if ( fwrite(data, len, 1, f) < 1 )
return false;
if ( rotate_size && current_size < rotate_size && current_size + len >= rotate_size )
{
mgr.QueueEvent(::rotate_size, {new Val(this)});
}
// This does not work if we seek around. But none of the logs does that
// and we avoid stat()'ing the file all the time.
current_size += len;
return true;
}
@ -815,17 +506,17 @@ void BroFile::RaiseOpenEvent()
mgr.Dispatch(event, true);
}
void BroFile::UpdateFileSize()
double BroFile::Size()
{
fflush(f);
struct stat s;
if ( fstat(fileno(f), &s) < 0 )
{
reporter->Error("can't stat fd for %s: %s", name, strerror(errno));
current_size = 0;
return;
return 0;
}
current_size = double(s.st_size);
return s.st_size;
}
bool BroFile::Serialize(SerialInfo* info) const
@ -886,10 +577,6 @@ BroFile* BroFile::Unserialize(UnserialInfo* info)
// *never* be closed anymore (as long the file cache does not overflow).
Ref(file);
// We deliberately override log rotation attributes with our defaults.
file->rotate_interval = log_rotate_interval;
file->rotate_size = log_max_size;
file->InstallRotateTimer();
file->SetBuf(file->buffered);
return file;

View file

@ -12,13 +12,7 @@
# include <krb5.h>
# endif // NEED_KRB5_H
// From OpenSSL. We forward-declare these here to avoid introducing a
// dependency on OpenSSL headers just for this header file.
typedef struct evp_pkey_st EVP_PKEY;
typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
class BroType;
class RotateTimer;
class BroFile : public BroObj {
public:
@ -51,21 +45,14 @@ public:
void Describe(ODesc* d) const override;
void SetRotateInterval(double secs);
// Rotates the logfile. Returns rotate_info.
RecordVal* Rotate();
// Set &rotate_interval, &rotate_size,
// and &raw_output attributes.
// Set &raw_output attribute.
void SetAttrs(Attributes* attrs);
// Returns the current size of the file, after fresh stat'ing.
double Size() { fflush(f); UpdateFileSize(); return current_size; }
// Set rotate/postprocessor for all files that don't define them
// by their own. (interval/max_size=0 for no rotation; size in bytes).
static void SetDefaultRotation(double interval, double max_size);
double Size();
// Close all files which are managed by us.
static void CloseCachedFiles();
@ -83,8 +70,6 @@ public:
static BroFile* Unserialize(UnserialInfo* info);
protected:
friend class RotateTimer;
BroFile() { Init(); }
void Init();
@ -105,7 +90,6 @@ protected:
void Unlink();
void InsertAtBeginning();
void MoveToBeginning();
void InstallRotateTimer();
// Returns nil if the file is not active, was in error, etc.
// (Protected because we do not want anyone to write directly
@ -113,17 +97,9 @@ protected:
FILE* File();
FILE* BringIntoCache();
// Stats the file to get its current size.
void UpdateFileSize();
// Raises a file_opened event.
void RaiseOpenEvent();
// Initialize encryption with the given public key.
void InitEncrypt(const char* keyfile);
// Finalize encryption.
void FinishEncrypt();
DECLARE_SERIAL(BroFile);
FILE* f;
@ -137,28 +113,12 @@ protected:
BroFile* next; // doubly-linked list of cached files
BroFile* prev;
Attributes* attrs;
double rotate_interval;
bool buffered;
// Sizes are double's so that it's easy to specify large
// ones with scientific notation, and so they can exceed 4GB.
double rotate_size;
double current_size;
Timer* rotate_timer;
double open_time;
bool print_hook;
bool raw_output;
static double default_rotation_interval;
static double default_rotation_size;
EVP_PKEY* pub_key;
EVP_CIPHER_CTX* cipher_ctx;
static const int MIN_BUFFER_SIZE = 1024;
unsigned char* cipher_buffer;
};
#endif

View file

@ -64,16 +64,6 @@ void ID::SetVal(Val* v, Opcode op, bool arg_weak_ref)
{
if ( op != OP_NONE )
{
if ( type && val && type->Tag() == TYPE_TABLE &&
val->AsTableVal()->FindAttr(ATTR_MERGEABLE) &&
v->AsTableVal()->FindAttr(ATTR_MERGEABLE) )
{
StateAccess::Log(new StateAccess(OP_ASSIGN, this,
v, val));
v->AsTableVal()->AddTo(val->AsTableVal(), 0, false);
return;
}
MutableVal::Properties props = 0;
if ( attrs && attrs->FindAttr(ATTR_TRACKED) )

View file

@ -165,10 +165,7 @@ TableVal* preserve_resp_addr;
TableVal* preserve_other_addr;
int max_files_in_cache;
double log_rotate_interval;
double log_max_size;
RecordType* rotate_info;
StringVal* log_encryption_key;
StringVal* log_rotate_base_time;
StringVal* peer_description;
@ -249,10 +246,7 @@ void init_general_global_var()
state_write_delay = opt_internal_double("state_write_delay");
max_files_in_cache = opt_internal_int("max_files_in_cache");
log_rotate_interval = opt_internal_double("log_rotate_interval");
log_max_size = opt_internal_double("log_max_size");
rotate_info = internal_type("rotate_info")->AsRecordType();
log_encryption_key = opt_internal_string("log_encryption_key");
log_rotate_base_time = opt_internal_string("log_rotate_base_time");
peer_description =

View file

@ -168,10 +168,7 @@ extern StringVal* state_dir;
extern double state_write_delay;
extern int max_files_in_cache;
extern double log_rotate_interval;
extern double log_max_size;
extern RecordType* rotate_info;
extern StringVal* log_encryption_key;
extern StringVal* log_rotate_base_time;
extern StringVal* peer_description;

View file

@ -133,29 +133,6 @@ void StateAccess::RefThem()
Ref(op3);
}
bool StateAccess::MergeTables(TableVal* dst, Val* src)
{
if ( src->Type()->Tag() != TYPE_TABLE )
{
reporter->Error("type mismatch while merging tables");
return false;
}
if ( ! src->AsTableVal()->FindAttr(ATTR_MERGEABLE) )
return false;
DBG_LOG(DBG_STATE, "merging tables %s += %s", dst->UniqueID()->Name(),
src->AsTableVal()->UniqueID()->Name());
src->AsTableVal()->AddTo(dst, 0);
// We need to make sure that the resulting table is accessible by
// the new name (while keeping the old as an alias).
dst->TransferUniqueID(src->AsMutableVal());
return true;
}
static Val* GetInteger(bro_int_t n, TypeTag t)
{
if ( t == TYPE_INT )
@ -192,11 +169,6 @@ void StateAccess::Replay()
// There mustn't be a direct assignment to a unique ID.
assert(target.id->Name()[0] != '#');
if ( t == TYPE_TABLE && v &&
v->AsTableVal()->FindAttr(ATTR_MERGEABLE) )
if ( MergeTables(v->AsTableVal(), op1.val) )
break;
target.id->SetVal(op1.val->Ref());
break;
@ -227,9 +199,6 @@ void StateAccess::Replay()
{
TableVal* tv = v->AsTableVal();
Val* w = tv->Lookup(op1.val);
if ( w && w->AsTableVal()->FindAttr(ATTR_MERGEABLE) )
if ( MergeTables(w->AsTableVal(), op2) )
break;
}
v->AsTableVal()->Assign(op1.val, op2 ? op2->Ref() : 0);
@ -248,9 +217,6 @@ void StateAccess::Replay()
{
RecordVal* rv = v->AsRecordVal();
Val* w = rv->Lookup(idx);
if ( w && w->AsTableVal()->FindAttr(ATTR_MERGEABLE) )
if ( MergeTables(w->AsTableVal(), op2) )
break;
}
v->AsRecordVal()->Assign(idx, op2 ? op2->Ref() : 0);
@ -270,9 +236,6 @@ void StateAccess::Replay()
{
VectorVal* vv = v->AsVectorVal();
Val* w = vv->Lookup(index);
if ( w && w->AsTableVal()->FindAttr(ATTR_MERGEABLE) )
if ( MergeTables(w->AsTableVal(), op2) )
break;
}
v->AsVectorVal()->Assign(index, op2 ? op2->Ref() : 0);

View file

@ -74,8 +74,6 @@ private:
StateAccess() { target.id = 0; op1.val = op2 = op3 = 0; }
void RefThem();
bool MergeTables(TableVal* dst, Val* src);
DECLARE_SERIAL(StateAccess);
Opcode opcode;

View file

@ -1483,22 +1483,6 @@ int TableVal::Assign(Val* index, HashKey* k, Val* new_val, Opcode op)
BroType* yt = Type()->AsTableType()->YieldType();
if ( yt && yt->Tag() == TYPE_TABLE &&
new_val->AsTableVal()->FindAttr(ATTR_MERGEABLE) )
{
// Join two mergeable sets.
Val* old = Lookup(index, false);
if ( old && old->AsTableVal()->FindAttr(ATTR_MERGEABLE) )
{
if ( LoggingAccess() && op != OP_NONE )
StateAccess::Log(new StateAccess(OP_ASSIGN_IDX,
this, index, new_val, old));
new_val->AsTableVal()->AddTo(old->AsTableVal(), 0, false);
Unref(new_val);
return 1;
}
}
TableEntryVal* new_entry_val = new TableEntryVal(new_val);
HashKey k_copy(k->Key(), k->Size(), k->Hash());
TableEntryVal* old_entry_val = AsNonConstTable()->Insert(k, new_entry_val);
@ -2831,27 +2815,6 @@ RecordVal::~RecordVal()
void RecordVal::Assign(int field, Val* new_val, Opcode op)
{
if ( new_val && Lookup(field) &&
record_type->FieldType(field)->Tag() == TYPE_TABLE &&
new_val->AsTableVal()->FindAttr(ATTR_MERGEABLE) )
{
// Join two mergeable sets.
Val* old = Lookup(field);
if ( old->AsTableVal()->FindAttr(ATTR_MERGEABLE) )
{
if ( LoggingAccess() && op != OP_NONE )
{
StringVal* index = new StringVal(Type()->AsRecordType()->FieldName(field));
StateAccess::Log(new StateAccess(OP_ASSIGN_IDX, this, index, new_val, old));
Unref(index);
}
new_val->AsTableVal()->AddTo(old->AsTableVal(), 0, false);
Unref(new_val);
return;
}
}
Val* old_val = AsNonConstRecord()->replace(field, new_val);
if ( LoggingAccess() && op != OP_NONE )
@ -3213,28 +3176,6 @@ bool VectorVal::Assign(unsigned int index, Val* element, Opcode op)
BroType* yt = Type()->AsVectorType()->YieldType();
if ( yt && yt->Tag() == TYPE_TABLE &&
element->AsTableVal()->FindAttr(ATTR_MERGEABLE) )
{
// Join two mergeable sets.
Val* old = Lookup(index);
if ( old && old->AsTableVal()->FindAttr(ATTR_MERGEABLE) )
{
if ( LoggingAccess() && op != OP_NONE )
{
Val* ival = val_mgr->GetCount(index);
StateAccess::Log(new StateAccess(OP_ASSIGN_IDX,
this, ival, element,
(*val.vector_val)[index]));
Unref(ival);
}
element->AsTableVal()->AddTo(old->AsTableVal(), 0, false);
Unref(element);
return true;
}
}
Val* val_at_index = 0;
if ( index < val.vector_val->size() )

View file

@ -106,9 +106,6 @@ void TCP_Reassembler::SetContentsFile(BroFile* f)
RecordToSeq(blocks->seq, last_reassem_seq, f);
}
// Don't want rotation on these files.
f->SetRotateInterval(0);
Ref(f);
record_contents_file = f;
}

View file

@ -884,11 +884,5 @@ event gaobot_signature_found%(c: connection%);
## Deprecated. Will be removed.
event anonymization_mapping%(orig: addr, mapped: addr%);
## Deprecated. Will be removed.
event rotate_interval%(f: file%);
## Deprecated. Will be removed.
event rotate_size%(f: file%);
## Deprecated. Will be removed.
event print_hook%(f:file, s: string%);

View file

@ -944,8 +944,6 @@ int main(int argc, char** argv)
if ( dns_type != DNS_PRIME )
net_init(interfaces, read_files, writefile, do_watchdog);
BroFile::SetDefaultRotation(log_rotate_interval, log_max_size);
net_done = internal_handler("net_done");
if ( ! g_policy_debug )

View file

@ -5,7 +5,7 @@
// Switching parser table type fixes ambiguity problems.
%define lr.type ielr
%expect 129
%expect 103
%token TOK_ADD TOK_ADD_TO TOK_ADDR TOK_ANY
%token TOK_ATENDIF TOK_ATELSE TOK_ATIF TOK_ATIFDEF TOK_ATIFNDEF
@ -21,11 +21,10 @@
%token TOK_TIME TOK_TIMEOUT TOK_TIMER TOK_TYPE TOK_UNION TOK_VECTOR TOK_WHEN
%token TOK_WHILE TOK_AS TOK_IS
%token TOK_ATTR_ADD_FUNC TOK_ATTR_ENCRYPT TOK_ATTR_DEFAULT
%token TOK_ATTR_OPTIONAL TOK_ATTR_REDEF TOK_ATTR_ROTATE_INTERVAL
%token TOK_ATTR_ROTATE_SIZE TOK_ATTR_DEL_FUNC TOK_ATTR_EXPIRE_FUNC
%token TOK_ATTR_ADD_FUNC TOK_ATTR_DEFAULT TOK_ATTR_OPTIONAL TOK_ATTR_REDEF
%token TOK_ATTR_DEL_FUNC TOK_ATTR_EXPIRE_FUNC
%token TOK_ATTR_EXPIRE_CREATE TOK_ATTR_EXPIRE_READ TOK_ATTR_EXPIRE_WRITE
%token TOK_ATTR_RAW_OUTPUT TOK_ATTR_MERGEABLE
%token TOK_ATTR_RAW_OUTPUT
%token TOK_ATTR_PRIORITY TOK_ATTR_LOG TOK_ATTR_ERROR_HANDLER
%token TOK_ATTR_TYPE_COLUMN TOK_ATTR_DEPRECATED
@ -1291,10 +1290,6 @@ attr:
{ $$ = new Attr(ATTR_OPTIONAL); }
| TOK_ATTR_REDEF
{ $$ = new Attr(ATTR_REDEF); }
| TOK_ATTR_ROTATE_INTERVAL '=' expr
{ $$ = new Attr(ATTR_ROTATE_INTERVAL, $3); }
| TOK_ATTR_ROTATE_SIZE '=' expr
{ $$ = new Attr(ATTR_ROTATE_SIZE, $3); }
| TOK_ATTR_ADD_FUNC '=' expr
{ $$ = new Attr(ATTR_ADD_FUNC, $3); }
| TOK_ATTR_DEL_FUNC '=' expr
@ -1307,14 +1302,8 @@ attr:
{ $$ = new Attr(ATTR_EXPIRE_READ, $3); }
| TOK_ATTR_EXPIRE_WRITE '=' expr
{ $$ = new Attr(ATTR_EXPIRE_WRITE, $3); }
| TOK_ATTR_ENCRYPT
{ $$ = new Attr(ATTR_ENCRYPT); }
| TOK_ATTR_ENCRYPT '=' expr
{ $$ = new Attr(ATTR_ENCRYPT, $3); }
| TOK_ATTR_RAW_OUTPUT
{ $$ = new Attr(ATTR_RAW_OUTPUT); }
| TOK_ATTR_MERGEABLE
{ $$ = new Attr(ATTR_MERGEABLE); }
| TOK_ATTR_PRIORITY '=' expr
{ $$ = new Attr(ATTR_PRIORITY, $3); }
| TOK_ATTR_TYPE_COLUMN '=' expr

View file

@ -300,26 +300,6 @@ when return TOK_WHEN;
&redef return TOK_ATTR_REDEF;
&write_expire return TOK_ATTR_EXPIRE_WRITE;
&encrypt {
deprecated_attr(yytext);
return TOK_ATTR_ENCRYPT;
}
&mergeable {
deprecated_attr(yytext);
return TOK_ATTR_MERGEABLE;
}
&rotate_interval {
deprecated_attr(yytext);
return TOK_ATTR_ROTATE_INTERVAL;
}
&rotate_size {
deprecated_attr(yytext);
return TOK_ATTR_ROTATE_SIZE;
}
@deprecated.* {
auto num_files = file_stack.length();
auto comment = skip_whitespace(yytext + 11);