diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2017-06-09 16:24:12 +0200 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2017-06-09 16:44:04 +0200 |
commit | 8b486ec2b52056b737a4ce64a2040a9a27a6bd60 (patch) | |
tree | ebf3c97b112b4c5cfe57fd0defab9fc990ec2f2f /package/network | |
parent | c00fbaf670494e7cd3dd05bff18cb6b407ac642d (diff) | |
download | mtk-20170518-8b486ec2b52056b737a4ce64a2040a9a27a6bd60.zip mtk-20170518-8b486ec2b52056b737a4ce64a2040a9a27a6bd60.tar.gz mtk-20170518-8b486ec2b52056b737a4ce64a2040a9a27a6bd60.tar.bz2 |
dnsmasq: add dhcp-script hook conditionally
Commit b32689afd6a661339861086c669e15c936293cf8 added support for dhcp-script hook.
Adding dhcp-script config option results into two instances of dnsmasq being run
which triggered oom issues on platforms having low memory.
The dnsmasq dhcp-script config option will now only be added if at least one of the
dhcp, tftp, neigh hotplug dirs has a regular hotplug file or if the dhcpscript uci
config option is specified.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'package/network')
-rw-r--r-- | package/network/services/dnsmasq/Makefile | 2 | ||||
-rw-r--r-- | package/network/services/dnsmasq/files/dnsmasq.init | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile index 307b4de..5b1073f 100644 --- a/package/network/services/dnsmasq/Makefile +++ b/package/network/services/dnsmasq/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dnsmasq PKG_VERSION:=2.77 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/ diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index 62a3169..2d05b77 100644 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -89,6 +89,16 @@ log_once() { logger -t dnsmasq "$@" } +has_handler() { + local file + + for file in /etc/hotplug.d/dhcp/* /etc/hotplug.d/tftp/* /etc/hotplug.d/neigh/*; do + [ -f "$file" ] && return 0 + done + + return 1 +} + append_bool() { local section="$1" local option="$2" @@ -832,8 +842,10 @@ dnsmasq_start() config_get_bool readethers "$cfg" readethers [ "$readethers" = "1" -a \! -e "/etc/ethers" ] && touch /etc/ethers - xappend "--dhcp-script=$DHCPSCRIPT" config_get user_dhcpscript $cfg dhcpscript + if has_handler || [ -n "$user_dhcpscript" ]; then + xappend "--dhcp-script=$DHCPSCRIPT" + fi config_get leasefile $cfg leasefile "/tmp/dhcp.leases" [ -n "$leasefile" -a \! -e "$leasefile" ] && touch "$leasefile" |