Re: [libvirt PATCH 03/17] util: dnsmasq: mandate at least version 2.67

2021-12-14 Thread Laine Stump

On 12/14/21 2:09 PM, Ján Tomko wrote:

All the capabilities should be supported in 2.67.
Make this the minimum version, since even the oldest
distros we support have moved on:

Debian 8: 2.72
CentOS 7: 2.76
Ubuntu 18.04: 2.79

Signed-off-by: Ján Tomko 
---
  src/util/virdnsmasq.c | 13 +
  1 file changed, 13 insertions(+)

diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index 90a1ea35b6..efe65174f8 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -49,6 +49,9 @@ VIR_LOG_INIT("util.dnsmasq");
  #define DNSMASQ_HOSTSFILE_SUFFIX "hostsfile"
  #define DNSMASQ_ADDNHOSTSFILE_SUFFIX "addnhosts"
  
+#define DNSMASQ_MIN_MAJOR 2

+#define DNSMASQ_MIN_MINOR 67
+
  static void
  dhcphostFreeContent(dnsmasqDhcpHost *host)
  {
@@ -627,6 +630,16 @@ dnsmasqCapsSetFromBuffer(dnsmasqCaps *caps, const char 
*buf)
  if (virParseVersionString(p, >version, true) < 0)
  goto error;
  
+if (caps->version / 100 < DNSMASQ_MIN_MAJOR ||

+caps->version % 100 < DNSMASQ_MIN_MINOR) {


I think you actually want something like:


 if (caps->version
< DNSMASQ_MIN_MAJOR * 100 + DNSMASQ_MIN_MINOR * 1000)

(or if you wanted to avoid giving this file the knowledge of how version 
numbers are represented internally, you could #define 
DNSMASQ_MIN_VERSION "2.67", then use virParseVersionString() to parse 
that into an unsigned long, and then compare that result. That seems 
like overkill though)




+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _("dnsmasq version >= %u.%u required but %lu.%lu 
found"),
+   DNSMASQ_MIN_MAJOR, DNSMASQ_MIN_MINOR,
+   caps->version / 100,
+   caps->version % 100);
+goto error;
+}
+
  if (strstr(buf, "--bind-dynamic"))
  dnsmasqCapsSet(caps, DNSMASQ_CAPS_BIND_DYNAMIC);
  





[libvirt PATCH 03/17] util: dnsmasq: mandate at least version 2.67

2021-12-14 Thread Ján Tomko
All the capabilities should be supported in 2.67.
Make this the minimum version, since even the oldest
distros we support have moved on:

Debian 8: 2.72
CentOS 7: 2.76
Ubuntu 18.04: 2.79

Signed-off-by: Ján Tomko 
---
 src/util/virdnsmasq.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index 90a1ea35b6..efe65174f8 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -49,6 +49,9 @@ VIR_LOG_INIT("util.dnsmasq");
 #define DNSMASQ_HOSTSFILE_SUFFIX "hostsfile"
 #define DNSMASQ_ADDNHOSTSFILE_SUFFIX "addnhosts"
 
+#define DNSMASQ_MIN_MAJOR 2
+#define DNSMASQ_MIN_MINOR 67
+
 static void
 dhcphostFreeContent(dnsmasqDhcpHost *host)
 {
@@ -627,6 +630,16 @@ dnsmasqCapsSetFromBuffer(dnsmasqCaps *caps, const char 
*buf)
 if (virParseVersionString(p, >version, true) < 0)
 goto error;
 
+if (caps->version / 100 < DNSMASQ_MIN_MAJOR ||
+caps->version % 100 < DNSMASQ_MIN_MINOR) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _("dnsmasq version >= %u.%u required but %lu.%lu 
found"),
+   DNSMASQ_MIN_MAJOR, DNSMASQ_MIN_MINOR,
+   caps->version / 100,
+   caps->version % 100);
+goto error;
+}
+
 if (strstr(buf, "--bind-dynamic"))
 dnsmasqCapsSet(caps, DNSMASQ_CAPS_BIND_DYNAMIC);
 
-- 
2.31.1