This is a daemon for monitoring lease changes on OpenBSD for the specified interfaces. When a change happens it then calls a script located in /etc/dhcpleasemon. The script name should be:
lease_trigger_<interface>
The script has access to the following environment variables:
$DHCP_IFACE– interface name$DHCP_IP_ROUTE– default route for the interface$DHCP_IP_ADDR– IP address from the lease
The daemon is implemented in Rust and is available on GitHub.
Installation
pname="dhcpleasemon"
cargo build --release
install -o root -g wheel -d /etc/$pname
install -o root -g bin target/release/$pname /usr/local/sbin/$pname
install -o root -g wheel -m 0555 rc.d/$pname /etc/rc.d/$pname
Example entries in rc.conf.local:
pkg_scripts=dhcpleasemon
dhcpleasemon_flags=-i em0 -i em1 -6