bugfix: update dnsmasq procd scripts

Pull forward AREDN 3.16.1.1 procd scripts in sync with
usage of OLSR
This commit is contained in:
Andrew Cameron 2018-04-27 18:41:03 -07:00 committed by Joe AE6XE
parent 01b30a4c63
commit b344a73505
1 changed files with 36 additions and 8 deletions

View File

@ -19,7 +19,7 @@
$(INSTALL_DIR) $(1)/etc/hotplug.d/ntp
--- /dev/null
+++ b/package/network/services/dnsmasq/files/dnsmasq.init.aredn
@@ -0,0 +1,612 @@
@@ -0,0 +1,640 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007-2012 OpenWrt.org
+
@ -33,10 +33,11 @@
+
+ADD_LOCAL_DOMAIN=1
+ADD_LOCAL_HOSTNAME=1
+mkdir -p /tmp/hosts
+
+CONFIGFILE="/var/etc/dnsmasq.conf"
+HOSTFILE="/tmp/hosts/dhcp"
+TRUSTANCHORSFILE="/usr/share/dnsmasq/trust-anchors.conf"
+TIMESTAMPFILE="/etc/dnsmasq.time"
+
+xappend() {
+ local value="$1"
@ -107,6 +108,10 @@
+ xappend "--address=$1"
+}
+
+append_ipset() {
+ xappend "--ipset=$1"
+}
+
+append_interface() {
+ local ifname=$(uci_get_state network "$1" ifname "$1")
+ xappend "--interface=$ifname"
@ -125,6 +130,10 @@
+ xappend "--bogus-nxdomain=$1"
+}
+
+append_pxe_service() {
+ xappend "--pxe-service=$1"
+}
+
+dnsmasq() {
+ local cfg="$1"
+ append_bool "$cfg" authoritative "--dhcp-authoritative"
@ -142,9 +151,12 @@
+ append_bool "$cfg" boguspriv "--bogus-priv"
+ append_bool "$cfg" expandhosts "--expand-hosts"
+ append_bool "$cfg" enable_tftp "--enable-tftp"
+ append_bool "$cfg" tftp_no_fail "--tftp-no-fail"
+ append_bool "$cfg" nonwildcard "--bind-interfaces"
+ append_bool "$cfg" fqdn "--dhcp-fqdn"
+ append_bool "$cfg" proxydnssec "--proxy-dnssec"
+ append_bool "$cfg" localservice "--local-service"
+ append_bool "$cfg" quietdhcp "--quiet-dhcp"
+
+ append_parm "$cfg" dhcpscript "--dhcp-script"
+ append_parm "$cfg" cachesize "--cache-size"
@ -157,16 +169,19 @@
+ append_parm "$cfg" "local" "--server"
+ config_list_foreach "$cfg" "server" append_server
+ config_list_foreach "$cfg" "address" append_address
+ config_list_foreach "$cfg" "ipset" append_ipset
+ config_list_foreach "$cfg" "interface" append_interface
+ config_list_foreach "$cfg" "notinterface" append_notinterface
+ config_list_foreach "$cfg" "addnhosts" append_addnhosts
+ config_list_foreach "$cfg" "bogusnxdomain" append_bogusnxdomain
+ append_parm "$cfg" "leasefile" "--dhcp-leasefile"
+ append_parm "$cfg" "resolvfile" "--resolv-file"
+ append_parm "$cfg" "serversfile" "--servers-file"
+ append_parm "$cfg" "tftp_root" "--tftp-root"
+ append_parm "$cfg" "dhcp_boot" "--dhcp-boot"
+ append_parm "$cfg" "local_ttl" "--local-ttl"
+
+ append_parm "$cfg" "pxe_prompt" "--pxe-prompt"
+ config_list_foreach "$cfg" "pxe_service" append_pxe_service
+ config_get DOMAIN "$cfg" domain
+
+ config_get_bool ADD_LOCAL_DOMAIN "$cfg" add_local_domain 1
@ -213,6 +228,7 @@
+ [ "$dnssec" -gt 0 ] && {
+ xappend "--conf-file=$TRUSTANCHORSFILE"
+ xappend "--dnssec"
+ xappend "--dnssec-timestamp=$TIMESTAMPFILE"
+ append_bool "$cfg" dnsseccheckunsigned "--dnssec-check-unsigned"
+ }
+
@ -379,12 +395,11 @@
+ [ -n "$filename" ] || return 0
+
+ config_get servername "$cfg" servername
+ [ -n "$servername" ] || return 0
+
+ config_get serveraddress "$cfg" serveraddress
+ [ -n "$serveraddress" ] || return 0
+
+ xappend "--dhcp-boot=${networkid:+net:$networkid,}$filename,$servername,$serveraddress"
+ [ -n "$serveraddress" -a ! -n "$servername" ] && return 0
+
+ xappend "--dhcp-boot=${networkid:+net:$networkid,}${filename}${servername:+,$servername}${serveraddress:+,$serveraddress}"
+
+ config_get_bool force "$cfg" force 0
+
@ -558,13 +573,26 @@
+ config_load dhcp
+
+ procd_open_instance
+ procd_set_param command $PROG -C $CONFIGFILE -k
+ procd_set_param command $PROG -C $CONFIGFILE -k -x /var/run/dnsmasq/dnsmasq.pid
+ procd_set_param file $CONFIGFILE
+ procd_set_param respawn
+
+ 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
+ procd_add_jail_mount_rw /var/run/dnsmasq/ /tmp/dhcp.leases $TIMESTAMPFILE
+
+ procd_close_instance
+
+ # before we can call xappend
+ mkdir -p /var/run/dnsmasq/
+ mkdir -p $(dirname $CONFIGFILE)
+ mkdir -p /var/lib/misc
+ touch /tmp/dhcp.leases
+
+ if [ ! -f "$TIMESTAMPFILE" ]; then
+ touch "$TIMESTAMPFILE"
+ chown nobody.nogroup "$TIMESTAMPFILE"
+ fi
+
+ echo "# auto-generated config file from /etc/config/dhcp" > $CONFIGFILE
+ echo "# auto-generated config file from /etc/config/dhcp" > $HOSTFILE