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 92DA1740046 for ; Wed, 13 Dec 2023 13:35:48 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=qgUStJcy17PghGkOLvhhiw6N8rv7nDCDWWLHOk6WRIs=; 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=1702474547; v=1; b=DzbVa7fAPNFLMXk6lVOeT7wTKiw4CxYHkp3Co4p+uk/S44BUor6PTZhCXRZ351L25xNyHqL7 LPa7jX9ixQUgVL+B9sWkDAKflS9bMf8IAfhQqlrJyJ8S5k+lrLLtCQ69TlzOR6rMPhK3ArU7Bwk DbjHOHrrtvWcCA1NXOwYcDBc= X-Received: by 127.0.0.2 with SMTP id CgxWYY7687511x54cs7ys8AW; Wed, 13 Dec 2023 05:35:47 -0800 X-Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) by mx.groups.io with SMTP id smtpd.web11.35703.1702474546634969770 for ; Wed, 13 Dec 2023 05:35:46 -0800 X-Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-da819902678so6345009276.1 for ; Wed, 13 Dec 2023 05:35:46 -0800 (PST) X-Gm-Message-State: B7oM6nA1eYnMKIZKJwHXX7zVx7686176AA= X-Google-Smtp-Source: AGHT+IFv1OgQlmSKVaSM452G9GkC5OzkGGoq7Px7Drp6u6JcyyuQMu/aAlL0vw0y9jahGScGd0+OC2IGaUS5Ynwg5H4= X-Received: by 2002:a25:9390:0:b0:da2:c851:ec0 with SMTP id a16-20020a259390000000b00da2c8510ec0mr5463248ybm.22.1702474545173; Wed, 13 Dec 2023 05:35:45 -0800 (PST) MIME-Version: 1.0 References: <20231207132419.6107-1-mike.maslenkin@gmail.com> In-Reply-To: From: "Mike Maslenkin" Date: Wed, 13 Dec 2023 16:35:09 +0300 Message-ID: Subject: Re: [edk2-devel] [RFC PATCH] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses To: Pedro Falcato Cc: devel@edk2.groups.io, Abner Chang , Nickle Wang , Igor Kulchytskyy 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=DzbVa7fA; 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 Fair. I'll try to make some cleanups before applying this patch after committing Abner's remedy patch https://github.com/tianocore/edk2/pull/5139. Regards, Mike.. On Wed, Dec 13, 2023 at 4:15=E2=80=AFPM Pedro Falcato wrote: > > On Thu, Dec 7, 2023 at 1:24=E2=80=AFPM Mike Maslenkin wrote: > > > > 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 | 20 ++++++++++++++++--- > > 1 file changed, 17 insertions(+), 3 deletions(-) > > > > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/Redfi= shPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > > index 28ba2d3a9fca..49c96bd28b27 100644 > > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > > @@ -863,9 +863,23 @@ AddAndSignalNewRedfishService ( > > } > > > > if (RedfishLocation !=3D NULL) { > > - DiscoveredInstance->Information.Location =3D (CHAR16 *)AllocateP= ool (AsciiStrSize ((const CHAR8 *)RedfishLocation) * sizeof (CHAR16)); > > - AsciiStrToUnicodeStrS ((const CHAR8 *)RedfishLocation, Discovere= dInstance->Information.Location, AsciiStrSize ((const CHAR8 *)RedfishLocati= on) * sizeof (CHAR16)); > > - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", = DiscoveredInstance->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 '[' a= nd ']' > > + > > + DiscoveredInstance->Information.Location =3D (CHAR16 *)Allocat= ePool (AllocSize); > > You don't check for NULL. > > > + UnicodeSPrintAsciiFormat (DiscoveredInstance->Information.Loca= tion, AllocSize, "[%a]", IpAddress); > > + } else { > > + DiscoveredInstance->Information.Location =3D (CHAR16 *)Allocat= ePool (AllocSize); > > You don't check for NULL. > Heck, why does no one check for NULL in this whole function > (AddAndSignalNewRedfishService)? > > -- > Pedro -=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 (#112474): https://edk2.groups.io/g/devel/message/112474 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] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-