From nobody Wed May 22 02:11:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+112189+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+112189+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1701955464; cv=none; d=zohomail.com; s=zohoarc; b=ODfy3VaLsDFINmZKbJ41AS8b/ZFjrXEphI+h5TtaDwgeu9MAn8bxqbBWSVhIUMhWN5XyqSYqZIvYj0InXK0JAPRcSlsTStJBZMwxgI2TFtnv2O2+O/zvSdgbxiP36oKL9f3lF5Kwg3AZHiq3O+iYwWQBlr1rWMgm7X0SrqYJMtw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701955464; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=a48Z58/9l+08iNZ55irGZvQtRsB3PXjq1x1KERxzitg=; b=PFT/NYBulYHmR83/7J0bQyKfoot6rDRG1jyFgYr9FChS3j9Fjk7mD0aCr0pQ68ORAOU8UTUmVH9fPM+MSLTw7FSiWWLd49vDZaGfJ5nuZ1zWcyfjk5U3XLUeUCUb2H8ZKtwSLABo4ZrHM5wh8vJSxw+dQ1avwEqTIkjD1RBenIc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+112189+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 17019554649821016.3594901567236; Thu, 7 Dec 2023 05:24:24 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=2kGoO+b/l98ay1Ewv+r3GhnzIr4C0mqcJtO7oePFJXc=; 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=X7iw2mCEcQAUUXRUAgPSK+7c5eCrd9AkcTP2y7QORjcZEyeeBVkhjMROR0mbKzn2V2oLNV4+ 86lC+cFyPFWWMVsRGeYR5k+BCYk7pYdl/Je90QAI9vK5ujwocIrjkNLt7iC+2ySBk6tekvh7vpR pXua5Q4BZU4XYl5QNE9/Gn/A= X-Received: by 127.0.0.2 with SMTP id wVjrYY1788612xPufR4rOY9U; 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: SwIeka9HWiy8jLPIYEaHYEm0x1787277AA= 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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1701955465987100001 Content-Type: text/plain; charset="utf-8" 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 ( } =20 if (RedfishLocation !=3D NULL) { - DiscoveredInstance->Information.Location =3D (CHAR16 *)AllocatePool = (AsciiStrSize ((const CHAR8 *)RedfishLocation) * sizeof (CHAR16)); - AsciiStrToUnicodeStrS ((const CHAR8 *)RedfishLocation, DiscoveredIns= tance->Information.Location, AsciiStrSize ((const CHAR8 *)RedfishLocation) = * sizeof (CHAR16)); - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", Disc= overedInstance->Information.Location)); + UINTN AllocSize; + CONST CHAR8 *IpAddress; + + IpAddress =3D (CONST CHAR8 *)RedfishLocation; + AllocSize =3D AsciiStrSize (IpAddress) * sizeof (CHAR16); + + if (CheckIsIpVersion6 (NetworkInterface)) { + AllocSize +=3D 2 * sizeof (CHAR16); // take into account '[' and '= ]' + + DiscoveredInstance->Information.Location =3D (CHAR16 *)AllocatePoo= l (AllocSize); + UnicodeSPrintAsciiFormat (DiscoveredInstance->Information.Location= , AllocSize, "[%a]", IpAddress); + } else { + DiscoveredInstance->Information.Location =3D (CHAR16 *)AllocatePoo= l (AllocSize); + AsciiStrToUnicodeStrS (IpAddress, DiscoveredInstance->Information.= Location, AllocSize); + } + + DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s\n", Disco= veredInstance->Information.Location)); } =20 if (Uuid !=3D NULL) { --=20 2.32.0 (Apple Git-132) -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- 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/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-