Skip to content

Commit e550310

Browse files
authored
Merge pull request #60 from LakshK98/main-test-protoc
fixed proto
2 parents 7f3b00f + 4429a7a commit e550310

4 files changed

Lines changed: 2029 additions & 2056 deletions

File tree

pkg/plugin/ebpfwindows/ebpf_windows_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,8 @@ func TestHandleTraceEventWithEthPacket_PktmonDropNotify(t *testing.T) {
772772
t.Errorf("expected event type %v, got %v", MessageTypePktmonDrop, eventType)
773773
}
774774

775-
var testDropReason int32 = 1001
775+
var testDropReason int32 = 2
776+
testDropReason = testDropReason | (1 << 30)
776777
eventSubType := fl.GetEventType().GetSubType()
777778
if eventSubType != testDropReason {
778779
t.Errorf("expected event type %v, got %v", testDropReason, eventSubType)
@@ -817,9 +818,9 @@ func TestHandleTraceEventWithEthPacket_PktmonDropNotify(t *testing.T) {
817818
pdn[31] = 0x01
818819
pdn[32] = 0x00
819820

820-
// DropReason 0x000003E9
821-
pdn[39] = 0xE9
822-
pdn[40] = 0x03
821+
// DropReason 0x00000002
822+
pdn[39] = 0x02
823+
pdn[40] = 0x00
823824
pdn[41] = 0x00
824825
pdn[42] = 0x00
825826
var buf bytes.Buffer
@@ -860,6 +861,7 @@ func TestHandleTraceEventWithIpPacket_PktmonDropNotify(t *testing.T) {
860861
}
861862

862863
var testDropReason int32 = 2
864+
testDropReason = testDropReason | (1 << 30)
863865
eventSubType := fl.GetEventType().GetSubType()
864866
if eventSubType != testDropReason {
865867
t.Errorf("expected event type %v, got %v", testDropReason, eventSubType)

pkg/plugin/ebpfwindows/parser_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ func (p *Parser) decode(data []byte, decoded *pb.Flow) error {
222222
// Fill relevant fields for dropNotify from pktmonNotify struct
223223
dn = &DropNotify{}
224224

225-
eventSubType = pdn.PktmonHeader.Metadata.DropReason + 1000
225+
eventSubType = pdn.PktmonHeader.Metadata.DropReason | (1 << 30)
226226
if offset > uint(MaxInt) {
227227
return fmt.Errorf("%w: %d", errDataOffsetTooLarge, offset)
228228
}

0 commit comments

Comments
 (0)