Skip to content

Commit

Permalink
gluon-wan-dnsmasq: rewrite initfile to use procd (freifunk-gluon#2969)
Browse files Browse the repository at this point in the history
Rewrite the gluon-wan-dnsmasq initfile to use procd. This allows for
configuring restart handling by procd in case of a crash.

While at it, disable the caching feature optionally used for the regular
dnsmasq on the wan dnsmasq. This daemon is only for redirecting DNS
requests to use local network resolvers, not introducing caching.

Signed-off-by: David Bauer <[email protected]>
  • Loading branch information
blocktrron authored Sep 20, 2023
1 parent 4397cf2 commit 46b90c1
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions package/gluon-wan-dnsmasq/files/etc/init.d/gluon-wan-dnsmasq
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,18 @@

START=60

SERVICE_NAME=gluon-wan-dnsmasq
SERVICE_USE_PID=1
SERVICE_PID_FILE=/var/run/gluon-wan-dnsmasq.pid


PORT=54
PACKET_MARK=1
USE_PROCD=1

RESOLV_CONF_DIR=/var/gluon/wan-dnsmasq
RESOLV_CONF=$RESOLV_CONF_DIR/resolv.conf


start() {
start_service() {
mkdir -p $RESOLV_CONF_DIR
/lib/gluon/wan-dnsmasq/update.lua

export LD_PRELOAD=libpacketmark.so
export LIBPACKETMARK_MARK=$PACKET_MARK

service_start /usr/sbin/dnsmasq -x $SERVICE_PID_FILE -u root -i lo -p $PORT -h -r $RESOLV_CONF
}
touch "$RESOLV_CONF"

stop() {
service_stop /usr/sbin/dnsmasq
procd_open_instance
procd_set_param command /usr/sbin/dnsmasq -u root -i lo -p 54 -h -k -c 0 -r $RESOLV_CONF
procd_set_param env LD_PRELOAD=libpacketmark.so LIBPACKETMARK_MARK=1
procd_set_param respawn 60 5 5
procd_close_instance
}

0 comments on commit 46b90c1

Please sign in to comment.