]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: capabilities detection for dnsmasq
authorLaine Stump <laine@laine.org>
Tue, 20 Nov 2012 17:22:15 +0000 (12:22 -0500)
committerLaine Stump <laine@laine.org>
Thu, 29 Nov 2012 20:02:39 +0000 (15:02 -0500)
commit719c2c7665e5826a8cf05531080fe20354b39de1
tree64d349fd4b07d4c09e744cfce4ec8ef4c28e4c42
parent892582f9deb1a4c4200a3d0bdfe6a2a94b039ef2
util: capabilities detection for dnsmasq

In order to optionally take advantage of new features in dnsmasq when
the host's version of dnsmasq supports them, but still be able to run
on hosts that don't support the new features, we need to be able to
detect the version of dnsmasq running on the host, and possibly
determine from the help output what options are in this dnsmasq.

This patch implements a greatly simplified version of the capabilities
code we already have for qemu. A dnsmasqCaps device can be created and
populated either from running a program on disk, reading a file with
the concatenated output of "dnsmasq --version; dnsmasq --help", or
examining a buffer in memory that contains the concatenated output of
those two commands. Simple functions to retrieve capabilities flags,
the version number, and the path of the binary are also included.

bridge_driver.c creates a single dnsmasqCaps object at driver startup,
and disposes of it at driver shutdown. Any time it must be used, the
dnsmasqCapsRefresh method is called - it checks the mtime of the
binary, and re-runs the checks if the binary has changed.

networkxml2argvtest.c creates 2 "artificial" dnsmasqCaps objects at
startup - one "restricted" (doesn't support --bind-dynamic) and one
"full" (does support --bind-dynamic). Some of the test cases use one
and some the other, to make sure both code pathes are tested.
src/libvirt_private.syms
src/network/bridge_driver.c
src/network/bridge_driver.h
src/util/dnsmasq.c
src/util/dnsmasq.h
tests/networkxml2argvtest.c