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 977D1AC0A3F for ; Tue, 19 Dec 2023 02:52:23 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=stoKoBIWKA4BLzNvoCM/g6ngtQOPf3aZSROIwfZdct8=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1702954342; v=1; b=N7P6xKcgCpkGwYWODXqZK1GRfxhDqh0RqlO92vBEMJppbvv8wfiNsKp0wZeS+/ynoB0+cYzq Htmjq1VB1PgL6+jebiKbIE/gyacurT8WAFrXglmzUhO9LmBMdIrLaRqBH5L31UNbLx0nOvvtYgn lOlZguj5V/YtiA/48T25/dtI= X-Received: by 127.0.0.2 with SMTP id hjyHYY7687511xNI9irDgvK1; Mon, 18 Dec 2023 18:52:22 -0800 X-Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by mx.groups.io with SMTP id smtpd.web11.4071.1702954341658070644 for ; Mon, 18 Dec 2023 18:52:21 -0800 X-Received: by mail-qk1-f173.google.com with SMTP id af79cd13be357-78102c516a7so3761085a.2 for ; Mon, 18 Dec 2023 18:52:21 -0800 (PST) X-Gm-Message-State: JG5wX9mmZZOG01VteL5OjXELx7686176AA= X-Google-Smtp-Source: AGHT+IHFb6tR1dlYiaIuB4UYODu6sUpE7Ejc5Ua58Tao3bK+c9LHD/tEyi3jfJqFP1fmrnh1yNpLTYTaWbR89aCZzDE= X-Received: by 2002:a05:620a:3787:b0:780:e076:3a16 with SMTP id pi7-20020a05620a378700b00780e0763a16mr3339146qkn.61.1702954340680; Mon, 18 Dec 2023 18:52:20 -0800 (PST) MIME-Version: 1.0 References: <20231214232458.4636-1-mike.maslenkin@gmail.com> <20231214232458.4636-15-mike.maslenkin@gmail.com> In-Reply-To: From: "Mike Maslenkin" Date: Tue, 19 Dec 2023 05:51:44 +0300 Message-ID: Subject: Re: [edk2-devel] [PATCH v2 14/14] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses To: "Chang, Abner" Cc: "devel@edk2.groups.io" , "nicklew@nvidia.com" , "igork@ami.com" 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-Type: text/plain; charset="UTF-8" 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=N7P6xKcg; 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 Hi Abner, On Mon, Dec 18, 2023 at 7:58=E2=80=AFAM Chang, Abner = wrote: > > [AMD Official Use Only - General] > > > -----Original Message----- > > From: Mike Maslenkin > > Sent: Friday, December 15, 2023 7:25 AM > > To: devel@edk2.groups.io > > Cc: Chang, Abner ; nicklew@nvidia.com; > > igork@ami.com; Mike Maslenkin > > Subject: [PATCH v2 14/14] RedfishPkg: RedfishDiscoverDxe: add [] bracke= ts to > > URI for IPv6 addresses > > > > Caution: This message originated from an External Source. Use proper ca= ution > > when opening attachments, clicking links, or responding. > > > > > > URI is generated based on the RedfishLocation containing an ASCII strin= g > > representing the IP address. So, in the case of IPv4 the canonical > > representation of an IPv4 address was inserted into the resulting Unico= de > > string i.e: "http{,s}://X.X.X.X/". > > > > In the case of IPv6, to access resources, the IP address must be specif= ied > > 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 | 21 ++++++++++++++++--- > > 1 file changed, 18 insertions(+), 3 deletions(-) > > > > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > > index 9d1678c3429e..38eaf4f6decc 100644 > > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > > @@ -715,6 +715,7 @@ DiscoverRedfishHostInterface ( > > The function initalizes particular strings into > > EFI_REDFISH_DISCOVERED_INFORMATION structure > > > > > > > > @param[in] Information EFI_REDFISH_DISCOVERED_INFORMATION > > > > + @param[in] IsIpv6 Flag indicating IP version 6 proto= col is used > > > > @param[in] RedfishVersion Redfish version. > > > > @param[in] RedfishLocation Redfish location. > > > > @param[in] Uuid Service UUID string. > > > > @@ -729,6 +730,7 @@ STATIC > > VOID > > > > InitInformationData ( > > > > IN EFI_REDFISH_DISCOVERED_INFORMATION *Information, > > > > + IN BOOLEAN IsIpv6, > > > > IN UINTN *RedfishVersion OPTIONAL, > > > > IN CONST CHAR8 *RedfishLocation OPTIONAL, > > > > IN CONST CHAR8 *Uuid OPTIONAL, > > > > @@ -738,7 +740,8 @@ InitInformationData ( > > IN CONST CHAR8 *ProductVer OPTIONAL > > > > ) > > > > { > > > > - UINTN AllocationSize; > > > > + UINTN AllocationSize; > > > > + CONST CHAR8 *IpAddress; > > > > > > > > if (RedfishVersion !=3D NULL) { > > > > Information->RedfishVersion =3D *RedfishVersion; > > > > @@ -746,10 +749,21 @@ InitInformationData ( > > } > > > > > > > > if (RedfishLocation !=3D NULL) { > > > > - AllocationSize =3D AsciiStrSize (RedfishLocation) * sizeof = (CHAR16); > > > > + AllocationSize =3D AsciiStrSize (RedfishLocation) * sizeof (CHAR16= ); > > > > + IpAddress =3D RedfishLocation; > Not quite understand why do we need a copy of RedfishLocation in IpAddres= s? > I think we can use RedfishLocation for UnicodeSPrintAsciiFormat later, ri= ght? I'll remove IpAddress variable. It was added into initial RFC as a minimal change reducing a number of type casts. It was also added as self-describing code to show we are supposed to be dealing with RedfishLocation in IP address string format and not anything else. > Thanks > Abner > > > > > + > > > > + if (IsIpv6) { > > > > + AllocationSize +=3D 2 * sizeof (CHAR16); // take into account '[= ' and ']' > > > > + } > > > > + > > > > Information->Location =3D AllocatePool (AllocationSize); > > > > if (Information->Location !=3D NULL) { > > > > - AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, > > AllocationSize); > > > > + if (IsIpv6) { > > > > + UnicodeSPrintAsciiFormat (Information->Location, AllocationSiz= e, > > "[%a]", IpAddress); > > > > + } else { > > > > + AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, > > AllocationSize); > > > > + } > > > > + > > > > DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", > > Information->Location)); > > > > } else { > > > > DEBUG (( > > > > @@ -991,6 +1005,7 @@ AddAndSignalNewRedfishService ( > > > > > > InitInformationData ( > > > > &DiscoveredInstance->Information, > > > > + CheckIsIpVersion6 (NetworkInterface), > > > > RedfishVersion, > > > > RedfishLocation, > > > > Uuid, > > > > -- > > 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 (#112667): https://edk2.groups.io/g/devel/message/112667 Mute This Topic: https://groups.io/mt/103181051/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-