dhcpcd gets a performance boost

29 Jan 2008 • 1 min read

When I first released dhcpcd-3, it had support for FreeBSD. This was done using a BPF device which has the benefit of getting the kernel to filter packets before they hit the program. This meant the dhcpcd only saw DHCP and ARP packets on BSD, whereas on Linux is saw all the packets coming in. Normally, this isn't an issue as the interface isn't configured at this point so traffic is minimal.

However, during a DHCP RENEW, there is quite a bit of traffic going around and it was all hitting dhcpcd. So I added some code to counter to ensure that we still work correctly during packet floods. However, dhcpcd does burn a lot of CPU during these times. I then saw a post to the busybox mailing list that had a BPF filter - but for Linux! First I knew about this, but apparently Linux has been able to use BPF for a long time. So dhcpcd now uses the same filter for Linux which means that dhcpcd won't chew CPU time even in packet floods. Or, at least, less CPU.

Get this new feature in dhcpcd-3.2.1 - today! 😃