mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +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()
|
||||
{
|
||||
if ( conn->RefCnt() < 1 )
|
||||
reporter->InternalError("reference count inconsistency in ~ConnectionTimer");
|
||||
|
||||
conn->RemoveTimer(this);
|
||||
Unref(conn);
|
||||
}
|
||||
|
@ -41,6 +44,9 @@ void ConnectionTimer::Dispatch(double t, int is_expire)
|
|||
conn->RemoveTimer(this);
|
||||
|
||||
(conn->*timer)(t);
|
||||
|
||||
if ( conn->RefCnt() < 1 )
|
||||
reporter->InternalError("reference count inconsistency in ConnectionTimer::Dispatch");
|
||||
}
|
||||
|
||||
IMPLEMENT_SERIAL(ConnectionTimer, SER_CONNECTION_TIMER);
|
||||
|
@ -62,10 +68,7 @@ bool ConnectionTimer::DoSerialize(SerialInfo* info) const
|
|||
else if ( timer == timer_func(&Connection::RemoveConnectionTimer) )
|
||||
type = 4;
|
||||
else
|
||||
{
|
||||
reporter->InternalWarning("unknown function in ConnectionTimer::DoSerialize()");
|
||||
return false;
|
||||
}
|
||||
reporter->InternalError("unknown function in ConnectionTimer::DoSerialize()");
|
||||
|
||||
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()
|
||||
{
|
||||
if ( ! finished )
|
||||
{
|
||||
// TODO: not sure about this
|
||||
reporter->InternalWarning(
|
||||
"missing Connection::Done() before ~Connection");
|
||||
Done();
|
||||
}
|
||||
reporter->InternalError("Done() not called before destruction of Connection");
|
||||
|
||||
CancelTimers();
|
||||
|
||||
|
@ -793,7 +791,6 @@ void Connection::Describe(ODesc* d) const
|
|||
default:
|
||||
reporter->InternalError(
|
||||
"unhandled transport type in Connection::Describe");
|
||||
break;
|
||||
}
|
||||
|
||||
d->SP();
|
||||
|
|
11
src/Desc.cc
11
src/Desc.cc
|
@ -65,20 +65,15 @@ void ODesc::PushIndent()
|
|||
void ODesc::PopIndent()
|
||||
{
|
||||
if ( --indent_level < 0 )
|
||||
{
|
||||
indent_level = 0;
|
||||
reporter->InternalWarning("ODesc::PopIndent underflow");
|
||||
}
|
||||
reporter->InternalError("ODesc::PopIndent underflow");
|
||||
|
||||
NL();
|
||||
}
|
||||
|
||||
void ODesc::PopIndentNoNL()
|
||||
{
|
||||
if ( --indent_level < 0 )
|
||||
{
|
||||
indent_level = 0;
|
||||
reporter->InternalWarning("ODesc::PopIndent underflow");
|
||||
}
|
||||
reporter->InternalError("ODesc::PopIndent underflow");
|
||||
}
|
||||
|
||||
void ODesc::Add(const char* s, int do_indent)
|
||||
|
|
|
@ -91,10 +91,7 @@ void EventMgr::QueueEvent(Event* event)
|
|||
void EventMgr::Dispatch()
|
||||
{
|
||||
if ( ! head )
|
||||
{
|
||||
reporter->InternalWarning("EventMgr::Dispatch underflow");
|
||||
return;
|
||||
}
|
||||
reporter->InternalError("EventMgr::Dispatch underflow");
|
||||
|
||||
Event* current = head;
|
||||
|
||||
|
|
22
src/File.cc
22
src/File.cc
|
@ -284,10 +284,7 @@ FILE* BroFile::BringIntoCache()
|
|||
char buf[256];
|
||||
|
||||
if ( f )
|
||||
{
|
||||
reporter->InternalWarning("BroFile non-nil non-open file");
|
||||
return 0;
|
||||
}
|
||||
reporter->InternalError("BroFile non-nil non-open file");
|
||||
|
||||
if ( num_files_in_cache >= max_files_in_cache )
|
||||
PurgeCache();
|
||||
|
@ -313,7 +310,7 @@ FILE* BroFile::BringIntoCache()
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -399,24 +396,15 @@ int BroFile::Close()
|
|||
void BroFile::Suspend()
|
||||
{
|
||||
if ( ! is_in_cache )
|
||||
{
|
||||
reporter->InternalWarning("BroFile::Suspend() called for non-cached file");
|
||||
return;
|
||||
}
|
||||
reporter->InternalError("BroFile::Suspend() called for non-cached file");
|
||||
|
||||
if ( ! is_open )
|
||||
{
|
||||
reporter->InternalWarning("BroFile::Suspend() called for non-open file");
|
||||
return;
|
||||
}
|
||||
reporter->InternalError("BroFile::Suspend() called for non-open file");
|
||||
|
||||
Unlink();
|
||||
|
||||
if ( ! f )
|
||||
{
|
||||
reporter->InternalWarning("BroFile::Suspend() called for nil file");
|
||||
return;
|
||||
}
|
||||
reporter->InternalError("BroFile::Suspend() called for nil file");
|
||||
|
||||
if ( (position = ftell(f)) < 0 )
|
||||
{
|
||||
|
|
|
@ -164,11 +164,13 @@ void FragReassembler::Weird(const char* name) const
|
|||
IP_Hdr hdr((const ip*)proto_hdr, false);
|
||||
s->Weird(name, &hdr);
|
||||
}
|
||||
|
||||
else if ( version == 6 )
|
||||
{
|
||||
IP_Hdr hdr((const ip6_hdr*)proto_hdr, false, proto_hdr_len);
|
||||
s->Weird(name, &hdr);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
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");
|
||||
return false;
|
||||
}
|
||||
|
||||
return chain[chain.size()-1]->Type() == IPPROTO_FRAGMENT;
|
||||
}
|
||||
|
||||
|
@ -229,6 +230,7 @@ public:
|
|||
reporter->InternalWarning("empty IPv6 header chain");
|
||||
return IPAddr();
|
||||
}
|
||||
|
||||
return IPAddr(((const struct ip6_hdr*)(chain[0]->Data()))->ip6_src);
|
||||
}
|
||||
|
||||
|
@ -241,11 +243,13 @@ public:
|
|||
{
|
||||
if ( finalDst )
|
||||
return IPAddr(*finalDst);
|
||||
|
||||
if ( chain.empty() )
|
||||
{
|
||||
reporter->InternalWarning("empty IPv6 header chain");
|
||||
return IPAddr();
|
||||
}
|
||||
|
||||
return IPAddr(((const struct ip6_hdr*)(chain[0]->Data()))->ip6_dst);
|
||||
}
|
||||
|
||||
|
@ -461,9 +465,11 @@ public:
|
|||
{
|
||||
if ( ip4 )
|
||||
return IPPROTO_RAW;
|
||||
|
||||
size_t i = ip6_hdrs->Size();
|
||||
if ( i > 0 )
|
||||
return (*ip6_hdrs)[i-1]->Type();
|
||||
|
||||
return IPPROTO_NONE;
|
||||
}
|
||||
|
||||
|
@ -476,9 +482,11 @@ public:
|
|||
{
|
||||
if ( ip4 )
|
||||
return ip4->ip_p;
|
||||
|
||||
size_t i = ip6_hdrs->Size();
|
||||
if ( i > 0 )
|
||||
return (*ip6_hdrs)[i-1]->NextHdr();
|
||||
|
||||
return IPPROTO_NONE;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ DataBlock::DataBlock(const u_char* data, int size, int arg_seq,
|
|||
{
|
||||
seq = arg_seq;
|
||||
upper = seq + size;
|
||||
|
||||
block = new u_char[size];
|
||||
|
||||
memcpy((void*) block, (const void*) data, size);
|
||||
|
|
|
@ -3607,9 +3607,9 @@ bool SocketComm::ProcessParentMessage()
|
|||
|
||||
default:
|
||||
InternalError("unknown msgstate");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Cannot be reached.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
// dump after the message has been reported.
|
||||
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.
|
||||
void InternalAnalyzerError(analyzer::Analyzer* a, const char* fmt, ...);
|
||||
|
||||
|
|
|
@ -557,12 +557,8 @@ void MIME_Entity::init()
|
|||
MIME_Entity::~MIME_Entity()
|
||||
{
|
||||
if ( ! end_of_data )
|
||||
{
|
||||
// TODO: not sure about this
|
||||
reporter->InternalWarning(
|
||||
reporter->AnalyzerError(message ? message->GetAnalyzer() : 0,
|
||||
"missing MIME_Entity::EndOfData() before ~MIME_Entity");
|
||||
EndOfData();
|
||||
}
|
||||
|
||||
delete current_header_line;
|
||||
Unref(content_type_str);
|
||||
|
|
|
@ -1580,7 +1580,7 @@ BroFile* TCP_Analyzer::GetContentsFile(unsigned int direction) const
|
|||
default:
|
||||
break;
|
||||
}
|
||||
reporter->Error("bad direction %u in TCP_Analyzer::GetContentsFile",
|
||||
reporter->InternalWarning("bad direction %u in TCP_Analyzer::GetContentsFile",
|
||||
direction);
|
||||
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 )
|
||||
delete vals[i];
|
||||
|
||||
delete [] vals;
|
||||
}
|
||||
|
||||
|
|
|
@ -296,7 +296,6 @@ bool Value::Read(SerializationFormat* fmt)
|
|||
default:
|
||||
reporter->InternalError("unsupported type %s in Value::Read",
|
||||
type_name(type));
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -402,7 +401,6 @@ bool Value::Write(SerializationFormat* fmt) const
|
|||
default:
|
||||
reporter->InternalError("unsupported type %s in Value::Write",
|
||||
type_name(type));
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue