All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Asselstine <mark.asselstine@windriver.com>
To: Joe MacDonald <joe_macdonald@mentor.com>
Cc: anders@chargestorm.se, openembedded-devel@lists.openembedded.org
Subject: Re: [meta-networking][PATCH] dnsmasq: get systemd only working again
Date: Tue, 19 Apr 2016 09:54:53 -0400	[thread overview]
Message-ID: <2862560.T3V9HA8dKh@tal> (raw)
In-Reply-To: <1461036607-24650-1-git-send-email-joe_macdonald@mentor.com>

On April 18, 2016 23:30:07 Joe MacDonald wrote:
> From: Mark Asselstine <mark.asselstine@windriver.com>
> 
> The changes made in commit 2497cf2960537152427c99629b2af412787eb6c2
> [dnsmasq: steal resolvconf support from Ubuntu] broke systemd only
> dnsmasq runtime. No sysvinit scripts are included in systemd only
> builds (and should not be) and the dnsmasq executable has not moved to
> /usr/sbin.
> 
> Reverting to the previous version of the systemd service file. If
> folks want the local dnsmasq instance to be queried before going to
> an external DNS they should add 'nameserver 127.0.0.1' to
> /etc/resolv.conf. Or submit a change which will work with systemd.
> 
> Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
> Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
> ---
> 
> Mark,
> 
> Thanks for the patch.  In the interests of not causing any more hassle
> than I already have, I'm proposing this as an alternative to what you sent
> earlier today.  This hopefully preserves the resolvconf/start-stop
> functionality while not relying on any sysvinit-ness.  What do you think
> about this as a middle-ground?

No worries about causing hassle. Things brake, things get fixed, we move on and 
learn.

The approach is fine with me. When looking at this yesterday I question the 
need for this 'wrapper' and side with Arch Linux approach. But I definitely 
trust your call on this, knowing you have spent many more hours dealing with 
dnsmasq and resolv.conf than I ever will in my lifetime.

Anyways, definitely no complaints from me with this change, if you can sort out 
the runtime issues that Anders seems to have run in to.

Thanks for getting to this so quickly,
Mark

