From nobody Mon Feb 9 00:55:37 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1646386369; cv=none; d=zohomail.com; s=zohoarc; b=IvIpBZ3K2Dg0rI31lErO5RgI5dmrCsufruj/OjM6zA/ul6nVGXsCQhaQxQXvyGYAunsaKJYe7+GWPovE/0NZOcgcTow1cHq1q0124xYFnAPQTXnAPjlBARFMRJsca0c43R/JKIwE7W3LBweyC9DOXXons0fZdXcO3hSuPA2QB8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646386369; 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=HOqgy3s+o7muA/+3g6EqsSIZ3E3Mx1PDJ6BB4xjJJ+M=; b=lL+n4O+lGc7tiZLzv3DQ5lzIbH9QZHxTm/3DO+QCbBpgx0zDI06d527IlRTJdZ8nDeWr4WWh8RhrCIfgvpK21yy8IB+HYfps30zUY4e0KqvdgNW5pLtcJkIJrNnAncrRxWB49Oi+1uU2pfdxAw6QkJCaPRA7c2wwuHflLmVUmdE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1646386369396152.94693719064867; Fri, 4 Mar 2022 01:32:49 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-642-WMs5Am9sPqS7smwRsUU3MA-1; Fri, 04 Mar 2022 04:32:45 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 72CAD1006AA7; Fri, 4 Mar 2022 09:32:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 52A8F691B5; Fri, 4 Mar 2022 09:32:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1AE781808814; Fri, 4 Mar 2022 09:32:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 2249WBJc017760 for ; Fri, 4 Mar 2022 04:32:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id 74EF26E20F; Fri, 4 Mar 2022 09:32:11 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF92866E34 for ; Fri, 4 Mar 2022 09:32:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646386369; 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=HOqgy3s+o7muA/+3g6EqsSIZ3E3Mx1PDJ6BB4xjJJ+M=; b=DxLkhY9V/nrYQ8yCfyQ9K74MGQ2gXzhlFsVFyxOLIyHZt4k2wYJJ32DHey6tDPKgbghHeR jJOslldlklFASGpIsJtqADfodSTKR0u5gOGHAlI3t/Yh16XJW68gOjei5WlYQ+QSG5HZij fJtR+I0kjYnC3aC7YXXWUWUnwCAr+Gw= X-MC-Unique: WMs5Am9sPqS7smwRsUU3MA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/4] sockettest: Check for IPv4-in-IPv6 parsing and formatting Date: Fri, 4 Mar 2022 10:32:00 +0100 Message-Id: <42816a23e5ffaef36417be4c56e1a7bb94f50d76.1646386097.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1646386370925100001 Content-Type: text/plain; charset="utf-8" There are two standards how IPv4 address in IPv6 can be expressed: ::10.1.2.3 ::ffff:10.1.2.3 The former is obsolete and the latter should be used instead [1]. Add test cases to our sockettest to exercise parsing/formatting of the valid address format. 1: https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.1 Signed-off-by: Michal Privoznik --- tests/sockettest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/sockettest.c b/tests/sockettest.c index 332def2c93..2a35b6a829 100644 --- a/tests/sockettest.c +++ b/tests/sockettest.c @@ -371,12 +371,14 @@ mymain(void) DO_TEST_PARSE_AND_CHECK_FORMAT("127.2", "127.2.0.0", AF_INET, false); DO_TEST_PARSE_AND_CHECK_FORMAT("1.2.3", "1.2.0.3", AF_INET, true); DO_TEST_PARSE_AND_CHECK_FORMAT("1.2.3", "1.2.3.0", AF_INET, false); + DO_TEST_PARSE_AND_CHECK_FORMAT("::ffff:a01:203", "::ffff:10.1.2.3", AF= _INET6, true); =20 DO_TEST_PARSE_AND_FORMAT("::1", AF_UNSPEC, true); DO_TEST_PARSE_AND_FORMAT("::1", AF_INET, false); DO_TEST_PARSE_AND_FORMAT("::1", AF_INET6, true); DO_TEST_PARSE_AND_FORMAT("::1", AF_UNIX, false); DO_TEST_PARSE_AND_FORMAT("::fffe:0:0", AF_UNSPEC, true); + DO_TEST_PARSE_AND_FORMAT("::ffff:10.1.2.3", AF_UNSPEC, true); =20 /* tests that specify a network that should contain the range */ DO_TEST_RANGE("192.168.122.1", "192.168.122.1", "192.168.122.1", 24, 1= , true); --=20 2.34.1