minor updates and fixes for script optimization maintenance

This commit is contained in:
Vern Paxson 2024-02-04 07:57:45 -08:00
parent 072fe660bc
commit 9e32443504
12 changed files with 66 additions and 12 deletions

View file

@ -47,7 +47,7 @@ void CPP_InitsInfo::GenerateInitializers(CPPCompile* c) {
if ( ++n > 1 )
c->Emit("");
if ( cohort.size() == 1 )
if ( cohort.size() == 1 && ! IsCompound() )
BuildCohort(c, cohort);
else {
c->Emit("{");

View file

@ -124,6 +124,11 @@ public:
// Sets the associated C++ type.
virtual void SetCPPType(std::string ct) { CPP_type = std::move(ct); }
// Whether this initializer is in terms of compound objects. Used
// for avoiding compiler warnings about singleton initializations in
// braces.
virtual bool IsCompound() const { return false; }
// Returns the type associated with the table used for initialization
// (i.e., this is the type of the global returned by InitializersName()).
std::string InitsType() const { return inits_type; }
@ -187,7 +192,8 @@ protected:
// A class for a collection of initialization items for which each item
// has a "custom" initializer (that is, a bespoke C++ object, rather than
// a simple C++ type or a vector of indices).
// a simple C++ type or a vector of indices). These are things like lambdas,
// global identifiers, or call expressions.
class CPP_CustomInitsInfo : public CPP_InitsInfo {
public:
CPP_CustomInitsInfo(std::string _tag, std::string _type) : CPP_InitsInfo(std::move(_tag), std::move(_type)) {
@ -199,6 +205,8 @@ public:
BuildInitType();
}
bool IsCompound() const override { return true; }
private:
void BuildInitType() { inits_type = std::string("CPP_CustomInits<") + CPPType() + ">"; }
};
@ -219,6 +227,8 @@ public:
inits_type = std::string("CPP_BasicConsts<") + CPP_type + ", " + c_type + ", " + tag + "Val>";
}
bool IsCompound() const override { return false; }
void BuildCohortElement(CPPCompile* c, std::string init_type, std::vector<std::string>& ivs) override;
};
@ -235,6 +245,8 @@ public:
inits_type = std::string("CPP_IndexedInits<") + CPPType() + ">";
}
bool IsCompound() const override { return true; }
void BuildCohortElement(CPPCompile* c, std::string init_type, std::vector<std::string>& ivs) override;
};

View file

