aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/services/dnsmasq/files/dhcp-script.sh
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2017-05-06 20:56:26 +1000
committerHans Dedecker <dedeckeh@gmail.com>2017-05-26 21:28:30 +0200
commitb32689afd6a661339861086c669e15c936293cf8 (patch)
treea9dabd6c54451acd9697b689ddb68f86464b3ed0 /package/network/services/dnsmasq/files/dhcp-script.sh
parent822ee54544c05d031411ab673d33e6f3c4f452a4 (diff)
downloadupstream-b32689afd6a661339861086c669e15c936293cf8.tar.gz
upstream-b32689afd6a661339861086c669e15c936293cf8.tar.bz2
upstream-b32689afd6a661339861086c669e15c936293cf8.zip
dnsmasq: add dhcp-script hook for other packages
Adds a script which acts as a hook for when dnsmasq creates/destroys a lease, or completes a TFTP file transfer. The hook loops through scripts in appropriate directories inside '/etc/hotplug.d', executing each one with the same arguments supplied by dnsmasq. In case dnsmasq is jailed by ujail the dhcp-script hook will not work as expected as ujail does not yet support executing a script within a jail. Signed-off-by: Nick Brassel <nick@tzarc.org> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'package/network/services/dnsmasq/files/dhcp-script.sh')
-rwxr-xr-xpackage/network/services/dnsmasq/files/dhcp-script.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/package/network/services/dnsmasq/files/dhcp-script.sh b/package/network/services/dnsmasq/files/dhcp-script.sh
new file mode 100755
index 0000000000..86032694c1
--- /dev/null
+++ b/package/network/services/dnsmasq/files/dhcp-script.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+[ -f "$USER_DHCPSCRIPT" ] && . "$USER_DHCPSCRIPT" "$@"
+
+case "$1" in
+ add)
+ export ACTION="add"
+ export MACADDR="$2"
+ export IPADDR="$3"
+ export HOSTNAME="$4"
+ exec /sbin/hotplug-call dhcp
+ ;;
+ del)
+ export ACTION="remove"
+ export MACADDR="$2"
+ export IPADDR="$3"
+ export HOSTNAME="$4"
+ exec /sbin/hotplug-call dhcp
+ ;;
+ old)
+ export ACTION="update"
+ export MACADDR="$2"
+ export IPADDR="$3"
+ export HOSTNAME="$4"
+ exec /sbin/hotplug-call dhcp
+ ;;
+ arp-add)
+ export ACTION="add"
+ export MACADDR="$2"
+ export IPADDR="$3"
+ exec /sbin/hotplug-call neigh
+ ;;
+ arp-del)
+ export ACTION="remove"
+ export MACADDR="$2"
+ export IPADDR="$3"
+ exec /sbin/hotplug-call neigh
+ ;;
+ tftp)
+ export ACTION="add"
+ export TFTP_SIZE="$2"
+ export TFTP_ADDR="$3"
+ export TFTP_PATH="$4"
+ exec /sbin/hotplug-call tftp
+ ;;
+esac