[AMD Official Use Only - General] > -----Original Message----- > From: Mike Maslenkin <mike.maslen...@gmail.com> > Sent: Thursday, December 7, 2023 9:24 PM > To: devel@edk2.groups.io > Cc: Chang, Abner <abner.ch...@amd.com>; Nickle Wang > <nick...@nvidia.com>; Igor Kulchytskyy <ig...@ami.com> > Subject: [RFC PATCH] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI > for IPv6 addresses > > Caution: This message originated from an External Source. Use proper caution > when opening attachments, clicking links, or responding. > > > 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 <abner.ch...@amd.com> > Cc: Nickle Wang <nick...@nvidia.com> > Cc: Igor Kulchytskyy <ig...@ami.com> > Signed-off-by: Mike Maslenkin <mike.maslen...@gmail.com> > --- > .../RedfishDiscoverDxe/RedfishDiscoverDxe.c | 20 ++++++++++++++++--- > 1 file changed, 17 insertions(+), 3 deletions(-) > > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > index 28ba2d3a9fca..49c96bd28b27 100644 > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > @@ -863,9 +863,23 @@ AddAndSignalNewRedfishService ( > } > > > > if (RedfishLocation != NULL) { > > - DiscoveredInstance->Information.Location = (CHAR16 *)AllocatePool > (AsciiStrSize ((const CHAR8 *)RedfishLocation) * sizeof (CHAR16)); > > - AsciiStrToUnicodeStrS ((const CHAR8 *)RedfishLocation, > DiscoveredInstance->Information.Location, AsciiStrSize ((const CHAR8 > *)RedfishLocation) * sizeof (CHAR16)); > > - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", > DiscoveredInstance->Information.Location)); > > + UINTN AllocSize; > > + CONST CHAR8 *IpAddress; Please move the local variable declarations at the beginning of this function. All others look good to me. Thanks Abner
> > + > > + IpAddress = (CONST CHAR8 *)RedfishLocation; > > + AllocSize = AsciiStrSize (IpAddress) * sizeof (CHAR16); > > + > > + if (CheckIsIpVersion6 (NetworkInterface)) { > > + AllocSize += 2 * sizeof (CHAR16); // take into account '[' and ']' > > + > > + DiscoveredInstance->Information.Location = (CHAR16 *)AllocatePool > (AllocSize); > > + UnicodeSPrintAsciiFormat (DiscoveredInstance->Information.Location, > AllocSize, "[%a]", IpAddress); > > + } else { > > + DiscoveredInstance->Information.Location = (CHAR16 *)AllocatePool > (AllocSize); > > + AsciiStrToUnicodeStrS (IpAddress, DiscoveredInstance- > >Information.Location, AllocSize); > > + } > > + > > + DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s\n", > DiscoveredInstance->Information.Location)); > > } > > > > if (Uuid != NULL) { > > -- > 2.32.0 (Apple Git-132) -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112470): https://edk2.groups.io/g/devel/message/112470 Mute This Topic: https://groups.io/mt/103033764/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-