Skip to contentSkip to conversation

dnsmasq: steal resolvconf support from Ubuntu

PATCH In review Jens Rehsack 3 participants 3 messages Feb 28, 2016 – Apr 18, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dnsmasq: steal resolvconf support from Ubuntu

Add support for resolvconf integration as done in Ubuntu. This implies updates of start-scripts, resolvconf plugin (on nameserver update ...), populate-volatiles control file for saved nameserver list.

---
 .../recipes-support/dnsmasq/dnsmasq.inc            | 10 +++
 .../recipes-support/dnsmasq/files/99_dnsmasq       |  1 +
 .../dnsmasq/files/dnsmasq.resolvconf               | 84 ++++++++++++++++++++++
 .../recipes-support/dnsmasq/files/dnsmasq.service  |  7 +-
 meta-networking/recipes-support/dnsmasq/files/init | 69 +++++++++++++++++-
 5 files changed, 167 insertions(+), 4 deletions(-)
 create mode 100644 meta-networking/recipes-support/dnsmasq/files/99_dnsmasq
 create mode 100755 meta-networking/recipes-support/dnsmasq/files/dnsmasq.resolvconf
meta-networking/recipes-support/dnsmasq/dnsmasq.inc +10 -0
index 7fec606..622e630 100644
@@ -23,6 +23,7 @@ PACKAGECONFIG[dbus] = ",,dbus"
 PACKAGECONFIG[idn] = ",,libidn"
 PACKAGECONFIG[conntrack] = ",,libnetfilter-conntrack"
 PACKAGECONFIG[lua] = ",,lua"
+PACKAGECONFIG[resolvconf] = ",,,resolvconf"
 EXTRA_OEMAKE = "\
     'COPTS=${@base_contains('PACKAGECONFIG', 'dbus', '-DHAVE_DBUS', '', d)} \
            ${@base_contains('PACKAGECONFIG', 'idn', '-DHAVE_IDN', '', d)} \
@@ -32,6 +33,8 @@ EXTRA_OEMAKE = "\
     'LDFLAGS=${LDFLAGS}' \
 "
 
+SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'resolvconf', 'file://dnsmasq.resolvconf file://99_dnsmasq', '', d)}"
+
 do_compile_append() {
     # build dhcp_release
     cd ${S}/contrib/wrt
@@ -56,6 +59,13 @@ do_install () {
         install -d ${D}${sysconfdir}/dbus-1/system.d
         install -m 644 dbus/dnsmasq.conf ${D}${sysconfdir}/dbus-1/system.d/
     fi
+    if [ "${@base_contains('PACKAGECONFIG', 'resolvconf', 'resolvconf', '', d)}" != "" ]; then
+	install -d ${D}${sysconfdir}/resolvconf/update.d/
+	install -m 0755 ${WORKDIR}/dnsmasq.resolvconf ${D}${sysconfdir}/resolvconf/update.d/dnsmasq
+
+	install -d ${D}${sysconfdir}/default/volatiles
+	install -m 0644 ${WORKDIR}/99_dnsmasq ${D}${sysconfdir}/default/volatiles
+    fi
 }
 
 CONFFILES_${PN} = "${sysconfdir}/dnsmasq.conf"
meta-networking/recipes-support/dnsmasq/files/99_dnsmasq new file +1 -0
new file mode 100644
index 0000000..f52ce4e
@@ -0,0 +1 @@
+d root root 0755 /run/dnsmasq none
meta-networking/recipes-support/dnsmasq/files/dnsmasq.resolvconf new file +84 -0

84 lines not on this page · raw message

meta-networking/recipes-support/dnsmasq/files/dnsmasq.service +5 -2
index 549e15e..c3637e1 100644
@@ -5,8 +5,11 @@ After=network.target
 [Service]
 Type=forking
 PIDFile=/run/dnsmasq.pid
-ExecStart=/usr/bin/dnsmasq -x /run/dnsmasq.pid
-ExecReload=/bin/kill -HUP $(/bin/cat /run/dnsmasq.pid)
+ExecStartPre=/usr/sbin/dnsmasq --test
+ExecStart=/etc/init.d/dnsmasq systemd-exec
+ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf
+ExecStopPre=/etc/init.d/dnsmasq systemd-stop-resolvconf
+ExecReload=/bin/kill -HUP $MAINPID
 
 [Install]
 WantedBy=multi-user.target
meta-networking/recipes-support/dnsmasq/files/init +67 -2

95 lines not on this page · raw message

--
2.6.3

--
Jens Rehsack - [email protected]

#1 lore raw

Hm, unfortunately I didn't notice before this went in.

Quoted 6 lines · Jens Rehsack

Add support for resolvconf integration as done in Ubuntu. This implies updates of start-scripts, resolvconf plugin (on nameserver update ...), populate-volatiles control file for saved nameserver list.

---

snip...

meta-networking/recipes-support/dnsmasq/files/dnsmasq.service After=network.target · line 10

Quoted 13 lines
meta-networking/recipes-support/dnsmasq/files/dnsmasq.service +3 -2
index 549e15e..c3637e1 100644
@@ -5,8 +5,11 @@ After=network.target
 [Service]
 Type=forking
 PIDFile=/run/dnsmasq.pid
-ExecStart=/usr/bin/dnsmasq -x /run/dnsmasq.pid
-ExecReload=/bin/kill -HUP $(/bin/cat /run/dnsmasq.pid)
+ExecStartPre=/usr/sbin/dnsmasq --test
+ExecStart=/etc/init.d/dnsmasq systemd-exec
+ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf

This breaks on systemd-only distros. On those, the init scripts gets removed during installation.

When patching out that removal, I'm also seeing that dnsmasq dies after a few minuts.

Cheers,
Anders

Quoted 5 lines
meta-networking/recipes-support/dnsmasq/files/dnsmasq.service +2 -0
+ExecStopPre=/etc/init.d/dnsmasq systemd-stop-resolvconf
+ExecReload=/bin/kill -HUP $MAINPID
 
 [Install]
 WantedBy=multi-user.target
Signature · 2 lines
Anders Darander, Senior System Architect
ChargeStorm AB / eStorm AB
#2 lore raw
Quoted 30 lines · Anders Darander

Hm, unfortunately I didn't notice before this went in.

Quoted 6 lines · Jens Rehsack

Add support for resolvconf integration as done in Ubuntu. This implies updates of start-scripts, resolvconf plugin (on nameserver update ...), populate-volatiles control file for saved nameserver list.

---

snip...

meta-networking/recipes-support/dnsmasq/files/dnsmasq.service After=network.target · line 10

Quoted 13 lines
meta-networking/recipes-support/dnsmasq/files/dnsmasq.service +3 -2
index 549e15e..c3637e1 100644
@@ -5,8 +5,11 @@ After=network.target
 [Service]
 Type=forking
 PIDFile=/run/dnsmasq.pid
-ExecStart=/usr/bin/dnsmasq -x /run/dnsmasq.pid
-ExecReload=/bin/kill -HUP $(/bin/cat /run/dnsmasq.pid)
+ExecStartPre=/usr/sbin/dnsmasq --test
+ExecStart=/etc/init.d/dnsmasq systemd-exec
+ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf

This breaks on systemd-only distros. On those, the init scripts gets removed during installation.

Quoted 6 lines

When patching out that removal, I'm also seeing that dnsmasq dies after a few minuts.

Cheers,
Anders

This was obviously not tested with systemd. '/usr/sbin/dnsmasq' simply doesn't exist and as Anders points out the init scripts are not included in systemd builds. Would be great to see a fix for this. I plan and sending something to at least get us back to working dnsmasq with systemd builds.

Mark

Quoted 15 lines

meta-networking/recipes-support/dnsmasq/files/dnsmasq.service After=network.target · line 15

Quoted 6 lines
meta-networking/recipes-support/dnsmasq/files/dnsmasq.service +2 -0
+ExecStopPre=/etc/init.d/dnsmasq systemd-stop-resolvconf
+ExecReload=/bin/kill -HUP $MAINPID
 
 [Install]
 WantedBy=multi-user.target

--
Anders Darander, Senior System Architect
ChargeStorm AB / eStorm AB
--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel