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 B29EDAC1595 for ; Thu, 7 Dec 2023 13:24:25 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=/Njnm2pzP8SEFQW2gexuUk3/ks+hz+zNSa7T+wS7iho=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id: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=1701955464; v=1; b=KikWPttnyIGj3+G4yxUw3nILHyx6oB4RmNKFu6h3fk+4ijqEvkaB1AIZ5prQInA274KEaHT2 2r5W7K0svSVzZIwoJr3X3YXe4i5ToX3mGqs5FwYKWswbYdi+5+ci2LKYIA4aujWZCOkuwrqIZ52 H/LD5/uTjbzP0GDUTmejl5ls= X-Received: by 127.0.0.2 with SMTP id uy9aYY7687511xPaxltn74Uo; Thu, 07 Dec 2023 05:24:24 -0800 X-Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) by mx.groups.io with SMTP id smtpd.web11.83459.1701955463602822730 for ; Thu, 07 Dec 2023 05:24:23 -0800 X-Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2c9c18e7990so9996721fa.2 for ; Thu, 07 Dec 2023 05:24:23 -0800 (PST) X-Gm-Message-State: xLjDbMezmZy2zMIcjBebNFJ0x7686176AA= X-Google-Smtp-Source: AGHT+IHO+09DrFO9RUsYT6s1gCu1dtNYgqUxjcmK1ATdKvP3LV+zHA00v9RALKOUB6sivlbpF/+V/A== X-Received: by 2002:a2e:3805:0:b0:2ca:ad:880d with SMTP id f5-20020a2e3805000000b002ca00ad880dmr1316244lja.89.1701955461416; Thu, 07 Dec 2023 05:24:21 -0800 (PST) X-Received: from localhost.localdomain ([79.164.221.98]) by smtp.gmail.com with ESMTPSA id n1-20020a2ebd01000000b002ca1923139fsm246052ljq.97.2023.12.07.05.24.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 07 Dec 2023 05:24:20 -0800 (PST) From: "Mike Maslenkin" To: devel@edk2.groups.io Cc: Abner Chang , Nickle Wang , Igor Kulchytskyy Subject: [edk2-devel] [RFC PATCH] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses Date: Thu, 7 Dec 2023 16:24:19 +0300 Message-Id: <20231207132419.6107-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=KikWPttn; 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 | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPk= g/RedfishDiscoverDxe/RedfishDiscoverDxe.c index 28ba2d3a9fca..49c96bd28b27 100644 --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c @@ -863,9 +863,23 @@ AddAndSignalNewRedfishService ( }=0D =0D if (RedfishLocation !=3D NULL) {=0D - DiscoveredInstance->Information.Location =3D (CHAR16 *)AllocatePool = (AsciiStrSize ((const CHAR8 *)RedfishLocation) * sizeof (CHAR16));=0D - AsciiStrToUnicodeStrS ((const CHAR8 *)RedfishLocation, DiscoveredIns= tance->Information.Location, AsciiStrSize ((const CHAR8 *)RedfishLocation) = * sizeof (CHAR16));=0D - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", Disc= overedInstance->Information.Location));=0D + UINTN AllocSize;=0D + CONST CHAR8 *IpAddress;=0D +=0D + IpAddress =3D (CONST CHAR8 *)RedfishLocation;=0D + AllocSize =3D AsciiStrSize (IpAddress) * sizeof (CHAR16);=0D +=0D + if (CheckIsIpVersion6 (NetworkInterface)) {=0D + AllocSize +=3D 2 * sizeof (CHAR16); // take into account '[' and '= ]'=0D +=0D + DiscoveredInstance->Information.Location =3D (CHAR16 *)AllocatePoo= l (AllocSize);=0D + UnicodeSPrintAsciiFormat (DiscoveredInstance->Information.Location= , AllocSize, "[%a]", IpAddress);=0D + } else {=0D + DiscoveredInstance->Information.Location =3D (CHAR16 *)AllocatePoo= l (AllocSize);=0D + AsciiStrToUnicodeStrS (IpAddress, DiscoveredInstance->Information.= Location, AllocSize);=0D + }=0D +=0D + DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s\n", Disco= veredInstance->Information.Location));=0D }=0D =0D if (Uuid !=3D NULL) {=0D --=20 2.32.0 (Apple Git-132) -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112189): https://edk2.groups.io/g/devel/message/112189 Mute This Topic: https://groups.io/mt/103033764/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-