Skip to content

Rework the BPF loading code so we load them in the right order

Peter Hutterer requested to merge whot/udev-hid-bpf:wip/sorted-loading into main

This stem-sorts them so the easy invocation of

   udev-hid-bpf add $DEVICE - /path/to/bpf/*$VENDOR*.bpf.o

does the right thing. The shell will expand to all matching bpfs but in lexical order - we need it in reverse lexical order so we attempt to load the highest-sorting one. Same behavior as calling add without any specific BPF program arguments.

Con: we don't get a per-file warning if we can't load an object file, i.e. nonexisting files are now silently skipped. This does not happen when only one file is provided.

Closes #29 (closed)

Merge request reports