[meta-virtualization] [PATCH 4/4] dnsmasq: allow net interfaces to config their own dnsmasq instance

Mark Asselstine mark.asselstine at windriver.com
Wed Nov 23 11:40:36 PST 2016


On Wed, Nov 23, 2016 at 2:20 PM, Bruce Ashfield
<bruce.ashfield at gmail.com> wrote:
>
>
> On Tue, Nov 22, 2016 at 1:56 PM, Mark Asselstine
> <mark.asselstine at windriver.com> wrote:
>>
>> This addition to dnsmasq allows an interface to define a dnsmasq
>> configuration file as /var/lib/dnsmasq/%i/dnsmasq.conf and have their
>> dnsmasq instance controlled via systemctl dnsmasq@%i.service (where
>> '%i' is the interface name).
>>
>> To use this simply create the dnsmasq.conf file as above and enable
>> the systemd service like:
>>
>> Signed-off-by: Mark Asselstine <mark.asselstine at windriver.com>
>> ---
>>  recipes-support/dnsmasq/dnsmasq/dnsmasq at .service | 12 ++++++++++++
>>  recipes-support/dnsmasq/dnsmasq_2.%.bbappend     | 16 ++++++++++++++++
>>  2 files changed, 28 insertions(+)
>>  create mode 100644 recipes-support/dnsmasq/dnsmasq/dnsmasq at .service
>>  create mode 100644 recipes-support/dnsmasq/dnsmasq_2.%.bbappend
>>
>> diff --git a/recipes-support/dnsmasq/dnsmasq/dnsmasq at .service
>> b/recipes-support/dnsmasq/dnsmasq/dnsmasq at .service
>> new file mode 100644
>> index 0000000..9e36a36
>> --- /dev/null
>> +++ b/recipes-support/dnsmasq/dnsmasq/dnsmasq at .service
>> @@ -0,0 +1,12 @@
>> +[Unit]
>> +Description=DHCP and DNS caching server for %i.
>> +After=network.target
>> +
>> +[Service]
>> +ExecStart=/usr/bin/dnsmasq -k
>> --conf-file=/var/lib/dnsmasq/%i/dnsmasq.conf
>> +ExecReload=/bin/kill -HUP $MAINPID
>> +Restart=on-failure
>> +RestartSec=5
>> +
>> +[Install]
>> +WantedBy=multi-user.target
>> diff --git a/recipes-support/dnsmasq/dnsmasq_2.%.bbappend
>> b/recipes-support/dnsmasq/dnsmasq_2.%.bbappend
>> new file mode 100644
>> index 0000000..2acfd0c
>> --- /dev/null
>> +++ b/recipes-support/dnsmasq/dnsmasq_2.%.bbappend
>> @@ -0,0 +1,16 @@
>> +# Allow individual network interfaces to easily configure
>> +# their own dnsmasq instance.
>> +
>> +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
>> +
>> +SRC_URI += " \
>> +    file://dnsmasq@.service \
>> +    "
>> +
>
>
> Let me see if I properly understand this .. since this is bbappend, we are
> going to
> enable this service no matter what if dnsmasq is in an image ?
>
> Like the lxc networking, is there an option to put this into a separate
> package
> "dnsmasq-extra" .. or something better than that ? So that when someone
> wants
> this capability, they have to install the extra package ?
>
> Otherwise, I don't see a way to opt out.

If you do nothing you are opted out, this is just a file on the filesystem
and you see nothing change.

To opt-in you have to create a dnsmasq config file specific to the interface
and then enable the systemd service for that interface.

When you see my updates to meta-overc you will see how it is intended to be
used by the br-int interface.

Mark


>
> Bruce
>
>>
>> +do_install_append() {
>> +    install -d ${D}/${sysconfdir}/systemd
>> +    install -d ${D}/${sysconfdir}/systemd/system
>> +    install -m 644 ${WORKDIR}/dnsmasq at .service
>> ${D}/${sysconfdir}/systemd/system/.
>> +}
>> +
>> +FILES_${PN} += "${sysconfdir}/systemd/system/dnsmasq at .service"
>> --
>> 2.7.4
>>
>> --
>> _______________________________________________
>> meta-virtualization mailing list
>> meta-virtualization at yoctoproject.org
>> https://lists.yoctoproject.org/listinfo/meta-virtualization
>
>
>
>
> --
> "Thou shalt not follow the NULL pointer, for chaos and madness await thee at
> its end"
>
> --
> _______________________________________________
> meta-virtualization mailing list
> meta-virtualization at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/meta-virtualization
>


More information about the meta-virtualization mailing list