Merge remote-tracking branch 'origin/topic/vern/zam-pattern-comparison'

* origin/topic/vern/zam-pattern-comparison:
  update of BTest that tracks number of (and validates) ZAM operations
  ZAM support for pattern equality/inequality operations
  expanded ZAM operations for bit-shifting to allow for int/count shift values
  added type coercion for bit-shifting expressions
This commit is contained in:
Tim Wojtulewicz 2024-12-05 11:08:55 -07:00
commit 488ac7ddf0
7 changed files with 32 additions and 14 deletions

10
CHANGES
View file

@ -1,3 +1,13 @@
7.1.0-dev.676 | 2024-12-05 11:08:55 -0700
* update of BTest that tracks number of (and validates) ZAM operations (Vern Paxson, Corelight)
* ZAM support for pattern equality/inequality operations (Vern Paxson, Corelight)
* expanded ZAM operations for bit-shifting to allow for int/count shift values (Vern Paxson, Corelight)
* added type coercion for bit-shifting expressions (Vern Paxson, Corelight)
7.1.0-dev.671 | 2024-12-05 14:51:01 +0100 7.1.0-dev.671 | 2024-12-05 14:51:01 +0100
* zeek-testing: Add Experiment-VM-Microsoft-Windows7AD-1 PCAP and baselines (Arne Welzel, Corelight) * zeek-testing: Add Experiment-VM-Microsoft-Windows7AD-1 PCAP and baselines (Arne Welzel, Corelight)

View file

@ -1 +1 @@
7.1.0-dev.671 7.1.0-dev.676

@ -1 +1 @@
Subproject commit 3c17f9797ebab5157d7b08265540cd7f4de15d1f Subproject commit 0f32b4a05a7e1772d1a0a9b366ebd7a815e1af39

View file

@ -1860,8 +1860,11 @@ BitExpr::BitExpr(ExprTag arg_tag, ExprPtr arg_op1, ExprPtr arg_op2)
if ( IsIntegral(bt1) && bt2 == TYPE_COUNT ) { if ( IsIntegral(bt1) && bt2 == TYPE_COUNT ) {
if ( is_vector(op1) || is_vector(op2) ) if ( is_vector(op1) || is_vector(op2) )
SetType(make_intrusive<VectorType>(base_type(bt1))); SetType(make_intrusive<VectorType>(base_type(bt1)));
else else {
SetType(base_type(bt1)); SetType(base_type(bt1));
if ( bt1 != bt2 )
op2 = make_intrusive<ArithCoerceExpr>(op2, bt1);
}
} }
else if ( IsIntegral(bt1) && bt2 == TYPE_INT ) else if ( IsIntegral(bt1) && bt2 == TYPE_INT )

View file

@ -37,15 +37,19 @@ binary-expr-op Mask
# Signal that this expression only has mixed-type evaluation. # Signal that this expression only has mixed-type evaluation.
op-type X op-type X
explicit-result-type explicit-result-type
eval-mixed A I auto mask = static_cast<uint32_t>($2); eval-mixed A I DoMask($$, $1, static_cast<uint32_t>($2))
auto a = $1->AsAddr(); eval-mixed A U DoMask($$, $1, $2)
if ( a.GetFamily() == IPv4 && mask > 32 )
ERROR(util::fmt("bad IPv4 subnet prefix length: %" PRIu32, mask)); macro DoMask(lhs, op1, op2)
if ( a.GetFamily() == IPv6 && mask > 128 ) auto mask = static_cast<uint32_t>(op2);
ERROR(util::fmt("bad IPv6 subnet prefix length: %" PRIu32, mask)); auto a = op1->AsAddr();
auto v = make_intrusive<SubNetVal>(a, mask); if ( a.GetFamily() == IPv4 && mask > 32 )
Unref($$.AsSubNet()); ERROR(util::fmt("bad IPv4 subnet prefix length: %" PRIu32, mask));
$$.AsSubNetRef() = v.release(); if ( a.GetFamily() == IPv6 && mask > 128 )
ERROR(util::fmt("bad IPv6 subnet prefix length: %" PRIu32, mask));
auto v = make_intrusive<SubNetVal>(a, mask);
Unref(lhs.AsSubNet());
lhs.AsSubNetRef() = v.release();
binary-expr-op Mod binary-expr-op Mod
op-type I U op-type I U

View file

@ -17,7 +17,7 @@ eval-type T $1->IsSubsetOf(*$2)
eval-type A $1->AsAddr() < $2->AsAddr() || $1->AsAddr() == $2->AsAddr() eval-type A $1->AsAddr() < $2->AsAddr() || $1->AsAddr() == $2->AsAddr()
rel-expr-op EQ rel-expr-op EQ
op-type I U D S T A N F op-type I U D S T A N F P
vector vector
eval $1 == $2 eval $1 == $2
eval-type S Bstr_cmp($1->AsString(), $2->AsString()) == 0 eval-type S Bstr_cmp($1->AsString(), $2->AsString()) == 0
@ -25,6 +25,7 @@ eval-type T $1->EqualTo(*$2)
eval-type A $1->AsAddr() == $2->AsAddr() eval-type A $1->AsAddr() == $2->AsAddr()
eval-type N $1->AsSubNet() == $2->AsSubNet() eval-type N $1->AsSubNet() == $2->AsSubNet()
eval-type F $1->GetName() == $2->GetName() eval-type F $1->GetName() == $2->GetName()
eval-type P strcmp($1->Get()->PatternText(), $2->Get()->PatternText()) == 0
eval-mixed P S $1->MatchExactly($2->AsString()) eval-mixed P S $1->MatchExactly($2->AsString())
rel-expr-op NE rel-expr-op NE

View file

@ -1,2 +1,2 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
1232 valid, 1853 tested, 425 skipped 1245 valid, 1883 tested, 437 skipped