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.
()
| 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. |
| 679 | func 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 | } |
no outgoing calls