mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 22:23:27 +00:00
b32689afd6
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>
47 lines
839 B
Bash
Executable File
47 lines
839 B
Bash
Executable File
#!/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
|