PoC to explore using a BPF program attached to fentry/call_switchdev_notifiers
to capture
switchdev notifier messages and forward the info to user space via a BPF ring buffer.
Run the notifier:
$ sudo ./notifier
In a separate terminal, create a bridge:
sudo ip link add name br0 type bridge
sudo ip link set up dev br0
sudp ip route add 10.10.10.0/24 dev br0
You should see notifier events in the first terminal:
sudo ./notifier
switchdev event id=3, mac=e:19:b8:ab:f9:55, name=br0
fib event id=0, dest=fe80::c19:b8ff:feab:f955/128
fib event id=0, dest=0.10.10.10/24
sudo ip link del name br0 type bridge