Skip to content

Instantly share code, notes, and snippets.

@QueuingKoala
Created January 18, 2023 03:28
Show Gist options
  • Save QueuingKoala/88f0f1d32e22eab77e607a9d7dd4431d to your computer and use it in GitHub Desktop.
Save QueuingKoala/88f0f1d32e22eab77e607a9d7dd4431d to your computer and use it in GitHub Desktop.
Interim patch for OpenWRT dnsmasq addnmount v22.03 backport
diff --git a/dhcp.conf b/dhcp.conf
index 8c42ef782e..87fe45a7e0 100644
--- a/dhcp.conf
+++ b/dhcp.conf
@@ -21,6 +21,7 @@ config dnsmasq
#list bogusnxdomain '64.94.110.11'
option localservice 1 # disable to allow DNS requests from non-local subnets
option ednspacket_max 1232
+ #list addnmount /some/path # read-only mount path to expose it to dnsmasq
config dhcp lan
option interface lan
diff --git a/dnsmasq.init b/dnsmasq.init
index c4ca3eb2db..e64f05df70 100755
--- a/dnsmasq.init
+++ b/dnsmasq.init
@@ -205,8 +205,12 @@ ismounted() {
return 1
}
-append_addnhosts() {
+append_extramount() {
ismounted "$1" || append EXTRA_MOUNT "$1"
+}
+
+append_addnhosts() {
+ append_extramount "$1"
xappend "--addn-hosts=$1"
}
@@ -1157,6 +1161,8 @@ dnsmasq_start()
done
}
+ config_list_foreach "$cfg" addnmount append_extramount
+
procd_open_instance $cfg
procd_set_param command $PROG -C $CONFIGFILE -k -x /var/run/dnsmasq/dnsmasq."${cfg}".pid
procd_set_param file $CONFIGFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment