mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
A number of bugfixes for the recent threading updates.
All tests pass now except one: scripts.base.frameworks.metrics.cluster-intermediate-update Couldn't figure out yet why that still fails.
This commit is contained in:
parent
629ec31ec2
commit
df874f0f62
5 changed files with 63 additions and 28 deletions
|
@ -47,7 +47,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param in6 The IPv6 address.
|
* @param in6 The IPv6 address.
|
||||||
*/
|
*/
|
||||||
IPAddr(const in4_addr& in4)
|
explicit IPAddr(const in4_addr& in4)
|
||||||
{
|
{
|
||||||
memcpy(in6.s6_addr, v4_mapped_prefix, sizeof(v4_mapped_prefix));
|
memcpy(in6.s6_addr, v4_mapped_prefix, sizeof(v4_mapped_prefix));
|
||||||
memcpy(&in6.s6_addr[12], &in4.s_addr, sizeof(in4.s_addr));
|
memcpy(&in6.s6_addr[12], &in4.s_addr, sizeof(in4.s_addr));
|
||||||
|
@ -58,7 +58,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param in6 The IPv6 address.
|
* @param in6 The IPv6 address.
|
||||||
*/
|
*/
|
||||||
IPAddr(const in6_addr& arg_in6) : in6(arg_in6) { }
|
explicit IPAddr(const in6_addr& arg_in6) : in6(arg_in6) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an address instance from a string representation.
|
* Constructs an address instance from a string representation.
|
||||||
|
@ -523,8 +523,6 @@ public:
|
||||||
*/
|
*/
|
||||||
string AsString() const;
|
string AsString() const;
|
||||||
|
|
||||||
/** Converts the address into the type used internally by the inter-thread communicastion.
|
|
||||||
*/
|
|
||||||
operator std::string() const { return AsString(); }
|
operator std::string() const { return AsString(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -295,7 +295,6 @@ bool BinarySerializationFormat::Read(struct in6_addr* addr, const char* tag)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool BinarySerializationFormat::Write(char v, const char* tag)
|
bool BinarySerializationFormat::Write(char v, const char* tag)
|
||||||
{
|
{
|
||||||
DBG_LOG(DBG_SERIAL, "Write char %s [%s]", fmt_bytes(&v, 1), tag);
|
DBG_LOG(DBG_SERIAL, "Write char %s [%s]", fmt_bytes(&v, 1), tag);
|
||||||
|
@ -389,10 +388,9 @@ bool BinarySerializationFormat::Write(const IPPrefix& prefix, const char* tag)
|
||||||
return Write(prefix.Prefix(), "prefix") && Write(prefix.Length(), "width");
|
return Write(prefix.Prefix(), "prefix") && Write(prefix.Length(), "width");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BinarySerializationFormat::Write(struct in_addr& addr, const char* tag)
|
bool BinarySerializationFormat::Write(const struct in_addr& addr, const char* tag)
|
||||||
{
|
{
|
||||||
const uint32_t* bytes;
|
const uint32_t* bytes = (uint32_t*) &addr.s_addr;
|
||||||
bytes = (uint32_t*) &addr.s_addr;
|
|
||||||
|
|
||||||
if ( ! Write(ntohl(bytes[0]), "addr4") )
|
if ( ! Write(ntohl(bytes[0]), "addr4") )
|
||||||
return false;
|
return false;
|
||||||
|
@ -400,10 +398,9 @@ bool BinarySerializationFormat::Write(struct in_addr& addr, const char* tag)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BinarySerializationFormat::Write(struct in6_addr& addr, const char* tag)
|
bool BinarySerializationFormat::Write(const struct in6_addr& addr, const char* tag)
|
||||||
{
|
{
|
||||||
const uint32_t* bytes;
|
const uint32_t* bytes = (uint32_t*) &addr.s6_addr;
|
||||||
bytes = (uint32_t*) &addr.s6_addr;
|
|
||||||
|
|
||||||
for ( int i = 0; i < 4; ++i )
|
for ( int i = 0; i < 4; ++i )
|
||||||
{
|
{
|
||||||
|
@ -620,13 +617,13 @@ bool XMLSerializationFormat::Write(const IPPrefix& prefix, const char* tag)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XMLSerializationFormat::Write(struct in_addr& addr, const char* tag)
|
bool XMLSerializationFormat::Write(const struct in_addr& addr, const char* tag)
|
||||||
{
|
{
|
||||||
reporter->InternalError("XML output of in_addr not implemented");
|
reporter->InternalError("XML output of in_addr not implemented");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XMLSerializationFormat::Write(struct in6_addr& addr, const char* tag)
|
bool XMLSerializationFormat::Write(const struct in6_addr& addr, const char* tag)
|
||||||
{
|
{
|
||||||
reporter->InternalError("XML output of in6_addr not implemented");
|
reporter->InternalError("XML output of in6_addr not implemented");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -59,8 +59,8 @@ public:
|
||||||
virtual bool Write(const string& s, const char* tag) = 0;
|
virtual bool Write(const string& s, const char* tag) = 0;
|
||||||
virtual bool Write(const IPAddr& addr, const char* tag) = 0;
|
virtual bool Write(const IPAddr& addr, const char* tag) = 0;
|
||||||
virtual bool Write(const IPPrefix& prefix, const char* tag) = 0;
|
virtual bool Write(const IPPrefix& prefix, const char* tag) = 0;
|
||||||
virtual bool Write(struct in_addr& addr, const char* tag) = 0;
|
virtual bool Write(const struct in_addr& addr, const char* tag) = 0;
|
||||||
virtual bool Write(struct in6_addr& addr, const char* tag) = 0;
|
virtual bool Write(const struct in6_addr& addr, const char* tag) = 0;
|
||||||
|
|
||||||
virtual bool WriteOpenTag(const char* tag) = 0;
|
virtual bool WriteOpenTag(const char* tag) = 0;
|
||||||
virtual bool WriteCloseTag(const char* tag) = 0;
|
virtual bool WriteCloseTag(const char* tag) = 0;
|
||||||
|
@ -118,8 +118,8 @@ public:
|
||||||
virtual bool Write(const string& s, const char* tag);
|
virtual bool Write(const string& s, const char* tag);
|
||||||
virtual bool Write(const IPAddr& addr, const char* tag);
|
virtual bool Write(const IPAddr& addr, const char* tag);
|
||||||
virtual bool Write(const IPPrefix& prefix, const char* tag);
|
virtual bool Write(const IPPrefix& prefix, const char* tag);
|
||||||
virtual bool Write(struct in_addr& addr, const char* tag);
|
virtual bool Write(const struct in_addr& addr, const char* tag);
|
||||||
virtual bool Write(struct in6_addr& addr, const char* tag);
|
virtual bool Write(const struct in6_addr& addr, const char* tag);
|
||||||
virtual bool WriteOpenTag(const char* tag);
|
virtual bool WriteOpenTag(const char* tag);
|
||||||
virtual bool WriteCloseTag(const char* tag);
|
virtual bool WriteCloseTag(const char* tag);
|
||||||
virtual bool WriteSeparator();
|
virtual bool WriteSeparator();
|
||||||
|
@ -144,8 +144,8 @@ public:
|
||||||
virtual bool Write(const string& s, const char* tag);
|
virtual bool Write(const string& s, const char* tag);
|
||||||
virtual bool Write(const IPAddr& addr, const char* tag);
|
virtual bool Write(const IPAddr& addr, const char* tag);
|
||||||
virtual bool Write(const IPPrefix& prefix, const char* tag);
|
virtual bool Write(const IPPrefix& prefix, const char* tag);
|
||||||
virtual bool Write(struct in_addr& addr, const char* tag);
|
virtual bool Write(const struct in_addr& addr, const char* tag);
|
||||||
virtual bool Write(struct in6_addr& addr, const char* tag);
|
virtual bool Write(const struct in6_addr& addr, const char* tag);
|
||||||
virtual bool WriteOpenTag(const char* tag);
|
virtual bool WriteOpenTag(const char* tag);
|
||||||
virtual bool WriteCloseTag(const char* tag);
|
virtual bool WriteCloseTag(const char* tag);
|
||||||
virtual bool WriteSeparator();
|
virtual bool WriteSeparator();
|
||||||
|
|
|
@ -106,8 +106,11 @@ void Manager::Process()
|
||||||
|
|
||||||
Message* msg = t->RetrieveOut();
|
Message* msg = t->RetrieveOut();
|
||||||
|
|
||||||
if ( msg->Process() && network_time )
|
if ( msg->Process() )
|
||||||
|
{
|
||||||
|
if ( network_time )
|
||||||
did_process = true;
|
did_process = true;
|
||||||
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -147,7 +147,7 @@ bool Value::Read(SerializationFormat* fmt)
|
||||||
|
|
||||||
case TYPE_ADDR:
|
case TYPE_ADDR:
|
||||||
{
|
{
|
||||||
int family;
|
char family;
|
||||||
|
|
||||||
if ( ! fmt->Read(&family, "addr-family") )
|
if ( ! fmt->Read(&family, "addr-family") )
|
||||||
return false;
|
return false;
|
||||||
|
@ -169,7 +169,27 @@ bool Value::Read(SerializationFormat* fmt)
|
||||||
|
|
||||||
case TYPE_SUBNET:
|
case TYPE_SUBNET:
|
||||||
{
|
{
|
||||||
// FIXME.
|
char length;
|
||||||
|
char family;
|
||||||
|
|
||||||
|
if ( ! (fmt->Read(&length, "subnet-len") && fmt->Read(&family, "subnet-family")) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
switch ( family ) {
|
||||||
|
case 4:
|
||||||
|
val.subnet_val.length = (uint8_t)length;
|
||||||
|
val.subnet_val.prefix.family = IPv4;
|
||||||
|
return fmt->Read(&val.subnet_val.prefix.in.in4, "subnet-in4");
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
val.subnet_val.length = (uint8_t)length;
|
||||||
|
val.subnet_val.prefix.family = IPv6;
|
||||||
|
return fmt->Read(&val.subnet_val.prefix.in.in6, "subnet-in6");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Can't be reached.
|
||||||
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
case TYPE_DOUBLE:
|
case TYPE_DOUBLE:
|
||||||
|
@ -250,18 +270,15 @@ bool Value::Write(SerializationFormat* fmt) const
|
||||||
case TYPE_PORT:
|
case TYPE_PORT:
|
||||||
return fmt->Write(val.port_val.port, "port") && fmt->Write(val.port_val.proto, "proto");
|
return fmt->Write(val.port_val.port, "port") && fmt->Write(val.port_val.proto, "proto");
|
||||||
|
|
||||||
case TYPE_SUBNET:
|
|
||||||
return false; // FIXME.
|
|
||||||
|
|
||||||
case TYPE_ADDR:
|
case TYPE_ADDR:
|
||||||
{
|
{
|
||||||
switch ( val.addr_val.family ) {
|
switch ( val.addr_val.family ) {
|
||||||
case IPv4:
|
case IPv4:
|
||||||
return fmt->Write((int)4, "addr-family")
|
return fmt->Write((char)4, "addr-family")
|
||||||
&& fmt->Write(val.addr_val.in.in4, "addr-in4");
|
&& fmt->Write(val.addr_val.in.in4, "addr-in4");
|
||||||
|
|
||||||
case IPv6:
|
case IPv6:
|
||||||
return fmt->Write((int)6, "addr-family")
|
return fmt->Write((char)6, "addr-family")
|
||||||
&& fmt->Write(val.addr_val.in.in6, "addr-in6");
|
&& fmt->Write(val.addr_val.in.in6, "addr-in6");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -270,6 +287,26 @@ bool Value::Write(SerializationFormat* fmt) const
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TYPE_SUBNET:
|
||||||
|
{
|
||||||
|
if ( ! fmt->Write((char)val.subnet_val.length, "subnet-length") )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
switch ( val.subnet_val.prefix.family ) {
|
||||||
|
case IPv4:
|
||||||
|
return fmt->Write((char)4, "subnet-family")
|
||||||
|
&& fmt->Write(val.subnet_val.prefix.in.in4, "subnet-in4");
|
||||||
|
|
||||||
|
case IPv6:
|
||||||
|
return fmt->Write((char)6, "subnet-family")
|
||||||
|
&& fmt->Write(val.subnet_val.prefix.in.in6, "subnet-in6");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Can't be reached.
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
case TYPE_DOUBLE:
|
case TYPE_DOUBLE:
|
||||||
case TYPE_TIME:
|
case TYPE_TIME:
|
||||||
case TYPE_INTERVAL:
|
case TYPE_INTERVAL:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue