PKG_NAME:=dnsmasq
PKG_VERSION:=2.76
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
$(INSTALL_BIN) ./files/dnsmasq.init $(1)/etc/init.d/dnsmasq
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
$(INSTALL_DATA) ./files/dnsmasq.hotplug $(1)/etc/hotplug.d/iface/25-dnsmasq
+ $(INSTALL_DIR) $(1)/etc/hotplug.d/ntp
+ $(INSTALL_DATA) ./files/dnsmasqsec.hotplug $(1)/etc/hotplug.d/ntp/25-dnsmasqsec
endef
Package/dnsmasq-dhcpv6/install = $(Package/dnsmasq/install)
ifneq ($(CONFIG_PACKAGE_dnsmasq_full_dnssec),)
$(INSTALL_DIR) $(1)/usr/share/dnsmasq
$(INSTALL_DATA) $(PKG_BUILD_DIR)/trust-anchors.conf $(1)/usr/share/dnsmasq
- $(INSTALL_DIR) $(1)/lib/upgrade
- $(INSTALL_BIN) ./files/dnsmasqsec-add-conffiles.sh $(1)/lib/upgrade
endif
endef
HOSTFILE="/tmp/hosts/dhcp"
TRUSTANCHORSFILE="/usr/share/dnsmasq/trust-anchors.conf"
TIMESTAMPFILE="/etc/dnsmasq.time"
+TIMEVALIDFILE="/var/state/dnsmasqsec"
xappend() {
local value="$1"
[ "$dnssec" -gt 0 ] && {
xappend "--conf-file=$TRUSTANCHORSFILE"
xappend "--dnssec"
- xappend "--dnssec-timestamp=$TIMESTAMPFILE"
+ [ -x /etc/init.d/sysntpd ] && {
+ /etc/init.d/sysntpd enabled
+ [ "$?" -ne 0 -o "$(uci_get system.ntp.enabled)" = "1" ] && {
+ [ -f "$TIMEVALIDFILE" ] || xappend "--dnssec-no-timecheck"
+ }
+ }
append_bool "$cfg" dnsseccheckunsigned "--dnssec-check-unsigned"
}
mkdir -p /var/lib/misc
touch /tmp/dhcp.leases
- if [ ! -f "$TIMESTAMPFILE" ]; then
- touch "$TIMESTAMPFILE"
- chown dnsmasq.dnsmasq "$TIMESTAMPFILE"
- fi
+ [ -f "$TIMESTAMPFILE" ] && rm -f "$TIMESTAMPFILE"
echo "# auto-generated config file from /etc/config/dhcp" > $CONFIGFILE
echo "# auto-generated config file from /etc/config/dhcp" > $HOSTFILE
procd_add_jail dnsmasq ubus log
procd_add_jail_mount $CONFIGFILE $TRUSTANCHORSFILE $HOSTFILE /etc/passwd /etc/group /etc/TZ /dev/null /dev/urandom /etc/dnsmasq.conf /tmp/dnsmasq.d /tmp/resolv.conf.auto /etc/hosts /etc/ethers $EXTRA_MOUNT
- procd_add_jail_mount_rw /var/run/dnsmasq/ /tmp/dhcp.leases $TIMESTAMPFILE
+ procd_add_jail_mount_rw /var/run/dnsmasq/ /tmp/dhcp.leases
procd_close_instance
}
+++ /dev/null
-add_dnsmasqsec_conffiles()
-{
- local filelist="$1"
-
- # do NOT include timestamp in a backup, only system upgrade
- # dnsmasq restart ensures file timestamp is up to date
- if [ -z $NEED_IMAGE ]; then
- if [ $(ubus call service list '{"name":"dnsmasq"}' | jsonfilter -e '@.*.instances.instance1.running') = "true" ]; then
- /etc/init.d/dnsmasq restart
- sleep 1
- echo "/etc/dnsmasq.time" >>$filelist
- fi
- fi
-}
-
-sysupgrade_init_conffiles="$sysupgrade_init_conffiles add_dnsmasqsec_conffiles"
--- /dev/null
+#!/bin/sh
+
+TIMEVALIDFILE="/var/state/dnsmasqsec"
+
+[ "$ACTION" = stratum ] || exit 0
+
+[ -f "$TIMEVALIDFILE" ] || {
+ echo "ntpd says time is valid" >$TIMEVALIDFILE
+ /etc/init.d/dnsmasq enabled && {
+ pid=$(pidof dnsmasq)
+ [ "$(readlink /proc/$pid/exe)" = "/usr/sbin/dnsmasq" ] && kill -SIGHUP $pid \
+ || /etc/init.d/dnsmasq restart
+ }
+}