From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 09E49740034 for ; Sun, 24 Dec 2023 22:59:49 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=nn9ej+Beytk3uqTVLY00vS0wrX6euhGEQFPXUaP9DaY=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1703458788; v=1; b=dHIIZfjWz49M3SKTPWf5llbd6KjYygwcGDaI9ZnaSVflUnBPqLKwkxsBIsFJEr9S0ZTczyR3 qEbUqrwONZ1ryyUQ2nHbGrsgXPs4ANCirOa7L5FvUfk9AWYYHTDF6PNZOkklQCE6axmQ6CnOK9W LUpWKm2FAHovtxPnnvX85W9o= X-Received: by 127.0.0.2 with SMTP id 3bQJYY7687511xvHFedSrLDY; Sun, 24 Dec 2023 14:59:48 -0800 X-Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by mx.groups.io with SMTP id smtpd.web11.35807.1703458785924420026 for ; Sun, 24 Dec 2023 14:59:46 -0800 X-Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-50e7b273352so199448e87.1 for ; Sun, 24 Dec 2023 14:59:45 -0800 (PST) X-Gm-Message-State: RDszN18CeQV9h3fqZ1bt2ltVx7686176AA= X-Google-Smtp-Source: AGHT+IGslxNhG4Sg7QKjsjlbqCeTt4w8d6Mh96e9UQmbdDiLcuwMtEOu4d/7RcY2akFXo7Hwpb7lYQ== X-Received: by 2002:ac2:5508:0:b0:50e:6ee7:2727 with SMTP id j8-20020ac25508000000b0050e6ee72727mr1023134lfk.42.1703458784075; Sun, 24 Dec 2023 14:59:44 -0800 (PST) X-Received: from localhost.localdomain ([79.164.221.98]) by smtp.gmail.com with ESMTPSA id be44-20020a056512252c00b0050e78f5178asm326596lfb.262.2023.12.24.14.59.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 24 Dec 2023 14:59:43 -0800 (PST) From: "Mike Maslenkin" To: devel@edk2.groups.io Cc: abner.chang@amd.com, nicklew@nvidia.com, igork@ami.com, Mike Maslenkin Subject: [edk2-devel] [PATCH v3 16/16] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses Date: Mon, 25 Dec 2023 01:59:27 +0300 Message-Id: <20231224225927.9119-17-mike.maslenkin@gmail.com> In-Reply-To: <20231224225927.9119-1-mike.maslenkin@gmail.com> References: <20231224225927.9119-1-mike.maslenkin@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mike.maslenkin@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=dHIIZfjW; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io URI is generated based on the RedfishLocation containing an ASCII string representing the IP address. So, in the case of IPv4 the canonical representation of an IPv4 address was inserted into the resulting Unicode string i.e: "http{,s}://X.X.X.X/". In the case of IPv6, to access resources, the IP address must be specified in brackets, i.e. the resulting string should look like: "http{,s}://[X::X:X:X:X]/". Cc: Abner Chang Cc: Nickle Wang Cc: Igor Kulchytskyy Signed-off-by: Mike Maslenkin --- .../RedfishDiscoverDxe/RedfishDiscoverDxe.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPk= g/RedfishDiscoverDxe/RedfishDiscoverDxe.c index 1022ab090df8..238039b57717 100644 --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c @@ -759,6 +759,7 @@ FreeInformationData ( The function initializes particular strings into the structure instance.= =0D =0D @param[in] Information EFI_REDFISH_DISCOVERED_INFORMATION=0D + @param[in] IsIpv6 Flag indicating IP version 6 protocol = is used=0D @param[in] RedfishVersion Redfish version.=0D @param[in] RedfishLocation Redfish location.=0D @param[in] Uuid Service UUID string.=0D @@ -772,6 +773,7 @@ STATIC VOID=0D InitInformationData (=0D IN EFI_REDFISH_DISCOVERED_INFORMATION *Information,=0D + IN BOOLEAN IsIpv6,=0D IN UINTN *RedfishVersion OPTIONAL,=0D IN CONST CHAR8 *RedfishLocation OPTIONAL,=0D IN CONST CHAR8 *Uuid OPTIONAL,=0D @@ -789,10 +791,20 @@ InitInformationData ( }=0D =0D if (RedfishLocation !=3D NULL) {=0D - AllocationSize =3D AsciiStrSize (RedfishLocation) * sizeof (CHA= R16);=0D + AllocationSize =3D AsciiStrSize (RedfishLocation) * sizeof (CHAR16);=0D +=0D + if (IsIpv6) {=0D + AllocationSize +=3D 2 * sizeof (CHAR16); // take into account '[' an= d ']'=0D + }=0D +=0D Information->Location =3D AllocatePool (AllocationSize);=0D if (Information->Location !=3D NULL) {=0D - AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, Alloc= ationSize);=0D + if (IsIpv6) {=0D + UnicodeSPrintAsciiFormat (Information->Location, AllocationSize, "= [%a]", RedfishLocation);=0D + } else {=0D + AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, All= ocationSize);=0D + }=0D +=0D DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", Info= rmation->Location));=0D } else {=0D DEBUG ((=0D @@ -1038,6 +1050,7 @@ AddAndSignalNewRedfishService ( =0D InitInformationData (=0D &DiscoveredInstance->Information,=0D + CheckIsIpVersion6 (NetworkInterface),=0D RedfishVersion,=0D RedfishLocation,=0D Uuid,=0D --=20 2.32.0 (Apple Git-132) -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112875): https://edk2.groups.io/g/devel/message/112875 Mute This Topic: https://groups.io/mt/103354135/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-