chiark / gitweb /
sd-dhcp-client: use BPF on raw socket
authorTom Gundersen <teg@jklm.no>
Mon, 31 Mar 2014 07:54:18 +0000 (09:54 +0200)
committerTom Gundersen <teg@jklm.no>
Wed, 2 Apr 2014 12:49:51 +0000 (14:49 +0200)
commitbc29e507e2731d594ab577d04c13d771b39fa0c1
tree3027b2756225b6c0f1b4964599bbdf2c9f89fc17
parentb6b20d1d360cff3c485fbc2e20c03498eafe188d
sd-dhcp-client: use BPF on raw socket

Filter out everything except UDP packets destined for the DHCP client port,
this should avoid the vast majority of spurious wakeups.

Filter based on [0], with permission.

Possible improvemnts: also check for the DHCP magic cookie to drop invalid
packets. Check for our xid to filter out packets destined for other clients.

[0]: <https://github.com/ambrop72/badvpn/blob/master/dhcpclient/BDHCPClient.c#L57>
src/libsystemd-network/dhcp-network.c