@ -313,7 +313,7 @@ public:
void SetInt(int _i) { i = _i; }
void SetInt(int _i, TypePtr _t) {
i = _i;
SetType(_t);
SetType(std::move(_t));
}
void SetSlot(int slot) { i = slot; }
void SetConstant(ValPtr _c) {

View file

@ -1,11 +1,11 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in <...>/create-failure.zeek (C++), line 61: Failed to attach master store backend_failure: (<___>testing_btest__tmp_broker_store_create_failure_create_failure_zeek__zeek_init__36__zf())
error in <...>/create-failure.zeek (C++), line 61: Could not create Broker master store '../fail' (<___>testing_btest__tmp_broker_store_create_failure_create_failure_zeek__zeek_init__36__zf())
error in <no location>: invalid Broker store handle (broker::store::{})
error in <no location>: invalid Broker store handle (broker::store::{})
error in <no location>: invalid Broker store handle (broker::store::{})
error in <no location>: invalid Broker store handle (broker::store::{})
error in <no location>: invalid Broker store handle (broker::store::{})
error in <no location>: invalid Broker store handle (broker::store::{})
error in <no location>: invalid Broker store handle (broker::store::{})
error in <...>/create-failure.zeek, line 53: invalid Broker store handle (lambda_8863924235512554227__lb_cl() and broker::store::{})
error in <...>/create-failure.zeek, line 53: invalid Broker store handle (lambda_8863924235512554227__lb_cl() and broker::store::{})
error in <...>/create-failure.zeek, line 53: invalid Broker store handle (lambda_8863924235512554227__lb_cl() and broker::store::{})
error in <...>/create-failure.zeek, line 53: invalid Broker store handle (lambda_8863924235512554227__lb_cl() and broker::store::{})
error in <...>/create-failure.zeek, line 53: invalid Broker store handle (lambda_8863924235512554227__lb_cl() and broker::store::{})
error in <...>/create-failure.zeek, line 53: invalid Broker store handle (lambda_8863924235512554227__lb_cl() and broker::store::{})
error in <...>/create-failure.zeek, line 53: invalid Broker store handle (lambda_8863924235512554227__lb_cl() and broker::store::{})
received termination signal

View file

@ -0,0 +1,4 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
ts uid history service
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 ShADadR http
XXXXXXXXXX.XXXXXX ClEkJM2Vm5giqnMf4h ShADadR http

View file

@ -0,0 +1,5 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
WebSocket::configure_analyzer, CHhAvVGS1DHFjwGM9, 7
disabling_analyzer, CHhAvVGS1DHFjwGM9, AllAnalyzers::ANALYZER_ANALYZER_WEBSOCKET, 7
WebSocket::configure_analyzer, ClEkJM2Vm5giqnMf4h, 14
disabling_analyzer, ClEkJM2Vm5giqnMf4h, AllAnalyzers::ANALYZER_ANALYZER_WEBSOCKET, 14

View file

@ -0,0 +1,12 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
#separator \x09
#set_separator ,
#empty_field (empty)
#unset_field -
#path websocket
#open XXXX-XX-XX-XX-XX-XX
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p host uri user_agent subprotocol client_protocols server_extensions client_extensions
#types time string addr port addr port string string string string vector[string] vector[string] vector[string]
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 127.0.0.1 42906 127.0.0.1 8888 localhost:8888 /v1/events - v1 v1,authorization.bearer.eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6IjAxOGQwNTVkLTQ5OTgtNzI5Zi04Yjg2LTMwZTBiZWEyZGE4ZiIsInAiOiJUY3AiLCJyIjoiMTk1LjIwMS4xNDguMjA5IiwicnAiOjIyfQ.jjTNJL12tQbAuhTB9p_geFXRkEHkxcvOS6zf76qDklQ - -
XXXXXXXXXX.XXXXXX ClEkJM2Vm5giqnMf4h 127.0.0.1 46796 127.0.0.1 8888 localhost:8888 /v1/events - v1 v1,authorization.bearer.eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6IjAxOGQwNTVkLTc4MWYtNzNiYi1hZDkwLTEzNjA5NzRjY2JmMyIsInAiOiJUY3AiLCJyIjoiMTk1LjIwMS4xNDguMjA5IiwicnAiOjIyfQ.2HQ4uC23p_OYIXnQWeSZCqdA3jc_lVVH7-T5xZDPrz4 - -
#close XXXX-XX-XX-XX-XX-XX

View file

@ -0,0 +1,4 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
ts uid history service
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 ShADadR http
XXXXXXXXXX.XXXXXX ClEkJM2Vm5giqnMf4h ShADadR http

View file

@ -0,0 +1,5 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
WebSocket::configure_analyzer, CHhAvVGS1DHFjwGM9, 7
disabling_analyzer, CHhAvVGS1DHFjwGM9, AllAnalyzers::ANALYZER_ANALYZER_WEBSOCKET, 7
WebSocket::configure_analyzer, ClEkJM2Vm5giqnMf4h, 14
disabling_analyzer, ClEkJM2Vm5giqnMf4h, AllAnalyzers::ANALYZER_ANALYZER_WEBSOCKET, 14

View file

@ -0,0 +1,12 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
#separator \x09
#set_separator ,
#empty_field (empty)
#unset_field -
#path websocket
#open XXXX-XX-XX-XX-XX-XX
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p host uri user_agent subprotocol client_protocols server_extensions client_extensions
#types time string addr port addr port string string string string vector[string] vector[string] vector[string]
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 127.0.0.1 42906 127.0.0.1 8888 localhost:8888 /v1/events - v1 v1,authorization.bearer.eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6IjAxOGQwNTVkLTQ5OTgtNzI5Zi04Yjg2LTMwZTBiZWEyZGE4ZiIsInAiOiJUY3AiLCJyIjoiMTk1LjIwMS4xNDguMjA5IiwicnAiOjIyfQ.jjTNJL12tQbAuhTB9p_geFXRkEHkxcvOS6zf76qDklQ - -
XXXXXXXXXX.XXXXXX ClEkJM2Vm5giqnMf4h 127.0.0.1 46796 127.0.0.1 8888 localhost:8888 /v1/events - v1 v1,authorization.bearer.eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6IjAxOGQwNTVkLTc4MWYtNzNiYi1hZDkwLTEzNjA5NzRjY2JmMyIsInAiOiJUY3AiLCJyIjoiMTk1LjIwMS4xNDguMjA5IiwicnAiOjIyfQ.2HQ4uC23p_OYIXnQWeSZCqdA3jc_lVVH7-T5xZDPrz4 - -
#close XXXX-XX-XX-XX-XX-XX

View file

@ -8,5 +8,5 @@
#fields ts cause analyzer_kind analyzer_name uid fuid id.orig_h id.orig_p id.resp_h id.resp_p failure_reason failure_data
#types time string string string string string addr port addr port string string
XXXXXXXXXX.XXXXXX violation protocol SPICY_SSH CHhAvVGS1DHFjwGM9 - 141.142.228.5 53595 54.243.55.129 80 kaputt -
XXXXXXXXXX.XXXXXX violation protocol SPICY_SSH CHhAvVGS1DHFjwGM9 - 141.142.228.5 53595 54.243.55.129 80 failed to match regular expression (<...>/ssh.spicy:7:15) POST /post HTTP/1.1\x0d\x0aUser-Agent: curl/7.
XXXXXXXXXX.XXXXXX violation protocol SPICY_SSH CHhAvVGS1DHFjwGM9 - 141.142.228.5 53595 54.243.55.129 80 failed to match regular expression (<...>/ssh.spicy:7:15-7:20) POST /post HTTP/1.1\x0d\x0aUser-Agent: curl/7.
#close XXXX-XX-XX-XX-XX-XX

View file

@ -6,5 +6,5 @@ SSH banner, [orig_h=192.150.186.169, orig_p=49244/tcp, resp_h=131.159.14.23, res
SSH banner, [orig_h=192.150.186.169, orig_p=49244/tcp, resp_h=131.159.14.23, resp_p=22/tcp], T, 2.0, OpenSSH_3.8.1p1
confirm, AllAnalyzers::ANALYZER_ANALYZER_SPICY_SSH
=== violation
violation, AllAnalyzers::ANALYZER_ANALYZER_SPICY_SSH, failed to match regular expression (<...>/ssh.spicy:7:15)
violation, AllAnalyzers::ANALYZER_ANALYZER_SPICY_SSH, failed to match regular expression (<...>/ssh.spicy:7:15-7:20)
violation, AllAnalyzers::ANALYZER_ANALYZER_SPICY_SSH, kaputt