Skip to content

Commit

Permalink
fix reading L7 event payload
Browse files Browse the repository at this point in the history
  • Loading branch information
def committed Oct 31, 2023
1 parent dce4626 commit df8e36c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ebpftracer/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,12 @@ func runEventsReader(name string, r *perf.Reader, ch chan<- Event, typ perfMapTy
switch typ {
case perfMapTypeL7Events:
v := &l7Event{}
if err := binary.Read(bytes.NewBuffer(rec.RawSample), binary.LittleEndian, v); err != nil {
reader := bytes.NewBuffer(rec.RawSample)
if err := binary.Read(reader, binary.LittleEndian, v); err != nil {
klog.Warningln("failed to read msg:", err)
continue
}
payload := rec.RawSample[len(rec.RawSample)-MaxPayloadSize:]
payload := reader.Bytes()
req := &l7.RequestData{
Protocol: l7.Protocol(v.Protocol),
Status: l7.Status(v.Status),
Expand Down

0 comments on commit df8e36c

Please sign in to comment.