From 40e0cb294e0377fdfe11171b35d78bd27e231df2 Mon Sep 17 00:00:00 2001 From: bri <284789+b-@users.noreply.github.com> Date: Sun, 26 Feb 2023 15:05:56 -0500 Subject: T4997: add dhcp client user hooks This commit adds a script to run user-defined hook scripts upon renewing a DHCP lease. This can be used to, for example, dynamically define a firewall address-group based on the dynamic IP address of an interface. For an example of its use (as well as the use case I had in mind while coding this), see https://vyos.dev/T2196#142394 Co-authored-by: br --- src/etc/dhcp/dhclient-exit-hooks.d/99-run-user-hooks | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 src/etc/dhcp/dhclient-exit-hooks.d/99-run-user-hooks (limited to 'src/etc/dhcp/dhclient-exit-hooks.d') diff --git a/src/etc/dhcp/dhclient-exit-hooks.d/99-run-user-hooks b/src/etc/dhcp/dhclient-exit-hooks.d/99-run-user-hooks new file mode 100755 index 000000000..442419d79 --- /dev/null +++ b/src/etc/dhcp/dhclient-exit-hooks.d/99-run-user-hooks @@ -0,0 +1,5 @@ +#!/bin/bash +DHCP_POST_HOOKS="/config/scripts/dhcp-client/post-hooks.d/" +if [ -d "${DHCP_POST_HOOKS}" ] ; then + run-parts "${DHCP_POST_HOOKS}" +fi -- cgit v1.2.3