]> 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)
commitf198ce2b2b1df1febe0cb64ecd023a5ecb1c0bbf
tree9ffdc38d911e5ef7784e98dbfb409aff7ab50145
parent55cbb64bfd7a60830db5e5f97a9792e6751cd6bb
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