From nobody Sun Nov 24 07:28:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1722848015134655.9964908301602; Mon, 5 Aug 2024 01:53:35 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1653FC62; Mon, 5 Aug 2024 04:53:34 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 9BFB9BD4; Mon, 5 Aug 2024 04:53:10 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 26EBCBB3; Mon, 5 Aug 2024 04:53:08 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 8C954BA0 for ; Mon, 5 Aug 2024 04:53:07 -0400 (EDT) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-369-0l3_C4uqMFSQ4bKjw9l7FQ-1; Mon, 05 Aug 2024 04:53:05 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 791721955D53 for ; Mon, 5 Aug 2024 08:53:04 +0000 (UTC) Received: from ajulis-thinkpadt14gen4.remote.csb (unknown [10.43.2.246]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C8FA01955D4C for ; Mon, 5 Aug 2024 08:53:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722847987; h=from:from: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; bh=Q+QkVjkovZapbBzvCj3y6KZx0JGh+s8KHmlfzR6W2G4=; b=FzSzM5ZFULO02g9ilqSanNxYWXdXq3LnDBkaOhhXxnYJjdDEBMCKheVQExBactPiUM81Uj +iENAo5XhScV1UKcAuotqyOfwnuEobmKb16GaDOHbwfVyhQpdmtXZROgyTyBKa7mHHWs+0 xH0N+ellnWLuXF8Wn4leaKzRCHLfRh8= X-MC-Unique: 0l3_C4uqMFSQ4bKjw9l7FQ-1 From: Adam Julis To: devel@lists.libvirt.org Subject: [PATCH] Revert "network: allow "modify" option for DNS-Srv records" Date: Mon, 5 Aug 2024 10:50:43 +0200 Message-ID: <157b98daa3bd10db356e03df6ae9246a4b7d4781.1722847843.git.ajulis@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: QNCVBKUXBNTU3GPKGTFBQQAMX7UZVMRD X-Message-ID-Hash: QNCVBKUXBNTU3GPKGTFBQQAMX7UZVMRD X-MailFrom: ajulis@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1722848017164116600 Content-Type: text/plain; charset="utf-8"; x-default="true" This reverts commit cf934c87cca32149675020ea595712aad25978e6. The matching logic is flawed and it would complicate support of this command. Signed-off-by: Adam Julis Reviewed-by: Martin Kletzander --- See discussion: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/message/6VV= 6ZAFNGUYUIQZGNS3PZ2FN64NPHXBT/ src/conf/network_conf.c | 27 +++++-------------- .../srv-not-existing.xml | 1 - .../srv-record-modify-few.xml | 1 - .../nat-network-dns-srv-modify-few.xml | 26 ------------------ tests/networkxml2xmlupdatetest.c | 10 +------ 5 files changed, 7 insertions(+), 58 deletions(-) delete mode 100644 tests/networkxml2xmlupdatein/srv-not-existing.xml delete mode 100644 tests/networkxml2xmlupdatein/srv-record-modify-few.xml delete mode 100644 tests/networkxml2xmlupdateout/nat-network-dns-srv-modif= y-few.xml diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 68eee367c4..3af4e1d036 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -3257,6 +3257,12 @@ virNetworkDefUpdateDNSSrv(virNetworkDef *def, command =3D=3D VIR_NETWORK_UPDATE_COMMAND_ADD_LAST); int foundCt =3D 0; =20 + if (command =3D=3D VIR_NETWORK_UPDATE_COMMAND_MODIFY) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("DNS SRV records cannot be modified, only added o= r deleted")); + goto cleanup; + } + if (virNetworkDefUpdateCheckElementName(def, ctxt->node, "srv") < 0) goto cleanup; =20 @@ -3306,27 +3312,6 @@ virNetworkDefUpdateDNSSrv(virNetworkDef *def, virNetworkDNSSrvDefClear(&dns->srvs[foundIdx]); VIR_DELETE_ELEMENT(dns->srvs, foundIdx, dns->nsrvs); =20 - } else if (command =3D=3D VIR_NETWORK_UPDATE_COMMAND_MODIFY) { - - if (foundCt =3D=3D 0) { - virReportError(VIR_ERR_OPERATION_INVALID, - _("couldn't locate a matching DNS SRV record in= network %1$s"), - def->name); - goto cleanup; - } - - if (foundCt > 1) { - virReportError(VIR_ERR_OPERATION_INVALID, - _("multiple DNS SRV records matching all specif= ied fields were found in network %1$s"), - def->name); - goto cleanup; - } - - virNetworkDNSSrvDefClear(&dns->srvs[foundIdx]); - - memcpy(&dns->srvs[foundIdx], &srv, sizeof(virNetworkDNSSrvDef)); - memset(&srv, 0, sizeof(virNetworkDNSSrvDef)); - } else { virNetworkDefUpdateUnknownCommand(command); goto cleanup; diff --git a/tests/networkxml2xmlupdatein/srv-not-existing.xml b/tests/netw= orkxml2xmlupdatein/srv-not-existing.xml deleted file mode 100644 index 401e14c616..0000000000 --- a/tests/networkxml2xmlupdatein/srv-not-existing.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/networkxml2xmlupdatein/srv-record-modify-few.xml b/tests= /networkxml2xmlupdatein/srv-record-modify-few.xml deleted file mode 100644 index 88ec1b97d9..0000000000 --- a/tests/networkxml2xmlupdatein/srv-record-modify-few.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/networkxml2xmlupdateout/nat-network-dns-srv-modify-few.x= ml b/tests/networkxml2xmlupdateout/nat-network-dns-srv-modify-few.xml deleted file mode 100644 index a7e5fcffa6..0000000000 --- a/tests/networkxml2xmlupdateout/nat-network-dns-srv-modify-few.xml +++ /dev/null @@ -1,26 +0,0 @@ - - default - 81ff0d90-c91e-6742-64da-4a736edb9a9b - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/networkxml2xmlupdatetest.c b/tests/networkxml2xmlupdatet= est.c index 875cede035..60931a2eba 100644 --- a/tests/networkxml2xmlupdatetest.c +++ b/tests/networkxml2xmlupdatetest.c @@ -337,6 +337,7 @@ mymain(void) "nat-network-dns-srv-record", "nat-network-dns-srv-records", VIR_NETWORK_UPDATE_COMMAND_ADD_LAST); + DO_TEST_FAIL("delete-missing-srv-record-service", "srv-record-service", "nat-network", @@ -359,15 +360,6 @@ mymain(void) "nat-network-dns-srv-record", "nat-network", VIR_NETWORK_UPDATE_COMMAND_DELETE); - DO_TEST("modify-srv-record-protocol", - "srv-record-modify-few", - "nat-network-dns-srv-record", - "nat-network-dns-srv-modify-few", - VIR_NETWORK_UPDATE_COMMAND_MODIFY); - DO_TEST_FAIL("modify-not-existing-srv-record", - "srv-not-existing", - "nat-network-dns-srv-record", - VIR_NETWORK_UPDATE_COMMAND_MODIFY); =20 =20 return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; --=20 2.45.2