mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
Add a debug mode to pkt-loop-filter that outputs debug messages for every dropped packet (with the reason it was dropped). Also add a small script to read the kernel trace pipe, after making sure tracing is active (otherwise there will be no output in the pipe). The source MAC address+VLAN is squeezed into a single u64 when printing as a quick workaround to the lack of MAC address printing in BPF printk. Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
14 lines
300 B
Bash
Executable File
14 lines
300 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -o errexit
|
|
|
|
TRACE_ACTIVE=$(cat /sys/kernel/debug/tracing/tracing_on)
|
|
|
|
if [ "$TRACE_ACTIVE" -ne "1" ]; then
|
|
echo "Kernel tracing disabled, enabling"
|
|
echo 1 > /sys/kernel/debug/tracing/tracing_on
|
|
fi
|
|
|
|
echo "Reading trace pipe, ^C to exit"
|
|
cat /sys/kernel/debug/tracing/trace_pipe
|