Fix generation of file IDs.

They weren't stable, and potentially repetitive.

Note: We should backport this to the external plugin.
This commit is contained in:
Robin Sommer 2023-05-11 19:58:11 +02:00
parent 0040111955
commit e6af74c8aa
No known key found for this signature in database
GPG key ID: D8187293B3FFE5D0
5 changed files with 11 additions and 12 deletions

View file

@ -18,11 +18,16 @@ using namespace zeek::spicy::rt;
void EndpointState::debug(const std::string& msg) { spicy::rt::debug(_cookie, msg); }
static auto create_endpoint(bool is_orig, analyzer::Analyzer* analyzer, ::spicy::rt::driver::ParsingType type) {
static uint64_t id_counter = 0;
++id_counter;
cookie::ProtocolAnalyzer cookie{.analyzer = analyzer,
.is_orig = is_orig,
.fstate_orig = cookie::FileStateStack(hilti::rt::fmt("%x.orig", analyzer->GetID())),
.fstate_orig =
cookie::FileStateStack(hilti::rt::fmt("%" PRIx64 ".orig", id_counter)),
.fstate_resp =
cookie::FileStateStack(hilti::rt::fmt("%x.resp", analyzer->GetID()))};
cookie::FileStateStack(hilti::rt::fmt("%" PRIx64 ".resp", id_counter))};
// Cannot get parser here yet, analyzer may not have been fully set up.
return EndpointState(std::move(cookie), type);

View file

@ -1,3 +1,3 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
FL4lmy3f7owPUUoQ8l
FhCRq1oIy2uDU8rog
FM47gX3vI5ofQPm1li
FZjUS57tUkGFTibv3

View file

@ -1,3 +1,3 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
FL4lmy3f7owPUUoQ8l
FhCRq1oIy2uDU8rog
FM47gX3vI5ofQPm1li
FZjUS57tUkGFTibv3

View file

@ -9,9 +9,6 @@ else
sed="sed -E"
fi
# File IDs changed between Zeek 3.1 and 3.2.
${sed} 's/^ *#(open|close).(19|20)..-..-..-..-..-..$/#\1 XXXX-XX-XX-XX-XX-XX/g' |
${sed} 's/F[A-Za-z0-9]{14,17}/XXXXXXXXXXXXXXXXX/g' |
$(dirname $0)/diff-remove-timestamps |
$(dirname $0)/diff-remove-abspath

View file

@ -9,10 +9,7 @@ else
sed="sed -E"
fi
# File IDs changed between Zeek 3.1 and 3.2.
${sed} 's/^ *#(open|close).(19|20)..-..-..-..-..-..$/#\1 XXXX-XX-XX-XX-XX-XX/g' |
${sed} 's/F[A-Za-z0-9]{15,17}/XXXXXXXXXXXXXXXXX/g' |
$(dirname $0)/diff-sort |
$(dirname $0)/diff-remove-timestamps |
$(dirname $0)/diff-remove-abspath