PKG_NAME:=dnsmasq
PKG_VERSION:=2.77rc5
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/release-candidates
$(INSTALL_DATA) ./files/dnsmasq.conf $(1)/etc/dnsmasq.conf
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/dnsmasq.init $(1)/etc/init.d/dnsmasq
+ $(INSTALL_DIR) $(1)/etc/hotplug.d/dhcp
+ $(INSTALL_DIR) $(1)/etc/hotplug.d/neigh
$(INSTALL_DIR) $(1)/etc/hotplug.d/ntp
+ $(INSTALL_DIR) $(1)/etc/hotplug.d/tftp
$(INSTALL_DATA) ./files/dnsmasqsec.hotplug $(1)/etc/hotplug.d/ntp/25-dnsmasqsec
$(INSTALL_DIR) $(1)/usr/share/dnsmasq
$(INSTALL_DATA) ./files/rfc6761.conf $(1)/usr/share/dnsmasq/
+ $(INSTALL_DIR) $(1)/usr/lib/dnsmasq
+ $(INSTALL_BIN) ./files/dhcp-script.sh $(1)/usr/lib/dnsmasq/dhcp-script.sh
endef
Package/dnsmasq-dhcpv6/install = $(Package/dnsmasq/install)
--- /dev/null
+#!/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
TIMEVALIDFILE="/var/state/dnsmasqsec"
BASEDHCPSTAMPFILE="/var/run/dnsmasq"
RFC6761FILE="/usr/share/dnsmasq/rfc6761.conf"
+DHCPSCRIPT="/usr/lib/dnsmasq/dhcp-script.sh"
DNSMASQ_DHCP_VER=4
dnsmasq_start()
{
- local cfg="$1" disabled resolvfile
+ local cfg="$1" disabled resolvfile user_dhcpscript
config_get_bool disabled "$cfg" disabled 0
[ "$disabled" -gt 0 ] && return 0
append_bool "$cfg" noping "--no-ping"
append_parm "$cfg" logfacility "--log-facility"
- append_parm "$cfg" dhcpscript "--dhcp-script"
+
append_parm "$cfg" cachesize "--cache-size"
append_parm "$cfg" dnsforwardmax "--dns-forward-max"
append_parm "$cfg" port "--port"
config_get_bool readethers "$cfg" readethers
[ "$readethers" = "1" -a \! -e "/etc/ethers" ] && touch /etc/ethers
- config_get dhcpscript $cfg dhcpscript
+ xappend "--dhcp-script=$DHCPSCRIPT"
+ config_get user_dhcpscript $cfg dhcpscript
config_get leasefile $cfg leasefile "/tmp/dhcp.leases"
[ -n "$leasefile" -a \! -e "$leasefile" ] && touch "$leasefile"
procd_open_instance $cfg
procd_set_param command $PROG -C $CONFIGFILE -k -x /var/run/dnsmasq/dnsmasq."${cfg}".pid
procd_set_param file $CONFIGFILE
+ [ -n "$user_dhcpscript" ] && procd_set_param env USER_DHCPSCRIPT="$user_dhcpscript"
procd_set_param respawn
local dnsmasqconffile="/etc/dnsmasq.${cfg}.conf"
fi
procd_add_jail dnsmasq ubus log
- procd_add_jail_mount $CONFIGFILE $TRUSTANCHORSFILE $HOSTFILE $RFC6761FILE /etc/passwd /etc/group /etc/TZ /dev/null /dev/urandom $dnsmasqconffile $dnsmasqconfdir $resolvfile $dhcpscript /etc/hosts /etc/ethers $EXTRA_MOUNT
+ procd_add_jail_mount $CONFIGFILE $TRUSTANCHORSFILE $HOSTFILE $RFC6761FILE /etc/passwd /etc/group /etc/TZ /dev/null /dev/urandom $dnsmasqconffile $dnsmasqconfdir $resolvfile $user_dhcpscript /etc/hosts /etc/ethers /sbin/hotplug-call $EXTRA_MOUNT $DHCPSCRIPT
procd_add_jail_mount_rw /var/run/dnsmasq/ $leasefile
procd_close_instance