MCPcopy
hub / github.com/microsoft/retina / DropReasonsCommand

Function DropReasonsCommand

shell/tracescript.go:679–689  ·  view source on GitHub ↗

DropReasonsCommand returns the command to fetch SKB drop reason enum from kernel. The enum values are kernel-version specific and must be read at runtime. This reads from the tracepoint format file which contains the enum definition.

()

Source from the content-addressed store, hash-verified

677// The enum values are kernel-version specific and must be read at runtime.
678// This reads from the tracepoint format file which contains the enum definition.
679func DropReasonsCommand() []string {
680 return []string{
681 "sh", "-c",
682 `echo "=== SKB Drop Reason Codes (kernel-specific) ===" && ` +
683 `cat /sys/kernel/debug/tracing/events/skb/kfree_skb/format 2>/dev/null | ` +
684 `grep -oE '\{ [0-9]+, "[^"]+" \}' | ` +
685 `sed 's/{ \([0-9]*\), "\([^"]*\)" }/\1 = \2/' | ` +
686 `head -30 || ` +
687 `echo "(Could not read drop reasons - requires debugfs mounted)"`,
688 }
689}

Callers 2

TestDropReasonsCommandFunction · 0.85
RunTraceFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestDropReasonsCommandFunction · 0.68