[libvirt PATCH 09/17] util: dnsmasq: delete assumed capability flags

Ján Tomko posted 17 patches 4 years ago
[libvirt PATCH 09/17] util: dnsmasq: delete assumed capability flags
Posted by Ján Tomko 4 years ago
Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 src/util/virdnsmasq.c | 22 ++--------------------
 src/util/virdnsmasq.h |  4 ----
 2 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index efe65174f8..016d9d64a8 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -640,27 +640,9 @@ dnsmasqCapsSetFromBuffer(dnsmasqCaps *caps, const char *buf)
         goto error;
     }
 
-    if (strstr(buf, "--bind-dynamic"))
-        dnsmasqCapsSet(caps, DNSMASQ_CAPS_BIND_DYNAMIC);
-
-    /* if this string is a part of the --version output, dnsmasq
-     * has been patched to use SO_BINDTODEVICE when listening,
-     * so that it will only accept requests that arrived on the
-     * listening interface(s)
-     */
-    if (strstr(buf, "--bind-interfaces with SO_BINDTODEVICE"))
-        dnsmasqCapsSet(caps, DNSMASQ_CAPS_BINDTODEVICE);
-
-    if (strstr(buf, "--ra-param"))
-        dnsmasqCapsSet(caps, DNSMASQ_CAPS_RA_PARAM);
-
-    VIR_INFO("dnsmasq version is %d.%d, --bind-dynamic is %spresent, "
-             "SO_BINDTODEVICE is %sin use, --ra-param is %spresent",
+    VIR_INFO("dnsmasq version is %d.%d",
              (int)caps->version / 1000000,
-             (int)(caps->version % 1000000) / 1000,
-             dnsmasqCapsGet(caps, DNSMASQ_CAPS_BIND_DYNAMIC) ? "" : "NOT ",
-             dnsmasqCapsGet(caps, DNSMASQ_CAPS_BINDTODEVICE) ? "" : "NOT ",
-             dnsmasqCapsGet(caps, DNSMASQ_CAPS_RA_PARAM) ? "" : "NOT ");
+             (int)(caps->version % 1000000) / 1000);
     return 0;
 
  error:
diff --git a/src/util/virdnsmasq.h b/src/util/virdnsmasq.h
index 9b8aeef226..9aa45c3046 100644
--- a/src/util/virdnsmasq.h
+++ b/src/util/virdnsmasq.h
@@ -68,10 +68,6 @@ typedef struct
 } dnsmasqContext;
 
 typedef enum {
-   DNSMASQ_CAPS_BIND_DYNAMIC = 0, /* support for --bind-dynamic */
-   DNSMASQ_CAPS_BINDTODEVICE = 1, /* uses SO_BINDTODEVICE for --bind-interfaces */
-   DNSMASQ_CAPS_RA_PARAM = 2,     /* support for --ra-param */
-
    DNSMASQ_CAPS_LAST,             /* this must always be the last item */
 } dnsmasqCapsFlags;
 
-- 
2.31.1

Re: [libvirt PATCH 09/17] util: dnsmasq: delete assumed capability flags
Posted by Laine Stump 4 years ago
On 12/14/21 2:09 PM, Ján Tomko wrote:
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
>   src/util/virdnsmasq.c | 22 ++--------------------
>   src/util/virdnsmasq.h |  4 ----
>   2 files changed, 2 insertions(+), 24 deletions(-)
> 
> diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
> index efe65174f8..016d9d64a8 100644
> --- a/src/util/virdnsmasq.c
> +++ b/src/util/virdnsmasq.c
> @@ -640,27 +640,9 @@ dnsmasqCapsSetFromBuffer(dnsmasqCaps *caps, const char *buf)
>           goto error;
>       }
>   
> -    if (strstr(buf, "--bind-dynamic"))
> -        dnsmasqCapsSet(caps, DNSMASQ_CAPS_BIND_DYNAMIC);
> -
> -    /* if this string is a part of the --version output, dnsmasq
> -     * has been patched to use SO_BINDTODEVICE when listening,
> -     * so that it will only accept requests that arrived on the
> -     * listening interface(s)
> -     */
> -    if (strstr(buf, "--bind-interfaces with SO_BINDTODEVICE"))
> -        dnsmasqCapsSet(caps, DNSMASQ_CAPS_BINDTODEVICE);
> -
> -    if (strstr(buf, "--ra-param"))
> -        dnsmasqCapsSet(caps, DNSMASQ_CAPS_RA_PARAM);
> -
> -    VIR_INFO("dnsmasq version is %d.%d, --bind-dynamic is %spresent, "
> -             "SO_BINDTODEVICE is %sin use, --ra-param is %spresent",
> +    VIR_INFO("dnsmasq version is %d.%d",
>                (int)caps->version / 1000000,
> -             (int)(caps->version % 1000000) / 1000,
> -             dnsmasqCapsGet(caps, DNSMASQ_CAPS_BIND_DYNAMIC) ? "" : "NOT ",
> -             dnsmasqCapsGet(caps, DNSMASQ_CAPS_BINDTODEVICE) ? "" : "NOT ",
> -             dnsmasqCapsGet(caps, DNSMASQ_CAPS_RA_PARAM) ? "" : "NOT ");
> +             (int)(caps->version % 1000000) / 1000);

One would hope that nobody is actually looking for these strings in a 
script anywhere :-/ (To clarify - I think it's fine to remove).