Checksum the header and refuse sequence numbers the sender never sent

This commit is contained in:
flamingcow
2026-08-04 20:41:16 -07:00
parent 703039587b
commit 1d54a1a1f6
9 changed files with 241 additions and 35 deletions
+4 -4
View File
@@ -95,19 +95,19 @@ func TestErrsBetweenBuckets(t *testing.T) {
n := counterSet{
s: sample{
lost: 1, late: 7,
crcErr: 2, badMagic: 3, badLen: 4,
crcErr: 2, badMagic: 3, badLen: 4, badHdr: 10,
txErrs: 6, rxErrs: 5,
},
drops: 9,
nic: 8,
}
got := errsBetween(counterSet{}, n)
want := errs{lost: 1, corrupt: 2 + 3 + 4, link: 8 + 5, internal: 9 + 7 + 6}
want := errs{lost: 1, corrupt: 2 + 3 + 4 + 10, link: 8 + 5, internal: 9 + 7 + 6}
if got != want {
t.Errorf("errsBetween = %+v, want %+v", got, want)
}
if got.total() != 45 {
t.Errorf("total = %d, want 45", got.total())
if got.total() != 55 {
t.Errorf("total = %d, want 55", got.total())
}
}