From nobody Sun Feb 8 20:35:52 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1660050852; cv=none; d=zohomail.com; s=zohoarc; b=YoKEVPDfVYcuU3ZSLSy7SdmzpU7qprD8Yq6RlsbxFD5NwMuijlIcKyD+EIh8uOx89LcFpAgGQSuPUr7tlYekW2PgpS+k9F9FY3X2FkOJ+QqENpQg/Zt308wweT8ow4HYGxXUTBIiMEAt2k8w5kz9gQ8/eCk340a4PFxHnD2iyKs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660050852; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FHMF8lZ1ySpVI/yiGx1riIfm9MIGavsjyxAK+s0ePHw=; b=g5LkaO8ST/8d1fMXAFddX5dNVSfv4h1z0m4vX7wXKZB+NXMZiTe60Ax04rY771ZWbjyhRzQfZtf+uSjScNBUBCGghwEBsh7Rj+1b6S20ej6yiDTa8hnI6+TYxp38VwHx817eiR9um5xojOXOZjl7EGjoicds4+twaKARRtK3X3s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 166005085223091.8391499521033; Tue, 9 Aug 2022 06:14:12 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-593-kx32apvVOOuL4G7RhkL6HA-1; Tue, 09 Aug 2022 09:14:09 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 619B480600A; Tue, 9 Aug 2022 13:14:03 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4BB262166B26; Tue, 9 Aug 2022 13:14:03 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id DB7F0193221E; Tue, 9 Aug 2022 13:14:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 767F61946A66 for ; Tue, 9 Aug 2022 13:14:01 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4949940CF8EB; Tue, 9 Aug 2022 13:14:01 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id E98B740CFD0A for ; Tue, 9 Aug 2022 13:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660050851; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=FHMF8lZ1ySpVI/yiGx1riIfm9MIGavsjyxAK+s0ePHw=; b=SKwe6DjrqBjbNja23Hx35xjQIJyHijFL+1YVJEkR/ELuAbbV/361pd+rCvVIEB/CVahSQ/ EtiekbXx7iy6U/PMe8rumyrjP3yUlArVD7ccve5aP2lsB1YcmTqhAKck6laMsNpdMxnFXk lYovg5XGIgcrkUqv6IytQq2NKVtf8zc= X-MC-Unique: kx32apvVOOuL4G7RhkL6HA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 5/5] bridge_driver: Enable virMacMap iff dnsmasq is started Date: Tue, 9 Aug 2022 15:13:57 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1660050853486100002 Content-Type: text/plain; charset="utf-8"; x-default="true" The virMacMap module is used only for libvirt_guests NSS module as it records list of MAC addresses used by certain guest. But the module itself is usable if and only if the network assigns IP addresses (i.e. has dnsmasq running). If it's some other authority that assigns IP addresses then we do not need the virMacMap module at all. For instance, a network with no type and no DHCP set won't create /var/lib/libvirt/dnsmasq/ dir which is what the module expects to exist. But there's no need for the module to even care about such network. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/348 Signed-off-by: Michal Privoznik --- src/network/bridge_driver.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 7098054f77..f6538d2638 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -484,9 +484,6 @@ networkUpdateState(virNetworkObj *obj, if (!(def->bridge && virNetDevExists(def->bridge) =3D=3D 1)) virNetworkObjSetActive(obj, false); =20 - if (networkSetMacMap(driver, obj) < 0) - return -1; - break; =20 case VIR_NETWORK_FORWARD_BRIDGE: @@ -521,6 +518,9 @@ networkUpdateState(virNetworkObj *obj, if (virNetworkObjIsActive(obj) && def->ips && (def->nips > 0)) { pid_t dnsmasqPid; =20 + if (networkSetMacMap(driver, obj) < 0) + return -1; + ignore_value(virPidFileReadIfAlive(driver->pidDir, def->name, &dnsmasqPid, @@ -1974,9 +1974,6 @@ networkStartNetworkVirtual(virNetworkDriverState *dri= ver, if (virNetDevBridgeCreate(def->bridge, &def->mac) < 0) return -1; =20 - if (networkSetMacMap(driver, obj) < 0) - goto error; - /* Set bridge options */ =20 if (def->mtu && virNetDevSetMTU(def->bridge, def->mtu) < 0) @@ -2056,6 +2053,9 @@ networkStartNetworkVirtual(virNetworkDriverState *dri= ver, =20 /* start dnsmasq if there are any IP addresses (v4 or v6) */ if (v4present || v6present) { + if (networkSetMacMap(driver, obj) < 0) + goto error; + if (networkStartDhcpDaemon(driver, obj) < 0) goto error; =20 --=20 2.35.1