> 
> Anders,
> 
> I trust that nothing Mark and I are discussing here changes the issue you
> noted about dnsmasq just falling over after a few minutes.  I propose we
> dig into that separately, since it looks like a different problem probably
> related to the uprev.  If it turns out that once we merge something to
> support systemd-only builds that resolves the 'dnsmasq vandalizes itself'
> issue, even better.
> 
> -J.
> 
>  .../recipes-support/dnsmasq/dnsmasq.inc            |  9 ++--
>  .../dnsmasq/files/dnsmasq-resolvconf-helper        | 62
> ++++++++++++++++++++++ .../recipes-support/dnsmasq/files/dnsmasq.service  |
>  9 ++--
>  3 files changed, 72 insertions(+), 8 deletions(-)
>  create mode 100644
> meta-networking/recipes-support/dnsmasq/files/dnsmasq-resolvconf-helper
> 
> diff --git a/meta-networking/recipes-support/dnsmasq/dnsmasq.inc
> b/meta-networking/recipes-support/dnsmasq/dnsmasq.inc index
> 622e630..df58e5c 100644
> --- a/meta-networking/recipes-support/dnsmasq/dnsmasq.inc
> +++ b/meta-networking/recipes-support/dnsmasq/dnsmasq.inc
> @@ -60,11 +60,12 @@ do_install () {
>          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}/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
> +        install -d ${D}${sysconfdir}/default/volatiles
> +        install -m 0644 ${WORKDIR}/99_dnsmasq
> ${D}${sysconfdir}/default/volatiles +        install -m 0755
> ${WORKDIR}/dnsmasq-resolvconf-helper ${D}${bindir} fi
>  }
> 
> diff --git
> a/meta-networking/recipes-support/dnsmasq/files/dnsmasq-resolvconf-helper
> b/meta-networking/recipes-support/dnsmasq/files/dnsmasq-resolvconf-helper
> new file mode 100644
> index 0000000..db54d46
> --- /dev/null
> +++
> b/meta-networking/recipes-support/dnsmasq/files/dnsmasq-resolvconf-helper
> @@ -0,0 +1,62 @@
> +#!/bin/bash
> +#
> +# Borrowing heavily from the dnsmasq initscript's version of support for
> +# resolvconf, intended for use in systemd-only configurations.
> +#
> +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
> +DAEMON=/usr/sbin/dnsmasq
> +NAME=dnsmasq
> +
> +# Most configuration options in /etc/default/dnsmasq are deprecated
> +# but still honoured.
> +if [ -r /etc/default/$NAME ]; then
> +   . /etc/default/$NAME
> +fi
> +
> +start_resolvconf()
> +{
> +   # If interface "lo" is explicitly disabled in /etc/default/dnsmasq
> +   # Then dnsmasq won't be providing local DNS, so don't add it to
> +   # the resolvconf server set.
> +   for interface in $DNSMASQ_EXCEPT
> +   do
> +      [ $interface = lo ] && return
> +   done
> +
> +   if [ -x /sbin/resolvconf ] ; then
> +      echo "nameserver 127.0.0.1" |
> +      /sbin/resolvconf -a lo.$NAME
> +   fi
> +   return 0
> +}
> +
> +stop_resolvconf()
> +{
> +   if [ -x /sbin/resolvconf ] ; then
> +      /sbin/resolvconf -d lo.$NAME
> +   fi
> +   return 0
> +}
> +
> +case "$1" in
> +   start)
> +      start_resolvconf
> +      exit 0
> +      ;;
> +   stop)
> +      stop_resolvconf
> +      exit 0
> +      ;;
> +   restart)
> +      stop_resolvconf
> +      start_resolvconf
> +      exit 0
> +      ;;
> +   *)
> +      echo "Usage: /etc/init.d/$NAME {start|stop|restart}" >&2
> +      exit 3
> +      ;;
> +esac
> +
> +exit 0
> +
> diff --git a/meta-networking/recipes-support/dnsmasq/files/dnsmasq.service
> b/meta-networking/recipes-support/dnsmasq/files/dnsmasq.service index
> c3637e1..5824b62 100644
> --- a/meta-networking/recipes-support/dnsmasq/files/dnsmasq.service
> +++ b/meta-networking/recipes-support/dnsmasq/files/dnsmasq.service
> @@ -5,10 +5,10 @@ After=network.target
>  [Service]
>  Type=forking
>  PIDFile=/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
> +ExecStartPre=/usr/bin/dnsmasq --test
> +ExecStart=/usr/bin/dnsmasq -x $MAINPID
> +ExecStartPost=/usr/bin/dnsmasq-resolvconf-helper start
> +ExecStop=/usr/bin/dnsmasq-resolvconf-helper stop
>  ExecReload=/bin/kill -HUP $MAINPID
> 
>  [Install]



  parent reply	other threads:[~2016-04-19 13:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19  3:30 [meta-networking][PATCH] dnsmasq: get systemd only working again Joe MacDonald
2016-04-19  7:41 ` Anders Darander
2016-04-19 14:21   ` Joe MacDonald
2016-04-19 15:37     ` [meta-networking][PATCH v3] " Joe MacDonald
2016-04-20  8:24       ` Anders Darander
2016-04-20  8:29         ` Anders Darander
2016-04-20 18:56           ` Joe MacDonald
2016-04-20 19:09             ` Joe MacDonald
2016-04-21 13:39               ` Anders Darander
2016-04-19 13:54 ` Mark Asselstine [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-04-18 20:34 [meta-networking][PATCH] " Mark Asselstine
2016-04-19  4:39 ` Anders Darander

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2862560.T3V9HA8dKh@tal \
    --to=mark.asselstine@windriver.com \
    --cc=anders@chargestorm.se \
    --cc=joe_macdonald@mentor.com \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.