]> git.ipfire.org Git - thirdparty/dhcpcd.git/commit
BPF: Move validation logic from BPF to consumers
authorRoy Marples <roy@marples.name>
Fri, 11 Oct 2019 10:24:38 +0000 (11:24 +0100)
committerRoy Marples <roy@marples.name>
Fri, 11 Oct 2019 10:24:38 +0000 (11:24 +0100)
commit8baf5c7ce7bb047d4d766fdfd95f5eee1baeaebe
tree9ffdc38d911e5ef7784e98dbfb409aff7ab50145
parentdfd2abf17313e7aa99cd2e0606d66f029b51be85
BPF: Move validation logic from BPF to consumers

Even though we program the BPF filter should we trust it?
On Linux at least there is a window between opening the socket,
binding the interface and setting the filter where we receive data.
This data is NOT checked OR flushed and IS returned when reading.
We have no way of flushing it other than reading these packets!
But we don't know if they passed the filter or not ..... so we need
to validate each and every packet that comes through ourselves as well.
Even if Linux does fix this sorry state, who is to say other kernels
don't have bugs causing a similar effect?

As such, let's strive to keep the filters just for pattern matching
to avoid waking dhcpcd up.
src/arp.c
src/bpf.c
src/bpf.h
src/dhcp.c
src/if-linux.c