mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Pass over the InternalError() changes.
This commit is contained in:
parent
af446ec189
commit
d6855dc4eb
14 changed files with 33 additions and 52 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 7ca51fc46c5c3dd4f3d803e5c617c2e35129fb05
|
Subproject commit 81fa2d664a7ef7306a03928484b10611fbe893b8
|
19
src/Conn.cc
19
src/Conn.cc
|
@ -27,6 +27,9 @@ void ConnectionTimer::Init(Connection* arg_conn, timer_func arg_timer,
|
||||||
|
|
||||||
ConnectionTimer::~ConnectionTimer()
|
ConnectionTimer::~ConnectionTimer()
|
||||||
{
|
{
|
||||||
|
if ( conn->RefCnt() < 1 )
|
||||||
|
reporter->InternalError("reference count inconsistency in ~ConnectionTimer");
|
||||||
|
|
||||||
conn->RemoveTimer(this);
|
conn->RemoveTimer(this);
|
||||||
Unref(conn);
|
Unref(conn);
|
||||||
}
|
}
|
||||||
|
@ -41,6 +44,9 @@ void ConnectionTimer::Dispatch(double t, int is_expire)
|
||||||
conn->RemoveTimer(this);
|
conn->RemoveTimer(this);
|
||||||
|
|
||||||
(conn->*timer)(t);
|
(conn->*timer)(t);
|
||||||
|
|
||||||
|
if ( conn->RefCnt() < 1 )
|
||||||
|
reporter->InternalError("reference count inconsistency in ConnectionTimer::Dispatch");
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPLEMENT_SERIAL(ConnectionTimer, SER_CONNECTION_TIMER);
|
IMPLEMENT_SERIAL(ConnectionTimer, SER_CONNECTION_TIMER);
|
||||||
|
@ -62,10 +68,7 @@ bool ConnectionTimer::DoSerialize(SerialInfo* info) const
|
||||||
else if ( timer == timer_func(&Connection::RemoveConnectionTimer) )
|
else if ( timer == timer_func(&Connection::RemoveConnectionTimer) )
|
||||||
type = 4;
|
type = 4;
|
||||||
else
|
else
|
||||||
{
|
reporter->InternalError("unknown function in ConnectionTimer::DoSerialize()");
|
||||||
reporter->InternalWarning("unknown function in ConnectionTimer::DoSerialize()");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return conn->Serialize(info) && SERIALIZE(type) && SERIALIZE(do_expire);
|
return conn->Serialize(info) && SERIALIZE(type) && SERIALIZE(do_expire);
|
||||||
}
|
}
|
||||||
|
@ -177,12 +180,7 @@ Connection::Connection(NetSessions* s, HashKey* k, double t, const ConnID* id,
|
||||||
Connection::~Connection()
|
Connection::~Connection()
|
||||||
{
|
{
|
||||||
if ( ! finished )
|
if ( ! finished )
|
||||||
{
|
reporter->InternalError("Done() not called before destruction of Connection");
|
||||||
// TODO: not sure about this
|
|
||||||
reporter->InternalWarning(
|
|
||||||
"missing Connection::Done() before ~Connection");
|
|
||||||
Done();
|
|
||||||
}
|
|
||||||
|
|
||||||
CancelTimers();
|
CancelTimers();
|
||||||
|
|
||||||
|
@ -793,7 +791,6 @@ void Connection::Describe(ODesc* d) const
|
||||||
default:
|
default:
|
||||||
reporter->InternalError(
|
reporter->InternalError(
|
||||||
"unhandled transport type in Connection::Describe");
|
"unhandled transport type in Connection::Describe");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
d->SP();
|
d->SP();
|
||||||
|
|
11
src/Desc.cc
11
src/Desc.cc
|
@ -65,20 +65,15 @@ void ODesc::PushIndent()
|
||||||
void ODesc::PopIndent()
|
void ODesc::PopIndent()
|
||||||
{
|
{
|
||||||
if ( --indent_level < 0 )
|
if ( --indent_level < 0 )
|
||||||
{
|
reporter->InternalError("ODesc::PopIndent underflow");
|
||||||
indent_level = 0;
|
|
||||||
reporter->InternalWarning("ODesc::PopIndent underflow");
|
|
||||||
}
|
|
||||||
NL();
|
NL();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ODesc::PopIndentNoNL()
|
void ODesc::PopIndentNoNL()
|
||||||
{
|
{
|
||||||
if ( --indent_level < 0 )
|
if ( --indent_level < 0 )
|
||||||
{
|
reporter->InternalError("ODesc::PopIndent underflow");
|
||||||
indent_level = 0;
|
|
||||||
reporter->InternalWarning("ODesc::PopIndent underflow");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ODesc::Add(const char* s, int do_indent)
|
void ODesc::Add(const char* s, int do_indent)
|
||||||
|
|
|
@ -91,10 +91,7 @@ void EventMgr::QueueEvent(Event* event)
|
||||||
void EventMgr::Dispatch()
|
void EventMgr::Dispatch()
|
||||||
{
|
{
|
||||||
if ( ! head )
|
if ( ! head )
|
||||||
{
|
reporter->InternalError("EventMgr::Dispatch underflow");
|
||||||
reporter->InternalWarning("EventMgr::Dispatch underflow");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Event* current = head;
|
Event* current = head;
|
||||||
|
|
||||||
|
|
22
src/File.cc
22
src/File.cc
|
@ -284,10 +284,7 @@ FILE* BroFile::BringIntoCache()
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
|
||||||
if ( f )
|
if ( f )
|
||||||
{
|
reporter->InternalError("BroFile non-nil non-open file");
|
||||||
reporter->InternalWarning("BroFile non-nil non-open file");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( num_files_in_cache >= max_files_in_cache )
|
if ( num_files_in_cache >= max_files_in_cache )
|
||||||
PurgeCache();
|
PurgeCache();
|
||||||
|
@ -313,7 +310,7 @@ FILE* BroFile::BringIntoCache()
|
||||||
}
|
}
|
||||||
|
|
||||||
strerror_r(errno, buf, sizeof(buf));
|
strerror_r(errno, buf, sizeof(buf));
|
||||||
reporter->InternalWarning("can't open /dev/null: %s", buf);
|
reporter->Error("can't open /dev/null: %s", buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,24 +396,15 @@ int BroFile::Close()
|
||||||
void BroFile::Suspend()
|
void BroFile::Suspend()
|
||||||
{
|
{
|
||||||
if ( ! is_in_cache )
|
if ( ! is_in_cache )
|
||||||
{
|
reporter->InternalError("BroFile::Suspend() called for non-cached file");
|
||||||
reporter->InternalWarning("BroFile::Suspend() called for non-cached file");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! is_open )
|
if ( ! is_open )
|
||||||
{
|
reporter->InternalError("BroFile::Suspend() called for non-open file");
|
||||||
reporter->InternalWarning("BroFile::Suspend() called for non-open file");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Unlink();
|
Unlink();
|
||||||
|
|
||||||
if ( ! f )
|
if ( ! f )
|
||||||
{
|
reporter->InternalError("BroFile::Suspend() called for nil file");
|
||||||
reporter->InternalWarning("BroFile::Suspend() called for nil file");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (position = ftell(f)) < 0 )
|
if ( (position = ftell(f)) < 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -164,11 +164,13 @@ void FragReassembler::Weird(const char* name) const
|
||||||
IP_Hdr hdr((const ip*)proto_hdr, false);
|
IP_Hdr hdr((const ip*)proto_hdr, false);
|
||||||
s->Weird(name, &hdr);
|
s->Weird(name, &hdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( version == 6 )
|
else if ( version == 6 )
|
||||||
{
|
{
|
||||||
IP_Hdr hdr((const ip6_hdr*)proto_hdr, false, proto_hdr_len);
|
IP_Hdr hdr((const ip6_hdr*)proto_hdr, false, proto_hdr_len);
|
||||||
s->Weird(name, &hdr);
|
s->Weird(name, &hdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
reporter->InternalWarning("Unexpected IP version in FragReassembler");
|
reporter->InternalWarning("Unexpected IP version in FragReassembler");
|
||||||
|
|
8
src/IP.h
8
src/IP.h
|
@ -182,6 +182,7 @@ public:
|
||||||
reporter->InternalWarning("empty IPv6 header chain");
|
reporter->InternalWarning("empty IPv6 header chain");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return chain[chain.size()-1]->Type() == IPPROTO_FRAGMENT;
|
return chain[chain.size()-1]->Type() == IPPROTO_FRAGMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,6 +230,7 @@ public:
|
||||||
reporter->InternalWarning("empty IPv6 header chain");
|
reporter->InternalWarning("empty IPv6 header chain");
|
||||||
return IPAddr();
|
return IPAddr();
|
||||||
}
|
}
|
||||||
|
|
||||||
return IPAddr(((const struct ip6_hdr*)(chain[0]->Data()))->ip6_src);
|
return IPAddr(((const struct ip6_hdr*)(chain[0]->Data()))->ip6_src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,11 +243,13 @@ public:
|
||||||
{
|
{
|
||||||
if ( finalDst )
|
if ( finalDst )
|
||||||
return IPAddr(*finalDst);
|
return IPAddr(*finalDst);
|
||||||
|
|
||||||
if ( chain.empty() )
|
if ( chain.empty() )
|
||||||
{
|
{
|
||||||
reporter->InternalWarning("empty IPv6 header chain");
|
reporter->InternalWarning("empty IPv6 header chain");
|
||||||
return IPAddr();
|
return IPAddr();
|
||||||
}
|
}
|
||||||
|
|
||||||
return IPAddr(((const struct ip6_hdr*)(chain[0]->Data()))->ip6_dst);
|
return IPAddr(((const struct ip6_hdr*)(chain[0]->Data()))->ip6_dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,9 +465,11 @@ public:
|
||||||
{
|
{
|
||||||
if ( ip4 )
|
if ( ip4 )
|
||||||
return IPPROTO_RAW;
|
return IPPROTO_RAW;
|
||||||
|
|
||||||
size_t i = ip6_hdrs->Size();
|
size_t i = ip6_hdrs->Size();
|
||||||
if ( i > 0 )
|
if ( i > 0 )
|
||||||
return (*ip6_hdrs)[i-1]->Type();
|
return (*ip6_hdrs)[i-1]->Type();
|
||||||
|
|
||||||
return IPPROTO_NONE;
|
return IPPROTO_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,9 +482,11 @@ public:
|
||||||
{
|
{
|
||||||
if ( ip4 )
|
if ( ip4 )
|
||||||
return ip4->ip_p;
|
return ip4->ip_p;
|
||||||
|
|
||||||
size_t i = ip6_hdrs->Size();
|
size_t i = ip6_hdrs->Size();
|
||||||
if ( i > 0 )
|
if ( i > 0 )
|
||||||
return (*ip6_hdrs)[i-1]->NextHdr();
|
return (*ip6_hdrs)[i-1]->NextHdr();
|
||||||
|
|
||||||
return IPPROTO_NONE;
|
return IPPROTO_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ DataBlock::DataBlock(const u_char* data, int size, int arg_seq,
|
||||||
{
|
{
|
||||||
seq = arg_seq;
|
seq = arg_seq;
|
||||||
upper = seq + size;
|
upper = seq + size;
|
||||||
|
|
||||||
block = new u_char[size];
|
block = new u_char[size];
|
||||||
|
|
||||||
memcpy((void*) block, (const void*) data, size);
|
memcpy((void*) block, (const void*) data, size);
|
||||||
|
|
|
@ -3607,9 +3607,9 @@ bool SocketComm::ProcessParentMessage()
|
||||||
|
|
||||||
default:
|
default:
|
||||||
InternalError("unknown msgstate");
|
InternalError("unknown msgstate");
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cannot be reached.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ public:
|
||||||
// dump after the message has been reported.
|
// dump after the message has been reported.
|
||||||
void InternalError(const char* fmt, ...) FMT_ATTR;
|
void InternalError(const char* fmt, ...) FMT_ATTR;
|
||||||
|
|
||||||
// Reporter an internal analyzer error. That analyzer will not process
|
// Report an internal analyzer error. That analyzer will not process
|
||||||
// any further input, but Bro otherwise continues normally.
|
// any further input, but Bro otherwise continues normally.
|
||||||
void InternalAnalyzerError(analyzer::Analyzer* a, const char* fmt, ...);
|
void InternalAnalyzerError(analyzer::Analyzer* a, const char* fmt, ...);
|
||||||
|
|
||||||
|
|
|
@ -557,12 +557,8 @@ void MIME_Entity::init()
|
||||||
MIME_Entity::~MIME_Entity()
|
MIME_Entity::~MIME_Entity()
|
||||||
{
|
{
|
||||||
if ( ! end_of_data )
|
if ( ! end_of_data )
|
||||||
{
|
reporter->AnalyzerError(message ? message->GetAnalyzer() : 0,
|
||||||
// TODO: not sure about this
|
|
||||||
reporter->InternalWarning(
|
|
||||||
"missing MIME_Entity::EndOfData() before ~MIME_Entity");
|
"missing MIME_Entity::EndOfData() before ~MIME_Entity");
|
||||||
EndOfData();
|
|
||||||
}
|
|
||||||
|
|
||||||
delete current_header_line;
|
delete current_header_line;
|
||||||
Unref(content_type_str);
|
Unref(content_type_str);
|
||||||
|
|
|
@ -1580,7 +1580,7 @@ BroFile* TCP_Analyzer::GetContentsFile(unsigned int direction) const
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
reporter->Error("bad direction %u in TCP_Analyzer::GetContentsFile",
|
reporter->InternalWarning("bad direction %u in TCP_Analyzer::GetContentsFile",
|
||||||
direction);
|
direction);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ static void delete_value_ptr_array(Value** vals, int num_fields)
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < num_fields; ++i )
|
for ( int i = 0; i < num_fields; ++i )
|
||||||
delete vals[i];
|
delete vals[i];
|
||||||
|
|
||||||
delete [] vals;
|
delete [] vals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,6 @@ bool Value::Read(SerializationFormat* fmt)
|
||||||
default:
|
default:
|
||||||
reporter->InternalError("unsupported type %s in Value::Read",
|
reporter->InternalError("unsupported type %s in Value::Read",
|
||||||
type_name(type));
|
type_name(type));
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -402,7 +401,6 @@ bool Value::Write(SerializationFormat* fmt) const
|
||||||
default:
|
default:
|
||||||
reporter->InternalError("unsupported type %s in Value::Write",
|
reporter->InternalError("unsupported type %s in Value::Write",
|
||||||
type_name(type));
|
type_name(type));
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue