mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-05 00:00:45 -04:00
DHCP servers will respond to port 67 if giaddr is non-zero, which we set if we are not broadcasting. While such messages are received fine via RAW socket the kernel will respond with an ICMP port unreachable if no socket is bound to that port. Instead of opening a dummy socket on port 67 just to avoid the ICMPs we can also just operate with a single socket, bind it to port 67 and send our requests from that port. Since SO_REUSEADDR behaves on Linux like SO_REUSEPORT does on other systems we can bind that port even if a DHCP server is running on the same host as the daemon (this might have to be adapted to make this work on other systems, but due to the raw socket the plugin is not that portable anyway).