Skip to content

Commit 58c9b89

Browse files
authored
Merge pull request #30 from LakshK98/fix-generation
add log
2 parents 8797ab3 + 2f0e651 commit 58c9b89

3 files changed

Lines changed: 20 additions & 4 deletions

File tree

pkg/plugin/ebpfwindows/datapath_drop_windows.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,28 @@ func (n *PktmonDropNotify) decodePktmonDrop(data []byte) error {
9696
if l := len(data); l < dropNotifyV1Len {
9797
return fmt.Errorf("%w: expected at least %d but got %d", errUnexpectedDropNotifyLength, dropNotifyV1Len, l)
9898
}
99-
10099
version := byteorder.Native.Uint16(data[1:3])
101100

102101
// Check against max version.
103102
if version > DropNotifyVersion1 {
104-
return fmt.Errorf("%w: Unrecognized drop event version %d", errInvalidDropNotifyVersion, version)
103+
return fmt.Errorf("%w: Unrecognized pktmon drop event version %d\nRaw data bytes: %v\nType: %d\nVersion (bytes 1-2): %v (uint16: %d)\nSubType: %d\nSource (bytes 4-5): %v (uint16: %d)\nHash (bytes 6-9): %v (uint32: %d)\nOrigLen (bytes 10-13): %v (uint32: %d)\nCapLen (bytes 14-15): %v (uint16: %d)\nSrcLabel (bytes 16-19): %v (uint32: %d)\nDstLabel (bytes 20-23): %v (uint32: %d)\nDstID (bytes 24-27): %v (uint32: %d)\nLine (bytes 28-29): %v (uint16: %d)\nFile (byte 30): %d\nExtError (byte 31): %d\nIfindex (bytes 32-35): %v (uint32: %d)",
104+
errInvalidDropNotifyVersion, version,
105+
data,
106+
data[0],
107+
data[1:3], version,
108+
data[3],
109+
data[4:6], byteorder.Native.Uint16(data[4:6]),
110+
data[6:10], byteorder.Native.Uint32(data[6:10]),
111+
data[10:14], byteorder.Native.Uint32(data[10:14]),
112+
data[14:16], byteorder.Native.Uint16(data[14:16]),
113+
data[16:20], byteorder.Native.Uint32(data[16:20]),
114+
data[20:24], byteorder.Native.Uint32(data[20:24]),
115+
data[24:28], byteorder.Native.Uint32(data[24:28]),
116+
data[28:30], byteorder.Native.Uint16(data[28:30]),
117+
data[30],
118+
int8(data[31]),
119+
data[32:36], byteorder.Native.Uint32(data[32:36]),
120+
)
105121
}
106122

107123
// Decode logic for version >= v0/v1.

pkg/plugin/ebpfwindows/ebpf_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ func (p *Plugin) handleTraceEvent(data unsafe.Pointer, size uint32) error {
321321
},
322322
})
323323
if err != nil {
324-
return fmt.Errorf("could not convert dropnotify event to flow: %w", err)
324+
return fmt.Errorf("could not convert droPktmonDropNotify pnotify event to flow: %w", err)
325325
}
326326
meta := &utils.RetinaMetadata{}
327327
utils.AddPacketSize(meta, size-uint32(unsafe.Sizeof(DropNotify{})))

test/e2e/tools/event-writer/bpf_event_writer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void create_pktmon_drop_event(struct pktmon_notify* drp_elm)
134134
memset(drp_elm, 0, sizeof(struct pktmon_notify));
135135
drp_elm->type = PKTMON_NOTIFY_DROP;
136136
drp_elm->subtype = 7;
137-
drp_elm->source = 10; // random source
137+
drp_elm->source = 11; // random source
138138
drp_elm->hash = 0;
139139
drp_elm->len_orig = 128;
140140
drp_elm->len_cap = 128;

0 commit comments

Comments
 (0)