Skip to content

Commit

Permalink
[Backport 7.58.x] [networks] Scan for AncillaryPktType in packet capt…
Browse files Browse the repository at this point in the history
…ure (#30397)

Co-authored-by: pimlu <pimlu@users.noreply.github.com>
  • Loading branch information
agent-platform-auto-pr[bot] and pimlu authored Oct 23, 2024
1 parent 734c28c commit 68cc214
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/network/filter/packet_source_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,14 @@ func (p *AFPacketSource) VisitPackets(exit <-chan struct{}, visit func(data []by
return err
}

pktInfo.PktType = stats.AncillaryData[0].(afpacket.AncillaryPktType).Type
for _, data := range stats.AncillaryData {
// if addPktType = true, AncillaryData will contain an AncillaryPktType element;
// however, it might not be the first element, so scan through.
pktType, ok := data.(afpacket.AncillaryPktType)
if ok {
pktInfo.PktType = pktType.Type
}
}
if err := visit(data, pktInfo, stats.Timestamp); err != nil {
return err
}
Expand Down
11 changes: 11 additions & 0 deletions releasenotes/notes/system-probe-vlan-2aea22b74ae91c32.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Each section from every release note are combined when the
# CHANGELOG.rst is rendered. So the text needs to be worded so that
# it does not depend on any information only available in another
# section. This may mean repeating some details, but each section
# must be readable independently of the other.
#
# Each section note must be formatted as reStructuredText.
---
fixes:
- |
Fixes an error in system-probe triggered by packet capture in environments with multiple VLANs.

0 comments on commit 68cc214

Please sign in to comment.