The script ChmodBPF creates new /dev/bpf interfaces and set specific permissions thanks to the code:
I've deleted /dev/bpf250, and launched ChmodBPF as root, but "read -n 0 < /dev/bpf249" doesn't create /dev/bpf250. I rebooted macOS, and this time the script created /dev/bpf250. What prevents the manual execution of ChmodBPF as root to create new BPF devices? asked 27 Jul '16, 05:14 TomLaBaude |
One Answer:
The relevant code only creates a BPF device if the device number is greater than the maximum device number ever created; it doesn't fill in artificially-created holes in the BPF device number space. (What Apple should do is implement a cloning BPF device, so that you can just open answered 27 Jul '16, 17:35 Guy Harris ♦♦ |
Interesting, so why a reboot creates /dev/bpf250? Is it another part of the code at boot? My goal was to be able to manually create a new bpf device like it does at boot...
No, it's because
/dev/bpf250
doesn't exist at boot time - the maximum device number ever created, at that point, is, as I remember, 4 (4 BPF devices are created by the BPF code at boot time). Therefore, attempts to open devices past/dev/bpf3
create new devices.If you want to create a device to replace one that you removed, you would have to do so manually with the
mknod
command. If you want to create additional devices beyond the ones thatChmodBPF
created, you'd have to modifyChmodBPF
to raise the value ofFORCE_CREATE_BPF_MAX
to the maximum device number you want.