[libvirt PATCH] network: do not assume dnsmasq in networkUpdateState

Peter Krempa pkrempa at redhat.com
Fri Mar 17 14:59:24 UTC 2023


On Thu, Mar 16, 2023 at 14:21:27 +0100, Ján Tomko wrote:
> If we don't have dnsmasq, it's pointless to try to find
> its pidfile.
> 
> Also, dnsmasqCapsGetBinaryPath would access a NULL pointer.
> 
> Fixes: 4b68c982e283471575bacbf87302495864da46fe
> Foxes: https://gitlab.com/libvirt/libvirt/-/issues/456

Awww ^_^

> Signed-off-by: Ján Tomko <jtomko at redhat.com>
> ---
>  src/network/bridge_driver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
> index 3fa56bfc09..ee4bbd4a93 100644
> --- a/src/network/bridge_driver.c
> +++ b/src/network/bridge_driver.c
> @@ -492,7 +492,7 @@ networkUpdateState(virNetworkObj *obj,
>      virNetworkObjPortForEach(obj, networkUpdatePort, obj);
>  
>      /* Try and read dnsmasq pids of active networks */
> -    if (virNetworkObjIsActive(obj) && def->ips && (def->nips > 0)) {
> +    if (dnsmasq_caps && virNetworkObjIsActive(obj) && def->ips && (def->nips > 0)) {
>          pid_t dnsmasqPid;

Based on the fact that at the beginning of this function we check:

 if (!virNetworkObjIsActive(obj))
     return 0;

If we get to this place and don't have the capabilities this must mean
that the 'dnsmasq' binary was removed during runtime, right?

In such case we should still be able to read the pidfile though as the
process is supposed to be around.


More information about the libvir-list mailing list