Re: [edk2] [Patch] MdeModulePkg: Fix incorrect status check for SockProcessRcvToken
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: Wu, Jiaxin > Sent: Wednesday, May 25, 2016 11:57 AM > To: edk2-devel@lists.01.org > Cc: Fu, Siyuan <siyuan...@intel.com>; Ye, Ting <ting...@intel.com> > Subject: [Patch] MdeModulePkg: Fix incorrect status check for > SockProcessRcvToken > > This patch is used to remove the status check for SockProcessRcvToken. > It's not return EFI_STATUS. > > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> > --- > MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c | 8 ++-- > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c > b/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c > index feed86c..c14fcd7 100644 > --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c > +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c > @@ -1,9 +1,9 @@ > /** @file >Interface function of the Socket. > > -Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved. > +Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved. > This program and the accompanying materials > are licensed and made available under the terms and conditions of the BSD > License > which accompanies this distribution. The full text of the license may be > found at > http://opensource.org/licenses/bsd-license.php > > @@ -695,15 +695,11 @@ SockRcv ( > Status = EFI_CONNECTION_FIN; > goto Exit; >} > >if (RcvdBytes != 0) { > -Status = SockProcessRcvToken (Sock, RcvToken); > - > -if (EFI_ERROR (Status)) { > - goto Exit; > -} > +SockProcessRcvToken (Sock, RcvToken); > > Status = Sock->ProtoHandler (Sock, SOCK_CONSUMED, NULL); >} else { > > if (NULL == SockBufferToken (Sock, >RcvTokenList, RcvToken, 0)) { > -- > 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 2/2] NetworkPkg: Stop the timer before clean IP service.
In Ip6CleanService()it first cleaned some resources, then stop the timer . While before the timer stopped it may try to access some already freed data, which may generate an exception. This patch updates the driver to stop the timer event before starting to clean up the service data. Cc: Wu Jiaxin <jiaxin...@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Subramanian Sriram <srira...@hpe.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> --- NetworkPkg/Ip6Dxe/Ip6Driver.c | 31 --- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/NetworkPkg/Ip6Dxe/Ip6Driver.c b/NetworkPkg/Ip6Dxe/Ip6Driver.c index 16617c1..f2df200 100644 --- a/NetworkPkg/Ip6Dxe/Ip6Driver.c +++ b/NetworkPkg/Ip6Dxe/Ip6Driver.c @@ -149,6 +149,22 @@ Ip6CleanService ( EFI_IPv6_ADDRESS AllNodes; IP6_NEIGHBOR_ENTRY*NeighborCache; + IpSb->State = IP6_SERVICE_DESTROY; + + if (IpSb->Timer != NULL) { +gBS->SetTimer (IpSb->Timer, TimerCancel, 0); +gBS->CloseEvent (IpSb->Timer); + +IpSb->Timer = NULL; + } + + if (IpSb->FasterTimer != NULL) { +gBS->SetTimer (IpSb->FasterTimer, TimerCancel, 0); +gBS->CloseEvent (IpSb->FasterTimer); + +IpSb->FasterTimer = NULL; + } + Ip6ConfigCleanInstance (>Ip6ConfigInstance); if (!IpSb->LinkLocalDadFail) { @@ -214,19 +230,6 @@ Ip6CleanService ( gBS->CloseEvent (IpSb->RecvRequest.MnpToken.Event); } - if (IpSb->Timer != NULL) { -gBS->SetTimer (IpSb->Timer, TimerCancel, 0); -gBS->CloseEvent (IpSb->Timer); - -IpSb->Timer = NULL; - } - - if (IpSb->FasterTimer != NULL) { -gBS->SetTimer (IpSb->FasterTimer, TimerCancel, 0); -gBS->CloseEvent (IpSb->FasterTimer); - -IpSb->FasterTimer = NULL; - } // // Free the Neighbor Discovery resources // @@ -759,8 +762,6 @@ Ip6DriverBindingStop ( ); } else if (IsListEmpty (>Children)) { State = IpSb->State; -IpSb->State = IP6_SERVICE_DESTROY; - Status = Ip6CleanService (IpSb); if (EFI_ERROR (Status)) { IpSb->State = State; -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 0/2] Stop-the-timer-before-clean-IP-service
Fu Siyuan (2): MdeModulePkg: Stop the timer before clean IP service. NetworkPkg: Stop the timer before clean IP service. MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c | 18 ++--- NetworkPkg/Ip6Dxe/Ip6Driver.c | 31 --- 2 files changed, 25 insertions(+), 24 deletions(-) -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 1/2] MdeModulePkg: Stop the timer before clean IP service.
In Ip4CleanService()it first cleaned some resources, then stop the timer . While before the timer stopped it may try to access some already freed data, which may generate an exception. This patch updates the driver to stop the timer event before starting to clean up the service data. Cc: Wu Jiaxin <jiaxin...@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Subramanian Sriram <srira...@hpe.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> --- MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c index fb83784..fcd3ccb 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c @@ -393,6 +393,15 @@ Ip4CleanService ( { EFI_STATUSStatus; + IpSb->State = IP4_SERVICE_DESTROY; + + if (IpSb->Timer != NULL) { +gBS->SetTimer (IpSb->Timer, TimerCancel, 0); +gBS->CloseEvent (IpSb->Timer); + +IpSb->Timer = NULL; + } + if (IpSb->DefaultInterface != NULL) { Status = Ip4FreeInterface (IpSb->DefaultInterface, NULL); @@ -432,13 +441,6 @@ Ip4CleanService ( IpSb->MnpChildHandle = NULL; } - if (IpSb->Timer != NULL) { -gBS->SetTimer (IpSb->Timer, TimerCancel, 0); -gBS->CloseEvent (IpSb->Timer); - -IpSb->Timer = NULL; - } - if (IpSb->ReconfigEvent != NULL) { gBS->CloseEvent (IpSb->ReconfigEvent); @@ -750,8 +752,6 @@ Ip4DriverBindingStop ( } else if (IsListEmpty (>Children)) { State = IpSb->State; -IpSb->State = IP4_SERVICE_DESTROY; - // // OK, clean other resources then uninstall the service binding protocol. // -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] NetworkPkg/TcpDxe: Fix GCC build failure
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: Wu, Jiaxin > Sent: Tuesday, June 14, 2016 10:44 AM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Zhang, > Lubo <lubo.zh...@intel.com> > Subject: [Patch] NetworkPkg/TcpDxe: Fix GCC build failure > > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Zhang Lubo <lubo.zh...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> > --- > NetworkPkg/TcpDxe/SockImpl.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/NetworkPkg/TcpDxe/SockImpl.c b/NetworkPkg/TcpDxe/SockImpl.c > index 35e0f6a..5addbd1 100644 > --- a/NetworkPkg/TcpDxe/SockImpl.c > +++ b/NetworkPkg/TcpDxe/SockImpl.c > @@ -591,16 +591,14 @@ SockCancelToken ( >IN OUT LIST_ENTRY *SpecifiedTokenList >) > { >EFI_STATUS Status; >LIST_ENTRY *Entry; > - LIST_ENTRY *Next; >SOCK_TOKEN *SockToken; > >Status= EFI_SUCCESS; >Entry = NULL; > - Next = NULL; >SockToken = NULL; > >if (IsListEmpty (SpecifiedTokenList) && Token != NULL) { > return EFI_NOT_FOUND; >} > -- > 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] TCP4: Failure to Acknowledge due to DPC Dispatch Nesting
Hi, Eugene The FIN_SENT flag seems OK because an incoming TCP message won't override this flag, while the other control flag like the TIMER_REXMIT and RTT are more complex which need case by case analysis. There is no DPC mechanism when writing the first revision TCP code, so I think we need to review the TCP code for the similar cases to make it more robust. For your question, why not update DPC "such that DPCs at the same TPL didn't preempt each other", the answer is that's the reason why DPC is introduced. The design intention of DPC is to interrupt current code when the preempted code is in the same TPL level with the code being interrupted. For example, consider the case that the SCSI bus and the iSCSI driver is built on top of TCP, which is one of the reason why we design the DPC in history. *The SCSI must be work as synchronous API in some situation according to UEFI spec, while the under layer TCP, IP and MNP are asynchronous API. *A block reading request comes from the FAT on top of the SCSI device, may run oat TPL_CALLBACK, then iSCSI driver transmit a read request message to the network. *The driver's above iSCSI is synchronous and locked on TPL_CALLBACK, while the network drivers can only run at TPL_CALLBACK, which comes out the problem: there is no more data could receive from network any more. You can see that we must allow some event at same TPL level with the current running code to preempt, otherwise there is a deadlock. Best Regards Siyuan From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Cohen, Eugene Sent: Wednesday, May 25, 2016 1:16 AM To: Fu, Siyuan <siyuan...@intel.com>; Ye, Ting <ting...@intel.com>; edk2-devel@lists.01.org; Wu, Jiaxin <jiaxin...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com> Cc: Vaughn, Gregory (IPG LJ Printer Lab) <greg.vau...@hp.com> Subject: Re: [edk2] TCP4: Failure to Acknowledge due to DPC Dispatch Nesting Siyuan, Thanks for clarifying the intended design. Given your response I understand that it's considered acceptable for DPC functions to preempt each other, even at the same registered TPL level and even sometimes with the same exact function (and in the case of TCP operating on the exact same connection). This would seem to present a substantial challenge for DPCs to be written correctly because you have to assume that any protocol or library you call may result in a DPC dispatch and cause other routines at your TPL level (or even another instance of the same function) to be called again. Are there restrictions to when DispatchDPC is allowed to be called or can anyone do it anytime? What if, for some evil reason, someone decided to use DPCs as part of a specialized DebugLib causing the stack to be preempted constantly - do you expect all DPC handlers to behave correctly under these circumstances? Wouldn't it be safer to remove this form of preemption (or at least the same-TPL preemption)? To change the TCP code as you mention, what do you recommend? Right now we have a routine: if (TcpTransmitSegment (Tcb, Nbuf) == 0) { TCP_CLEAR_FLG (Tcb->CtrlFlag, TCP_CTRL_ACK_NOW); Tcb->DelayedAck = 0; } That attempts the transmit and clears the DelayedAck flag as a function of the return status. Are you recommending that we clear CTRL_ACK_NOW and DelayedAck before attempting the transmit? In the case of an error we would need a way to restore the ACK_NOW and DelayedAck these flags which presents the same problem again. But generally I don't think this methodology can be applied to other areas with the same exposure. Consider the TcpToSendData function. It does this: if (TcpTransmitSegment (Tcb, Nbuf) != 0) { NetbufTrim (Nbuf, (Nbuf->Tcp->HeadLen << 2), NET_BUF_HEAD); Nbuf->Tcp = NULL; if ((Flag & TCP_FLG_FIN) != 0) { TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_FIN_SENT); } goto OnError; } which as you can see sets a flag (FIN_SENT) after a DPC preemption point (TcpTransmitSegment) and even later it sets other TCB data after the DPC preemption point: // // update status in TCB // Tcb->DelayedAck = 0; if ((Flag & TCP_FLG_FIN) != 0) { TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_FIN_SENT); } So it seems like the TCB contents may be at risk in a number of places because of DPC preemption. If we the DPC rules were changed such that DPCs at the same TPL didn't preempt each other it would seem to prevent this (to the extent that DPC callbacks use a consistent TPL level to provide protection). Thanks, Eugene From: Fu, Siyuan [mailto:siyuan...@intel.com] Sent: Monday, May 23, 2016 8:45 PM To: Ye, Ting <ting...@intel.com<mailto:ting...@intel.com>>; Cohen, Eugene <eug...@hp.com<mailto:eug...@hp.com>>; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>; Wu, Jiaxin <jiaxin...@intel.com<mailto:jiaxin...
Re: [edk2] [Patch 1/2] MdePkg: Correct EFI_HTTP_CONFIGURE return status value
Serials Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Jiaxin Wu > Sent: Wednesday, May 25, 2016 4:28 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com>; Fu, > Siyuan <siyuan...@intel.com> > Subject: [edk2] [Patch 1/2] MdePkg: Correct EFI_HTTP_CONFIGURE return > status value > > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Zhang Lubo <lubo.zh...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> > --- > MdePkg/Include/Protocol/Http.h | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/MdePkg/Include/Protocol/Http.h > b/MdePkg/Include/Protocol/Http.h > index 22201b4..269416c 100644 > --- a/MdePkg/Include/Protocol/Http.h > +++ b/MdePkg/Include/Protocol/Http.h > @@ -339,11 +339,10 @@ EFI_STATUS >@param[in] HttpConfigData Pointer to the configure data to configure > the instance. > >@retval EFI_SUCCESS Operation succeeded. >@retval EFI_INVALID_PARAMETER One or more of the following conditions > is TRUE: >This is NULL. > - HttpConfigData is NULL. >HttpConfigData->LocalAddressIsIPv6 is > FALSE and >HttpConfigData->IPv4Node is NULL. >HttpConfigData->LocalAddressIsIPv6 is TRUE > and >HttpConfigData->IPv6Node is NULL. >@retval EFI_ALREADY_STARTED Reinitialize this HTTP instance without > calling > -- > 1.9.5.msysgit.1 > > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 3/8] NetworkPkg: Replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: Zeng, Star > Sent: Wednesday, June 15, 2016 4:44 PM > To: edk2-devel@lists.01.org > Cc: Yao, Jiewen <jiewen....@intel.com>; Fu, Siyuan <siyuan...@intel.com>; > Wu, Jiaxin <jiaxin...@intel.com> > Subject: [PATCH 3/8] NetworkPkg: Replace > UnicodeStrToAsciiStr/AsciiStrToUnicodeStr > > It is the follow up of 3ab41b7a325ca11a12b42f5ad1661c4b6791cb49 > to replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr with > UnicodeStrToAsciiStrS/AsciiStrToUnicodeStrS. > > Cc: Jiewen Yao <jiewen@intel.com> > Cc: Siyuan Fu <siyuan...@intel.com> > Cc: Jiaxin Wu <jiaxin...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Star Zeng <star.z...@intel.com> > --- > .../Application/IpsecConfig/PolicyEntryOperation.c | 6 +- > NetworkPkg/HttpBootDxe/HttpBootClient.c| 19 +++-- > NetworkPkg/HttpBootDxe/HttpBootConfig.c| 2 +- > NetworkPkg/HttpDxe/HttpImpl.c | 8 +- > NetworkPkg/HttpDxe/HttpProto.c | 8 +- > NetworkPkg/IScsiDxe/IScsiConfig.c | 88 > +++--- > NetworkPkg/IScsiDxe/IScsiDriver.c | 2 +- > NetworkPkg/IScsiDxe/IScsiMisc.c| 6 +- > 8 files changed, 87 insertions(+), 52 deletions(-) > > diff --git a/NetworkPkg/Application/IpsecConfig/PolicyEntryOperation.c > b/NetworkPkg/Application/IpsecConfig/PolicyEntryOperation.c > index 9bbc11490c54..06eb30c091c9 100644 > --- a/NetworkPkg/Application/IpsecConfig/PolicyEntryOperation.c > +++ b/NetworkPkg/Application/IpsecConfig/PolicyEntryOperation.c > @@ -271,7 +271,7 @@ CreateSpdEntry ( >// >ValueStr = ShellCommandLineGetValue (ParamPackage, L"--name"); >if (ValueStr != NULL) { > -UnicodeStrToAsciiStr (ValueStr, (CHAR8 *) (*Data)->Name); > +UnicodeStrToAsciiStrS (ValueStr, (CHAR8 *) (*Data)->Name, sizeof > ((*Data)->Name)); > *Mask |= NAME; >} > > @@ -785,7 +785,7 @@ CreateSadEntry ( > (*Data)->AlgoInfo.EspAlgoInfo.EncKeyLength = EncKeyLength; > AsciiStr = AllocateZeroPool (EncKeyLength + 1); > ASSERT (AsciiStr != NULL); > -UnicodeStrToAsciiStr (ValueStr, AsciiStr); > +UnicodeStrToAsciiStrS (ValueStr, AsciiStr, EncKeyLength + 1); > CopyMem ((*Data)->AlgoInfo.EspAlgoInfo.EncKey, AsciiStr, EncKeyLength); > FreePool (AsciiStr); > *Mask |= ENCRYPT_KEY; > @@ -815,7 +815,7 @@ CreateSadEntry ( > (*Data)->AlgoInfo.EspAlgoInfo.AuthKeyLength = AuthKeyLength; > AsciiStr = AllocateZeroPool (AuthKeyLength + 1); > ASSERT (AsciiStr != NULL); > -UnicodeStrToAsciiStr (ValueStr, AsciiStr); > +UnicodeStrToAsciiStrS (ValueStr, AsciiStr, AuthKeyLength + 1); > CopyMem ((*Data)->AlgoInfo.EspAlgoInfo.AuthKey, AsciiStr, > AuthKeyLength); > FreePool (AsciiStr); > *Mask |= AUTH_KEY; > diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c > b/NetworkPkg/HttpBootDxe/HttpBootClient.c > index e543d9f88303..916f2375c98b 100644 > --- a/NetworkPkg/HttpBootDxe/HttpBootClient.c > +++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c > @@ -255,6 +255,7 @@ HttpBootDhcp6ExtractUriInfo ( >EFI_DHCP6_PACKET_OPTION *Option; >EFI_IPv6_ADDRESSIpAddr; >CHAR8 *HostName; > + UINTN HostNameSize; >CHAR16 *HostNameStr; >EFI_STATUS Status; > > @@ -349,14 +350,15 @@ HttpBootDhcp6ExtractUriInfo ( > if (EFI_ERROR (Status)) { >return Status; > } > - > -HostNameStr = AllocateZeroPool ((AsciiStrLen (HostName) + 1) * sizeof > (CHAR16)); > + > +HostNameSize = AsciiStrSize (HostName); > +HostNameStr = AllocateZeroPool (HostNameSize * sizeof (CHAR16)); > if (HostNameStr == NULL) { >Status = EFI_OUT_OF_RESOURCES; >goto Error; > } > > -AsciiStrToUnicodeStr (HostName, HostNameStr); > +AsciiStrToUnicodeStrS (HostName, HostNameStr, HostNameSize); > Status = HttpBootDns (Private, HostNameStr, ); > FreePool (HostNameStr); > if (EFI_ERROR (Status)) { > @@ -752,6 +754,7 @@ HttpBootGetBootFile ( >UINTN ContentLength; >HTTP_BOOT_CACHE_CONTENT*Cache; >UINT8 *Block; > + UINTN UrlSize; >CHAR16 *Url; >BOOLEANIdentityMode; >UINTN ReceivedSize; > @@ -770,11 +773,12 @@ HttpBootGetBootFile ( >// >// First, check whether we already
Re: [edk2] [PATCH v1 1/1] MdePkg: MTftp6: Correct #define value in Mtfp6.h
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > hegdenag > Sent: Thursday, June 16, 2016 12:51 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, > Jiaxin <jiaxin...@intel.com> > Subject: [edk2] [PATCH v1 1/1] MdePkg: MTftp6: Correct #define value in > Mtfp6.h > > defined values of EFI_MTFTP6_ERRORCODE_ILLEGAL_OPERATION and > EFI_MTFTP6_ERRORCODE_FILE_ALREADY_EXISTS are the same. This patch > corrects the value of EFI_MTFTP6_ERRORCODE_ILLEGAL_OPERATION to 4. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Hegde Nagaraj P <nagaraj-p.he...@hpe.com> > --- > MdePkg/Include/Protocol/Mtftp6.h | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/MdePkg/Include/Protocol/Mtftp6.h > b/MdePkg/Include/Protocol/Mtftp6.h > index b983660..e0cfc49 100644 > --- a/MdePkg/Include/Protocol/Mtftp6.h > +++ b/MdePkg/Include/Protocol/Mtftp6.h > @@ -4,6 +4,8 @@ >multicast TFTP operations. > >Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved. > + (C) Copyright 2016 Hewlett Packard Enterprise Development LP > + >This program and the accompanying materials >are licensed and made available under the terms and conditions of the BSD > License >which accompanies this distribution. The full text of the license may be > found at > @@ -70,7 +72,7 @@ typedef struct _EFI_MTFTP6_TOKEN > EFI_MTFTP6_TOKEN; > /// > /// The MTFTPv6 operation was illegal. > /// > -#define EFI_MTFTP6_ERRORCODE_ILLEGAL_OPERATION 6 > +#define EFI_MTFTP6_ERRORCODE_ILLEGAL_OPERATION 4 > /// > /// The transfer ID is unknown. > /// > -- > 2.8.3.windows.1 > > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] NetworkPkg: Fix unspecified address use case in IpsecConfig
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: Wu, Jiaxin > Sent: Wednesday, June 15, 2016 4:26 PM > To: edk2-devel@lists.01.org > Cc: Fu, Siyuan <siyuan...@intel.com>; Ye, Ting <ting...@intel.com>; Zeng, > Star <star.z...@intel.com> > Subject: [Patch] NetworkPkg: Fix unspecified address use case in IpsecConfig > > This patch is used to fix unspecified address use case in > ConstructSpdIndexer() function. Indexer->Name for > ConstructSpdIndexer is unspecified, that will be a problem > for UnicodeStrToAsciiStr. > > This patch also refine the code by removing ASSERT and user > error handling. > > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Zeng Star <star.z...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> > --- > NetworkPkg/Application/IpsecConfig/Indexer.c | 26 --- > --- > NetworkPkg/Application/IpsecConfig/Indexer.h | 4 ++-- > NetworkPkg/Application/IpsecConfig/Match.c | 4 ++-- > 3 files changed, 20 insertions(+), 14 deletions(-) > > diff --git a/NetworkPkg/Application/IpsecConfig/Indexer.c > b/NetworkPkg/Application/IpsecConfig/Indexer.c > index 83ceda4..353b22e 100644 > --- a/NetworkPkg/Application/IpsecConfig/Indexer.c > +++ b/NetworkPkg/Application/IpsecConfig/Indexer.c > @@ -1,9 +1,9 @@ > /** @file >The implementation of construct ENTRY_INDEXER in IpSecConfig > application. > > - Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved. > + Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved. > >This program and the accompanying materials >are licensed and made available under the terms and conditions of the BSD > License >which accompanies this distribution. The full text of the license may be > found at >http://opensource.org/licenses/bsd-license.php. > @@ -42,21 +42,23 @@ ConstructSpdIndexer ( >} else if (ShellCommandLineGetFlag (ParamPackage, L"-d")) { > ValueStr = ShellCommandLineGetValue (ParamPackage, L"-d"); >} else if (ShellCommandLineGetFlag (ParamPackage, L"-e")) { > ValueStr = ShellCommandLineGetValue (ParamPackage, L"-e"); >} else { > -ASSERT (FALSE); > +return EFI_INVALID_PARAMETER; >} > > - ASSERT (ValueStr != NULL); > - > + if (ValueStr == NULL) { > +return EFI_INVALID_PARAMETER; > + } > + >Value64 = StrToUInteger (ValueStr, ); >if (!EFI_ERROR (Status)) { > Indexer->Index = (UINTN) Value64; > -Indexer->Name = NULL; > +ZeroMem (Indexer->Name, MAX_PEERID_LEN); >} else { > -UnicodeStrToAsciiStr (ValueStr, (CHAR8 *) Indexer->Name); > +UnicodeStrToAsciiStrS (ValueStr, (CHAR8 *) Indexer->Name, > MAX_PEERID_LEN); >} > >return EFI_SUCCESS; > } > > @@ -87,14 +89,16 @@ ConstructSadIndexer ( >} else if (ShellCommandLineGetFlag (ParamPackage, L"-d")) { > ValueStr = ShellCommandLineGetValue (ParamPackage, L"-d"); >} else if (ShellCommandLineGetFlag (ParamPackage, L"-e")) { > ValueStr = ShellCommandLineGetValue (ParamPackage, L"-e"); >} else { > -ASSERT (FALSE); > +return EFI_INVALID_PARAMETER; >} > > - ASSERT (ValueStr != NULL); > + if (ValueStr == NULL) { > +return EFI_INVALID_PARAMETER; > + } > >Value64 = StrToUInteger (ValueStr, ); >if (!EFI_ERROR (Status)) { > Indexer->Index = (UINTN) Value64; > ZeroMem (>SaId, sizeof (EFI_IPSEC_SA_ID)); > @@ -185,14 +189,16 @@ ConstructPadIndexer ( >} else if (ShellCommandLineGetFlag (ParamPackage, L"-d")) { > ValueStr = ShellCommandLineGetValue (ParamPackage, L"-d"); >} else if (ShellCommandLineGetFlag (ParamPackage, L"-e")) { > ValueStr = ShellCommandLineGetValue (ParamPackage, L"-e"); >} else { > -ASSERT (FALSE); > +return EFI_INVALID_PARAMETER; >} > > - ASSERT (ValueStr != NULL); > + if (ValueStr == NULL) { > +return EFI_INVALID_PARAMETER; > + } > >Value64 = StrToUInteger (ValueStr, ); > >if (!EFI_ERROR (Status)) { > Indexer->Index = (UINTN) Value64; > diff --git a/NetworkPkg/Application/IpsecConfig/Indexer.h > b/NetworkPkg/Application/IpsecConfig/Indexer.h > index 078f38a..b0e62fb 100644 > --- a/NetworkPkg/Application/IpsecConfig/Indexer.h > +++ b/NetworkPkg/Application/IpsecConfig/Indexer.h > @@ -1,10 +1,10 @@ > /** @file >The internal structure and function declaration
Re: [edk2] [Patch] MdeModulePkg: Fix the wrong IpSb->State update
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: Wu, Jiaxin > Sent: Wednesday, June 22, 2016 7:14 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Ryan > Harkin <ryan.har...@linaro.org> > Subject: [Patch] MdeModulePkg: Fix the wrong IpSb->State update > > This patch is used to fix the wrong IpSb->State update issue. > > Issue reproduce steps: > 1 .First PXE boot, then boot to shell; > 2. ifconfig -s eth0 dhcp (Success); > 3. Reboot and do PXE, then boot to shell; > 4. ifconfig -s eth0 dhcp (Platform failed to get IP address no matter >how many times retried.) > > Root cause: > On step3 reboot, policy is DHCP (Changed by step2). So, Ip4Dxe driver > will try to get one IP address from DHCP server automatically. Before > it get the IP address successfully, the IpSb->State will be always in > IP4_SERVICE_STARTED status until the Instance->Dhcp4Event is triggered, > then it can be changed to IP4_SERVICE_CONFIGED. But the DHCP process > will be interrupted by PXE boot, which will change the policy to static, > and the Instance->Dhcp4Event will be also closed directly. However, > current implementation doesn't update the IpSb->State to > IP4_SERVICE_UNSTARTED status in such case. So, failure happened. > > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Ryan Harkin <ryan.har...@linaro.org> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> > --- > MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c > b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c > index d0fa132..10d7181 100644 > --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c > +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c > @@ -140,11 +140,11 @@ Ip4Config2OnPolicyChanged ( >IpSb->DefaultInterface = IpIf; >InsertHeadList (>Interfaces, >Link); >IpSb->DefaultRouteTable = RouteTable; >Ip4ReceiveFrame (IpIf, NULL, Ip4AccpetFrame, IpSb); > > - if (IpSb->State == IP4_SERVICE_CONFIGED) { > + if (IpSb->State == IP4_SERVICE_CONFIGED || IpSb->State == > IP4_SERVICE_STARTED) { > IpSb->State = IP4_SERVICE_UNSTARTED; >} > >// >// Start the dhcp configuration. > -- > 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [patch 1/3] NetworkPkg: Refine codes related to Dhcpv4 and Dhcpv6 configuration.
Series Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Zhang Lubo > Sent: Friday, June 17, 2016 11:08 AM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, > Jiaxin <jiaxin...@intel.com> > Subject: [edk2] [patch 1/3] NetworkPkg: Refine codes related to Dhcpv4 and > Dhcpv6 configuration. > > Add a new head file Dhcp.h in Mde/Include/IndustryStandard, normalize the > universal option numbers and other network number tags. > > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Wu Jiaxin <jiaxin...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Zhang Lubo <lubo.zh...@intel.com> > --- > NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h| 128 > + > NetworkPkg/HttpBootDxe/HttpBootDhcp4.c | 82 ++--- > NetworkPkg/HttpBootDxe/HttpBootDhcp4.h | 51 ++--- > NetworkPkg/HttpBootDxe/HttpBootDhcp6.c | 30 > NetworkPkg/HttpBootDxe/HttpBootDhcp6.h | 27 +-- > NetworkPkg/HttpBootDxe/HttpBootDxe.h | 1 + > NetworkPkg/IScsiDxe/IScsiDhcp.c| 10 +-- > NetworkPkg/IScsiDxe/IScsiDhcp.h| 9 +-- > NetworkPkg/IScsiDxe/IScsiDhcp6.c | 8 +-- > NetworkPkg/IScsiDxe/IScsiDhcp6.h | 11 +-- > NetworkPkg/IScsiDxe/IScsiImpl.h| 4 +- > NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c | 6 +- > NetworkPkg/Ip6Dxe/Ip6ConfigImpl.h | 2 - > NetworkPkg/Ip6Dxe/Ip6Impl.h| 4 +- > NetworkPkg/Ip6Dxe/Ip6Nd.c | 4 +- > NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c | 98 - > NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.h | 42 +-- > NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c | 28 > NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.h | 25 +-- > NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h| 3 +- > 20 files changed, 155 insertions(+), 418 deletions(-) > > diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h > b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h > index e3e7553..86ef8af 100644 > --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h > +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h > @@ -1,9 +1,9 @@ > /** @file >Dhcp6 internal data structure and definition declaration. > > - Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved. > + Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved. > >This program and the accompanying materials >are licensed and made available under the terms and conditions of the BSD > License >which accompanies this distribution. The full text of the license may be > found at >http://opensource.org/licenses/bsd-license.php. > @@ -17,10 +17,12 @@ > #define __EFI_DHCP6_IMPL_H__ > > > #include > > +#include > + > #include > #include > #include > #include > #include > @@ -48,70 +50,10 @@ typedef struct _DHCP6_INSTANCE DHCP6_INSTANCE; > #include "Dhcp6Driver.h" > > #define DHCP6_SERVICE_SIGNATURE SIGNATURE_32 ('D', 'H', '6', 'S') > #define DHCP6_INSTANCE_SIGNATURE SIGNATURE_32 ('D', 'H', '6', 'I') > > -// > -// Transmit parameters of solicit message, refers to section-5.5 of rfc-3315. > -// > -#define DHCP6_SOL_MAX_DELAY 1 > -#define DHCP6_SOL_IRT 1 > -#define DHCP6_SOL_MRC 0 > -#define DHCP6_SOL_MRT 120 > -#define DHCP6_SOL_MRD 0 > -// > -// Transmit parameters of request message, refers to section-5.5 of rfc-3315. > -// > -#define DHCP6_REQ_IRT 1 > -#define DHCP6_REQ_MRC 10 > -#define DHCP6_REQ_MRT 30 > -#define DHCP6_REQ_MRD 0 > -// > -// Transmit parameters of confirm message, refers to section-5.5 of rfc-3315. > -// > -#define DHCP6_CNF_MAX_DELAY 1 > -#define DHCP6_CNF_IRT 1 > -#define DHCP6_CNF_MRC 0 > -#define DHCP6_CNF_MRT 4 > -#define DHCP6_CNF_MRD 10 > -// > -// Transmit parameters of renew message, refers to section-5.5 of rfc-3315. > -// > -#define DHCP6_REN_IRT 10 > -#define DHCP6_REN_MRC 0 > -#define DHCP6_REN_MRT 600 > -#define DHCP6_REN_MRD 0 > -// > -// Transmit parameters of rebind message, refers to section-5.5 of rfc-3315. > -// > -#define DHCP6_REB_IRT 10 > -#define DHCP6_REB_MRC 0 > -#define DHCP6_REB_MRT 600 > -#define DHCP6_REB_MRD 0 > -// > -// Transmit parameters of information request message, refers to section-5.5 > of rfc-3315. > -//
Re: [edk2] [PATCH] SecurityPkg: SecureBootConfigDxe: Change KEY_TRANS_SECURE_BOOT_MODE value
It's good to me. Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Zhang, Chao B Sent: Thursday, January 14, 2016 9:01 AM To: edk2-de...@ml01.01.org Cc: Fu, Siyuan <siyuan...@intel.com>; Zhang, Chao B <chao.b.zh...@intel.com>; Long, Qin <qin.l...@intel.com> Subject: [edk2] [PATCH] SecurityPkg: SecureBootConfigDxe: Change KEY_TRANS_SECURE_BOOT_MODE value Change KEY_TRANS_SECURE_BOOT_MODE value, as it conflicts with OPTION_DEL_KEK_QUESTION_ID. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chao Zhang <chao.b.zh...@intel.com> --- .../SecureBootConfigDxe/SecureBootConfigNvData.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigNvData.h b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigNvData.h index 75f41e8..101b605 100644 --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigNvData.h +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCo +++ nfigNvData.h @@ -1,7 +1,7 @@ /** @file Header file for NV data structure definition. -Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved. +Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -62,6 +62,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define KEY_HIDE_SECURE_BOOT 0x100c #define KEY_VALUE_SAVE_AND_EXIT_DBT 0x100d #define KEY_VALUE_NO_SAVE_AND_EXIT_DBT0x100e +#define KEY_TRANS_SECURE_BOOT_MODE0x100f #define KEY_SECURE_BOOT_OPTION0x1100 #define KEY_SECURE_BOOT_PK_OPTION 0x1101 @@ -84,7 +85,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define LABEL_DBT_DELETE 0x1203 #define LABEL_END 0x -#define KEY_TRANS_SECURE_BOOT_MODE0x2000 #define SECURE_BOOT_MAX_ATTEMPTS_NUM 255 -- 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch 0/2] Fix IpSec SPD and SAD mapping issue when SPD updated
The patch is good to me. Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: Wu, Jiaxin Sent: Monday, January 11, 2016 4:44 PM To: edk2-devel@lists.01.org Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com> Subject: [Patch 0/2] Fix IpSec SPD and SAD mapping issue when SPD updated The serial patches are used to fix the IpSec SPD and SAD mapping issue when SPD updated by IPSecConfig tool. The problem is divided into two parts: One is SPD SetData policy, and the other is edit policy which mainly triggered by IPSecConfig tool. Cc: Ye Ting <ting...@intel.com> Cc: Fu Siyuan <siyuan...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> Jiaxin Wu (2): NetworkPkg: Fix IpSec SPD and SAD mapping issue when SPD is updated NetworkPkg: Fix SPD entry edit policy issue in IPSecConfig. .../Application/IpsecConfig/PolicyEntryOperation.c | 41 ++--- NetworkPkg/IpSecDxe/IpSecConfigImpl.c | 68 +++--- 2 files changed, 64 insertions(+), 45 deletions(-) -- 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] SecurityPkg: SecureBootConfigDxe: Fix string typo
Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: Zhang, Chao B Sent: Friday, January 15, 2016 9:39 AM To: edk2-de...@ml01.01.org Cc: Long, Qin <qin.l...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Zhang, Chao B <chao.b.zh...@intel.com> Subject: [PATCH] SecurityPkg: SecureBootConfigDxe: Fix string typo Fix transition string typo. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chao Zhang <chao.b.zh...@intel.com> --- .../SecureBootConfigDxe/SecureBootConfigImpl.c | 6 +++--- .../SecureBootConfigDxe/SecureBootConfigStrings.uni | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c index aafb3b3..e0f934b 100644 --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCo +++ nfigImpl.c @@ -3463,7 +3463,7 @@ SecureBootCallback ( mIsEnterSecureBootForm = TRUE; } else if (QuestionId == KEY_TRANS_SECURE_BOOT_MODE){ // - // Secure Boot Policy variable changes after tranistion. Re-sync CurSecureBootMode + // Secure Boot Policy variable changes after transition. Re-sync + CurSecureBootMode // ExtractSecureBootModeFromVariable(>CurSecureBootMode); mIsSelectedSecureBootModeForm = TRUE; @@ -3752,7 +3752,7 @@ SecureBootCallback ( CreatePopUp ( EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, , - L"Secure boot mode tranistion requires PK change", + L"Secure boot mode transition requires PK change", L"Please go to link below to update PK", NULL ); @@ -3763,7 +3763,7 @@ SecureBootCallback ( Status = SecureBootModeTransition(IfrNvData->CurSecureBootMode, Value->u8); // - // Secure Boot Policy variable may change after tranistion. Re-sync CurSecureBootMode + // Secure Boot Policy variable may change after transition. + Re-sync CurSecureBootMode // ExtractSecureBootModeFromVariable(); if (IfrNvData->CurSecureBootMode != CurSecureBootMode) { diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigStrings.uni b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigStrings.uni index 500108a..eedd8b5 100644 --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigStrings.uni +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCo +++ nfigStrings.uni @@ -1,7 +1,7 @@ /** @file String definitions for Secure Boot Configuration form. -Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved. +Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -112,7 +112,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #string STR_CERT_TYPE_X509_SHA384_GUID#language en-US "X509_SHA384_GUID" #string STR_CERT_TYPE_X509_SHA512_GUID#language en-US "X509_SHA512_GUID" -#string STR_TRANS_SECURE_BOOT_MODE_PROMPT #language en-US "Secure Boot Mode Tranistion" +#string STR_TRANS_SECURE_BOOT_MODE_PROMPT #language en-US "Secure Boot Mode Transition" #string STR_TRANS_SECURE_BOOT_MODE_HELP #language en-US "Secure Boot Mode Transition: SetupMode/UserMode/AuditMode/DeployedMode" #string STR_USER_MODE #language en-US "User Mode" -- 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH V2] SecurityPkg: SecureBootConfigDxe: Move Secure Boot string update location
The patch is good. Please also update the copy right year to 2016. Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: Zhang, Chao B Sent: Thursday, January 14, 2016 4:43 PM To: edk2-de...@ml01.01.org Cc: Dong, Eric <eric.d...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Zhang, Chao B <chao.b.zh...@intel.com> Subject: [PATCH V2] SecurityPkg: SecureBootConfigDxe: Move Secure Boot string update location ExtractConfig is called many times, so it's not efficient to update Secure Boot STR_SECURE_BOOT_STATE_CONTENT, STR_CUR_SECURE_BOOT_MODE_CONTENT string in ExtractConfig. As these 2 strings are displayed on one form, so always update them when opening the form. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chao Zhang <chao.b.zh...@intel.com> Reviewed-by: Fu Siyuan <siyuan...@intel.com> --- .../SecureBootConfigDxe/SecureBootConfigImpl.c | 97 +- 1 file changed, 56 insertions(+), 41 deletions(-) diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c index a685b40..d281a09 100644 --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCo +++ nfigImpl.c @@ -3061,6 +3061,58 @@ ExtractSecureBootModeFromVariable( } /** + + Update SecureBoot strings based on new Secure Boot Mode State. String + includes STR_SECURE_BOOT_STATE_CONTENT and STR_CUR_SECURE_BOOT_MODE_CONTENT. + + @param[in]PrivateData Module's private data. + + @return EFI_SUCCESS Update secure boot strings successfully. + @return other Fail to update secure boot strings. + +**/ +EFI_STATUS +UpdateSecureBootString( + IN SECUREBOOT_CONFIG_PRIVATE_DATA *Private + ) { + EFI_STATUS Status; + UINT8 CurSecureBootMode; + UINT8 *SecureBoot; + + // + // Get current secure boot state. + // + Status = GetVariable2 (EFI_SECURE_BOOT_MODE_NAME, + , (VOID**), NULL); if (EFI_ERROR(Status)) { +return Status; + } + + if (*SecureBoot == SECURE_BOOT_MODE_ENABLE) { +HiiSetString (Private->HiiHandle, STRING_TOKEN + (STR_SECURE_BOOT_STATE_CONTENT), L"Enabled", NULL); } else { +HiiSetString (Private->HiiHandle, STRING_TOKEN + (STR_SECURE_BOOT_STATE_CONTENT), L"Disabled", NULL); } // // Get + current secure boot mode. + // + ExtractSecureBootModeFromVariable(); + + if (CurSecureBootMode == SECURE_BOOT_MODE_USER_MODE) { +HiiSetString (Private->HiiHandle, STRING_TOKEN + (STR_CUR_SECURE_BOOT_MODE_CONTENT), L"UserMode", NULL); } else if (CurSecureBootMode == SECURE_BOOT_MODE_SETUP_MODE) { +HiiSetString (Private->HiiHandle, STRING_TOKEN + (STR_CUR_SECURE_BOOT_MODE_CONTENT), L"SetupMode", NULL); } else if (CurSecureBootMode == SECURE_BOOT_MODE_AUDIT_MODE) { +HiiSetString (Private->HiiHandle, STRING_TOKEN + (STR_CUR_SECURE_BOOT_MODE_CONTENT), L"AuditMode", NULL); } else if (CurSecureBootMode == SECURE_BOOT_MODE_DEPLOYED_MODE) { +HiiSetString (Private->HiiHandle, STRING_TOKEN + (STR_CUR_SECURE_BOOT_MODE_CONTENT), L"DeployedMode", NULL); } + + FreePool(SecureBoot); + + return EFI_SUCCESS; +} + +/** This function extracts configuration from variable. @param[in, out] ConfigData Point to SecureBoot configuration private data. @@ -3191,7 +3243,6 @@ SecureBootExtractConfig ( EFI_STRINGConfigRequestHdr; SECUREBOOT_CONFIG_PRIVATE_DATA*PrivateData; BOOLEAN AllocatedRequest; - UINT8 *SecureBoot; if (Progress == NULL || Results == NULL) { return EFI_INVALID_PARAMETER; @@ -3201,7 +3252,6 @@ SecureBootExtractConfig ( ConfigRequestHdr = NULL; ConfigRequest= NULL; Size = 0; - SecureBoot = NULL; ZeroMem (, sizeof (Configuration)); PrivateData = SECUREBOOT_CONFIG_PRIVATE_FROM_THIS (This); @@ -3216,31 +3266,6 @@ SecureBootExtractConfig ( // SecureBootExtractConfigFromVariable (); - // - // Get current secure boot state. - // - GetVariable2 (EFI_SECURE_BOOT_MODE_NAME, , (VOID**), NULL); - - if (SecureBoot != NULL && *SecureBoot == SECURE_BOOT_MODE_ENABLE) { -HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_SECURE_BOOT_STATE_CONTENT), L"Enabled", NULL); - } else { -HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_SECURE_BOOT_STATE_CONTENT), L"Disabled", NULL); - } - - // - // Get current secure boot mode - // - DEBUG((EFI_D_INFO, "Configuration.CurSecureBootMode %d\n", Configuration.CurSecureBootMode)); - if (Configuration.CurSecureBootMode == SECURE_BOOT_MODE_USER_MODE) { -HiiSetString (PrivateData-
Re: [edk2] [Patch] edk2: Update the maintainer list.
Jiaxin, It's ok with me. Reviewed-by: Siyuan Fu <siyuan...@intel.com> -Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiaxin Wu Sent: Tuesday, January 19, 2016 9:40 AM To: edk2-devel@lists.01.org Cc: Fu, Siyuan <siyuan...@intel.com>; Tian, Hot <hot.t...@intel.com>; Li, Ruth <ruth...@intel.com>; Long, Qin <qin.l...@intel.com> Subject: [edk2] [Patch] edk2: Update the maintainer list. This patch is used to update the CryptoPkg and NetworkPkg maintainer list. Cc: Long Qin <qin.l...@intel.com> Cc: Fu Siyuan <siyuan...@intel.com> Cc: Tian Hot <hot.t...@intel.com> Cc: Li Ruth <ruth...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> --- Maintainers.txt | 4 1 file changed, 4 insertions(+) diff --git a/Maintainers.txt b/Maintainers.txt index dc0891e..59cd2bf 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -83,10 +83,11 @@ M: Prince Agyeman <prince.agye...@intel.com> S: Maintained CryptoPkg W: https://github.com/tianocore/tianocore.github.io/wiki/CryptoPkg M: Qin Long <qin.l...@intel.com> +M: Ting Ye <ting...@intel.com> DuetPkg W: https://github.com/tianocore/tianocore.github.io/wiki/DuetPkg M: Ruiyu Ni <ruiyu...@intel.com> @@ -144,10 +145,13 @@ M: Michael D Kinney <michael.d.kin...@intel.com> M: Liming Gao <liming@intel.com> NetworkPkg W: https://github.com/tianocore/tianocore.github.io/wiki/NetworkPkg M: Siyuan Fu <siyuan...@intel.com> +M: Jiaxin Wu <jiaxin...@intel.com> +M: Lubo Zhang <lubo.zh...@intel.com> +M: Fan Wang <fan.w...@intel.com> Nt32Pkg W: https://github.com/tianocore/tianocore.github.io/wiki/Nt32Pkg M: Ruiyu Ni <ruiyu...@intel.com> -- 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] NetworkPkg: Stop the HTTP Boot service after the boot image download complete.
After boot image has been downloaded, the HTTP boot driver leaves the service in the started state, with an active TCP child. This may cause some problems: 1. The HTTP session may become unavaiable after a while, then a following HTTP Boot will fail. 2. An active TCP child will send RST to any incoming TCP message, which may break other driver which tries to setup a TCP connection. The HTTP boot driver doesn't provide any interface to the boot loader, so it's unnecessary to keep the service running after a boot image is downloaded. Cc: Ye Ting <ting...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> --- NetworkPkg/HttpBootDxe/HttpBootImpl.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c b/NetworkPkg/HttpBootDxe/HttpBootImpl.c index 4b850b6..babd3e6 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c +++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c @@ -505,7 +505,11 @@ HttpBootDxeLoadFile ( Status = EFI_WARN_FILE_SYSTEM; } } - + + // + // Stop the HTTP Boot service after the boot image is downloaded. + // + HttpBootStop (Private); return Status; } -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [patch 3/3] MdePkg: Refine codes related to Dhcpv4 and Dhcpv6 configuration.
Sriram, I vote for adding them to the IndustryStandard header, but I think we'd better to also keep the existing macros in PxeBaseCode.h. So we won't need to update all the C files to include the new header file. Best Regards Siyuan > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Subramanian, Sriram (EG Servers Platform SW) > Sent: Friday, June 17, 2016 3:29 PM > To: Zhang, Lubo <lubo.zh...@intel.com>; edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, > Jiaxin <jiaxin...@intel.com>; Gao, Liming <liming@intel.com> > Subject: Re: [edk2] [patch 3/3] MdePkg: Refine codes related to Dhcpv4 and > Dhcpv6 configuration. > > OK, in that case how about move those macros from > MdePkg/Include/Protocol/PxeBaseCode.h to this > MdePkg/Include/IndustryStandard/? Because these are defined in RFCs and > assignments controlled by IANA, so more wider scope and not specific to the > UEFI protocols. > > What do you think Ting/Siyuan? > > Thanks, > Sriram. > > -Original Message- > From: Zhang, Lubo [mailto:lubo.zh...@intel.com] > Sent: Friday, June 17, 2016 12:43 PM > To: Subramanian, Sriram (EG Servers Platform SW) <srira...@hpe.com>; > edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, > Jiaxin <jiaxin...@intel.com>; Gao, Liming <liming@intel.com> > Subject: RE: [edk2] [patch 3/3] MdePkg: Refine codes related to Dhcpv4 and > Dhcpv6 configuration. > > Hi Sriram > > I intend to add more arch for PXE boot ones according to your comments, > but I find in Pxe driver, the macro EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE is > already defined in PxeBaseCode.h under mdepkg\include\protocol, so I think > it is on need to redefine these arch, how do you think. > > > thanks > lubo > > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Subramanian, Sriram (EG Servers Platform SW) > Sent: Friday, June 17, 2016 11:57 AM > To: Zhang, Lubo <lubo.zh...@intel.com>; edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, > Jiaxin <jiaxin...@intel.com>; Gao, Liming <liming@intel.com> > Subject: Re: [edk2] [patch 3/3] MdePkg: Refine codes related to Dhcpv4 and > Dhcpv6 configuration. > > Hi Lubo, > > For these: > +/// Processor Architecture Types > +/// These identifiers are defined by IETF: > +/// > +http://www.ietf.org/assignments/dhcpv6-parameters/dhcpv6- > parameters.xml > +/// > +#define DHCP6_ARCH_IA320x000F/// x86 uefi boot from http > +#define DHCP6_ARCH_X64 0x0010/// x64 uefi boot from http > +#define DHCP6_ARCH_ARM 0x0012/// Arm uefi 32 boot from http > +#define DHCP6_ARCH_AARCH64 0x0013/// Arm uefi 64 boot from http > +#define DHCP6_ARCH_EBC 0x0011/// EBC boot from http > + > > These are not DHCP6 specific. These are client arch types used for both > DHCP4 and 6, and as such must not have the DHCP6_ prefix. > > Also, I think we must define the other arch types: especially for the PXE boot > ones (0x, 0x0002, 0x0006, 0x0007, 0x0009, etc.) > > Thanks, > Sriram. > > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Zhang Lubo > Sent: Friday, June 17, 2016 8:39 AM > To: edk2-devel@lists.01.org > Cc: Ye Ting <ting...@intel.com>; Fu Siyuan <siyuan...@intel.com>; Wu Jiaxin > <jiaxin...@intel.com>; Liming Gao <liming@intel.com> > Subject: [edk2] [patch 3/3] MdePkg: Refine codes related to Dhcpv4 and > Dhcpv6 configuration. > > Add a new head file Dhcp.h in Mde/Include/IndustryStandard, normalize the > universal option numbers and other network number tags. > > Cc: Liming Gao <liming@intel.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Wu Jiaxin <jiaxin...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Zhang Lubo <lubo.zh...@intel.com> > --- > MdePkg/Include/IndustryStandard/Dhcp.h | 273 > + > 1 file changed, 273 insertions(+) > create mode 100644 MdePkg/Include/IndustryStandard/Dhcp.h > > diff --git a/MdePkg/Include/IndustryStandard/Dhcp.h > b/MdePkg/Include/IndustryStandard/Dhcp.h > new file mode 100644 > index 000..a0d3c9f > --- /dev/null > +++ b/MdePkg/Include/IndustryStandard/Dhcp.h > @@ -0,0 +1,273 @@ > +/** @file > + This file conta
[edk2] [Patch 2/2] NetworkPkg: Add missed character in copyright.
Cc: Wu Jiaxin <jiaxin...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> --- NetworkPkg/Dhcp6Dxe/Dhcp6Io.c | 2 +- NetworkPkg/TcpDxe/TcpInput.c | 2 +- NetworkPkg/Udp6Dxe/Udp6Impl.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c index d25b973..5cdeac6 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c @@ -2,7 +2,7 @@ Dhcp6 internal functions implementation. (C) Copyright 2014 Hewlett-Packard Development Company, L.P. - Copyright (c) 2009 - 2016 Intel Corporation. All rights reserved. + Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License diff --git a/NetworkPkg/TcpDxe/TcpInput.c b/NetworkPkg/TcpDxe/TcpInput.c index 28bb021..3115c52 100644 --- a/NetworkPkg/TcpDxe/TcpInput.c +++ b/NetworkPkg/TcpDxe/TcpInput.c @@ -1,7 +1,7 @@ /** @file TCP input process routines. - Copyright (c) 2009 - 2016 Intel Corporation. All rights reserved. + Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License diff --git a/NetworkPkg/Udp6Dxe/Udp6Impl.c b/NetworkPkg/Udp6Dxe/Udp6Impl.c index 5896a7a..edf2c23 100644 --- a/NetworkPkg/Udp6Dxe/Udp6Impl.c +++ b/NetworkPkg/Udp6Dxe/Udp6Impl.c @@ -1,7 +1,7 @@ /** @file Udp6 driver's whole implementation. - Copyright (c) 2009 - 2016 Intel Corporation. All rights reserved. + Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 1/2] MdeModulePkg: Add missed character in copyright.
Cc: Wu Jiaxin <jiaxin...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> --- MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c index b258439..20dbeff 100644 --- a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c +++ b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c @@ -1,7 +1,7 @@ /** @file The implementation of the Udp4 protocol. -Copyright (c) 2006 - 2016 Intel Corporation. All rights reserved. +Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 0/2] Add missed character in copyright.
Fu Siyuan (2): MdeModulePkg: Add missed character in copyright. NetworkPkg: Add missed character in copyright. MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c | 2 +- NetworkPkg/Dhcp6Dxe/Dhcp6Io.c | 2 +- NetworkPkg/TcpDxe/TcpInput.c | 2 +- NetworkPkg/Udp6Dxe/Udp6Impl.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [patch] NetworkPkg: Fix assert issue in iSCSI driver
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: Zhang, Lubo > Sent: Monday, August 1, 2016 4:38 PM > To: edk2-devel@lists.01.org > Cc: Fu, Siyuan <siyuan...@intel.com>; Ye, Ting <ting...@intel.com>; Wu, > Jiaxin <jiaxin...@intel.com> > Subject: [patch] NetworkPkg: Fix assert issue in iSCSI driver > > The bug is caused by using already freed memory. > If there is already an attempt and execute > 'reconnect -r' command, all the AttemptConfig structure > will be freed, but the mCallbackInfo->Current is not > configured as null and this pointer will be used again in > IScsiFormExtractConfig. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Zhang Lubo <lubo.zh...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Wu Jiaxin <jiaxin...@intel.com> > --- > NetworkPkg/IScsiDxe/IScsiMisc.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c > b/NetworkPkg/IScsiDxe/IScsiMisc.c > index deebf5d..a39c268 100644 > --- a/NetworkPkg/IScsiDxe/IScsiMisc.c > +++ b/NetworkPkg/IScsiDxe/IScsiMisc.c > @@ -898,10 +898,12 @@ IScsiCleanDriverData ( > > EXIT: > >gBS->CloseEvent (Private->ExitBootServiceEvent); > > + mCallbackInfo->Current = NULL; > + >FreePool (Private); >return Status; > } > > /** > -- > 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 2/2] MdeModulePkg: Fix bug in TCP which not sending out ACK in certain circumstance.
Consider the situation as shown in below chart. The last ACK message has acknowledged the Tcb->RcvWl2, and all the segments until Tcb->RcvNxt have been received by TCP driver. The Tcb->RcvNxt is not acknowledged due to the delayed ACK. In this case an incoming segment (Seg->Seq, Seg->End) should not be accepted by TCP driver, and an immediate ACK is required. Current TcpSeqAcceptable() thought it’s an acceptable segment incorrectly, it continues the TcpInput() process instead of sending out an ACK and droping the segment immediately. Tcb->RcvWl2 Tcb->RcvNxtTcb->RcvWl2 + Tcb->RcvWnd Seg->Seq Seg->End | | | | | | | ---+-+---+-+--+--- <Acceptable Range--- --> Cc: Cohen Eugene <eug...@hp.com> Cc: Wu Jiaxin <jiaxin...@intel.com> Cc: Ye Ting <ting...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> --- MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c index 11936ad..b7f329b 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c @@ -32,7 +32,7 @@ TcpSeqAcceptable ( IN TCP_SEG *Seg ) { - return (TCP_SEQ_LEQ (Tcb->RcvWl2, Seg->End) && + return (TCP_SEQ_LEQ (Tcb->RcvNxt, Seg->End) && TCP_SEQ_LT (Seg->Seq, Tcb->RcvWl2 + Tcb->RcvWnd)); } -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 0/2] Fix bug in TCP which not sending out ACK
Consider the situation as shown in below chart. The last ACK message has acknowledged the Tcb->RcvWl2, and all the segments until Tcb->RcvNxt have been received by TCP driver. The Tcb->RcvNxt is not acknowledged due to the delayed ACK. In this case an incoming segment (Seg->Seq, Seg->End) should not be accepted by TCP driver, and an immediate ACK is required. Current TcpSeqAcceptable() thought it��s an acceptable segment incorrectly, it continues the TcpInput() process instead of sending out an ACK and droping the segment immediately. Tcb->RcvWl2 Tcb->RcvNxtTcb->RcvWl2 + Tcb->RcvWnd Seg->Seq Seg->End | | | | | | | ---+-+---+-+--+--- <----Acceptable Range--- --> Fu Siyuan (2): NetworkPkg: Fix bug in TCP which not sending out ACK in certain circumstance. MdeModulePkg: Fix bug in TCP which not sending out ACK in certain circumstance. MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c | 2 +- NetworkPkg/TcpDxe/TcpInput.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 1/2] NetworkPkg: Fix bug in TCP which not sending out ACK in certain circumstance.
Consider the situation as shown in below chart. The last ACK message has acknowledged the Tcb->RcvWl2, and all the segments until Tcb->RcvNxt have been received by TCP driver. The Tcb->RcvNxt is not acknowledged due to the delayed ACK. In this case an incoming segment (Seg->Seq, Seg->End) should not be accepted by TCP driver, and an immediate ACK is required. Current TcpSeqAcceptable() thought it’s an acceptable segment incorrectly, it continues the TcpInput() process instead of sending out an ACK and droping the segment immediately. Tcb->RcvWl2 Tcb->RcvNxtTcb->RcvWl2 + Tcb->RcvWnd Seg->Seq Seg->End | | | | | | | ---+-+---+-+--+--- <Acceptable Range--- --> Cc: Cohen Eugene <eug...@hp.com> Cc: Wu Jiaxin <jiaxin...@intel.com> Cc: Ye Ting <ting...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> --- NetworkPkg/TcpDxe/TcpInput.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NetworkPkg/TcpDxe/TcpInput.c b/NetworkPkg/TcpDxe/TcpInput.c index 745ee4c..28bb021 100644 --- a/NetworkPkg/TcpDxe/TcpInput.c +++ b/NetworkPkg/TcpDxe/TcpInput.c @@ -31,7 +31,7 @@ TcpSeqAcceptable ( IN TCP_SEG *Seg ) { - return (TCP_SEQ_LEQ (Tcb->RcvWl2, Seg->End) && + return (TCP_SEQ_LEQ (Tcb->RcvNxt, Seg->End) && TCP_SEQ_LT (Seg->Seq, Tcb->RcvWl2 + Tcb->RcvWnd)); } -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch 1/2] MdeModulePkg: Update PXE driver to follow edk2 coding standards.
Bruce, Thanks for reminder, has fixed it. Siyuan From: Bruce Cran [mailto:br...@cran.org.uk] Sent: Tuesday, July 12, 2016 9:43 AM To: Fu, Siyuan <siyuan...@intel.com>; edk2-devel@lists.01.org Cc: Zhang, Lubo <lubo.zh...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com> Subject: Re: [edk2] [Patch 1/2] MdeModulePkg: Update PXE driver to follow edk2 coding standards. On 6/29/2016 8:07 PM, Fu Siyuan wrote: > - @param TTLThe time to live field of the IP header. > + @param TtlThe time to live field of the IP header. This appears to have caused a build error: edk2/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c: In function 'PxeBcConfigureUdpWriteInstance': edk2/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c:82:32: error: 'TTL' undeclared (first use in this function) Udp4CfgData.TimeToLive = TTL; -- Bruce ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [patch] NetworkPkg: Fix Assert issue in iSCSI driver.
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: Zhang, Lubo > Sent: Friday, July 8, 2016 3:51 PM > To: edk2-devel@lists.01.org > Cc: Fu, Siyuan <siyuan...@intel.com>; Ye, Ting <ting...@intel.com>; Wu, > Jiaxin <jiaxin...@intel.com> > Subject: [patch] NetworkPkg: Fix Assert issue in iSCSI driver. > > The bug existed in replacing AsciiStrToUnicodeStr with AsciiStrToUnicodeStrS, > since MacString now is a pointer, the value sizeof(MacString)/sizeof > (MacString[0]) > is not correct here as the third parameter. > > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Wu Jiaxin <jiaxin...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Zhang Lubo <lubo.zh...@intel.com> > --- > NetworkPkg/IScsiDxe/IScsiConfig.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c > b/NetworkPkg/IScsiDxe/IScsiConfig.c > index 8015e3d..3631e72 100644 > --- a/NetworkPkg/IScsiDxe/IScsiConfig.c > +++ b/NetworkPkg/IScsiDxe/IScsiConfig.c > @@ -685,11 +685,11 @@ IScsiConvertIfrNvDataToAttemptConfigData ( >MacString = (CHAR16 *) AllocateZeroPool (ISCSI_MAX_MAC_STRING_LEN * > sizeof (CHAR16)); >if (MacString == NULL) { > return EFI_OUT_OF_RESOURCES; >} > > - AsciiStrToUnicodeStrS (Attempt->MacString, MacString, sizeof (MacString) / > sizeof (MacString[0])); > + AsciiStrToUnicodeStrS (Attempt->MacString, MacString, > ISCSI_MAX_MAC_STRING_LEN); > >UnicodeSPrint ( > mPrivate->PortString, > (UINTN) ISCSI_NAME_IFR_MAX_SIZE, > L"MAC: %s, PFA: Bus %d | Dev %d | Func %d, iSCSI mode: %s, IP > version: %s", > -- > 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] MdeModulePkg: Fix IPv4 stack potential disappeared issue
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Jiaxin Wu > Sent: Thursday, June 30, 2016 3:59 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com>; Fu, > Siyuan <siyuan...@intel.com> > Subject: [edk2] [Patch] MdeModulePkg: Fix IPv4 stack potential disappeared > issue > > IP4_CONFIG2_INSTANCE->DataItem is used to save the configuration > data to NV variable. When the policy is changed from static to > DHCP, DnsServers info will be cleaned from DataItem first > (See Ip4Config2SetPolicy), it's correct because DnsServers info > should not be saved to NV variable. > But if there is any DnsServers info received from DHCP message, it > will be reset to DataItem again (See Ip4Config2SetDnsServerWorker), > which may cause the NV variable contain the DnsServers info while > the policy is DHCP (See Ip4Config2WriteConfigData). > Then, while the platform is reset, the issue happened. Because > Ip4Config2DataTypeDnsServer is set under DHCP policy, which is not > allowed by UEFI Spec and error returned. > > This patch is used to resolve this potential issue. > > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Zhang Lubo <lubo.zh...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> > --- > MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 12 > +++- > MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h | 1 + > MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c | 4 > 3 files changed, 16 insertions(+), 1 deletion(-) > > diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c > b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c > index 028c61d..f91a935 100644 > --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c > +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c > @@ -1058,11 +1058,10 @@ Ip4Config2GetIfInfo ( >IN IP4_CONFIG2_INSTANCE *Instance, >IN OUT UINTN*DataSize, >IN VOID *Data OPTIONAL >) > { > - >IP4_SERVICE*IpSb; >UINTN Length; >IP4_CONFIG2_DATA_ITEM *Item; >EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo; >IP4_ADDR Address; > @@ -1177,10 +1176,11 @@ Ip4Config2SetPolicy ( > FreePool (DataItem->Data.Ptr); >} >DataItem->Data.Ptr = NULL; >DataItem->DataSize = 0; >DataItem->Status = EFI_NOT_FOUND; > + SET_DATA_ATTRIB (DataItem->Attribute, DATA_ATTRIB_VOLATILE); >NetMapIterate (>EventMap, Ip4Config2SignalEvent, NULL); > } else { >// >// The policy is changed from dhcp to static. Stop the DHCPv4 process >// and destroy the DHCPv4 child. > @@ -1457,14 +1457,24 @@ Ip4Config2SetDnsServer ( >IN IP4_CONFIG2_INSTANCE *Instance, >IN UINTNDataSize, >IN VOID *Data >) > { > + IP4_CONFIG2_DATA_ITEM *Item; > + > + Item = NULL; > + >if (Instance->Policy != Ip4Config2PolicyStatic) { > return EFI_WRITE_PROTECTED; >} > > + Item = >DataItem[Ip4Config2DataTypeDnsServer]; > + > + if (DATA_ATTRIB_SET (Item->Attribute, DATA_ATTRIB_VOLATILE)) { > +REMOVE_DATA_ATTRIB (Item->Attribute, DATA_ATTRIB_VOLATILE); > + } > + >return Ip4Config2SetDnsServerWorker (Instance, DataSize, Data); > } > > /** >Generate the operational state of the interface this IP4 config2 instance > manages > diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h > b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h > index b2665bd..b6da11f 100644 > --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h > +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h > @@ -25,10 +25,11 @@ > #define DATA_ATTRIB_SIZE_FIXED 0x1 > #define DATA_ATTRIB_VOLATILE0x2 > > #define DATA_ATTRIB_SET(Attrib, Bits) (BOOLEAN)((Attrib) & (Bits)) > #define SET_DATA_ATTRIB(Attrib, Bits) ((Attrib) |= (Bits)) > +#define REMOVE_DATA_ATTRIB(Attrib, Bits)((Attrib) &= (~Bits)) > > typedef struct _IP4_CONFIG2_INSTANCE IP4_CONFIG2_INSTANCE; > > #define IP4_CONFIG2_INSTANCE_FROM_PROTOCOL(Proto) \ >CR ((Proto), \ > diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c > b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c > index fcd3ccb..20bc21f 100644 > --- a/MdeModulePkg/Un
[edk2] [Patch 1/2] MdeModulePkg: Update PXE driver to follow edk2 coding standards.
Cc: Wu Jiaxin <jiaxin...@intel.com> Cc: Zhang Lubo <lubo.zh...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> --- MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c | 4 ++-- MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c index 79c9a67..a20fdb7 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c @@ -42,7 +42,7 @@ PxeBcCommonNotify ( @param SubnetMask Pointer to the subnetmask of the station ip address. @param GatewayPointer to the gateway ip address. @param SrcPortPointer to the srouce port of the station. - @param TTLThe time to live field of the IP header. + @param TtlThe time to live field of the IP header. @param ToSThe type of service field of the IP header. @retval EFI_SUCCESS The configuration settings were set, changed, or reset successfully. @@ -68,7 +68,7 @@ PxeBcConfigureUdpWriteInstance ( IN EFI_IPv4_ADDRESS *SubnetMask, IN EFI_IPv4_ADDRESS *Gateway, IN OUT UINT16 *SrcPort, - IN UINT8 TTL, + IN UINT8 Ttl, IN UINT8 ToS ) { diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.h b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.h index 1082b3a..16ac05e 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.h +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.h @@ -38,7 +38,7 @@ PxeBcCommonNotify ( @param SubnetMask Pointer to the subnetmask of the station ip address. @param GatewayPointer to the gateway ip address. @param SrcPortPointer to the srouce port of the station. - @param TTLThe time to live field of the IP header. + @param TtlThe time to live field of the IP header. @param ToSThe type of service field of the IP header. @retval EFI_SUCCESS The configuration settings were set, changed, or reset successfully. @@ -64,7 +64,7 @@ PxeBcConfigureUdpWriteInstance ( IN EFI_IPv4_ADDRESS *SubnetMask, IN EFI_IPv4_ADDRESS *Gateway, IN OUT UINT16 *SrcPort, - IN UINT8 TTL, + IN UINT8 Ttl, IN UINT8 ToS ); /** -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 0/2] Update-PXE-driver-to-follow-edk2-coding-standards
Fu Siyuan (2): MdeModulePkg: Update PXE driver to follow edk2 coding standards. NetworkPkg: Update PXE driver to follow edk2 coding standards. MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c | 4 ++-- MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.h | 4 ++-- NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 6 +++--- NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 2/2] NetworkPkg: Update PXE driver to follow edk2 coding standards.
Cc: Wu Jiaxin <jiaxin...@intel.com> Cc: Zhang Lubo <lubo.zh...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> --- NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 6 +++--- NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c index eb0f395..3ea9518 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c @@ -489,7 +489,7 @@ PxeBcIcmp6ErrorUpdate ( @param[in, out] SrcPort The pointer to the source port. @param[in] DoNotFragmentIf TRUE, fragment is not enabled. Otherwise, fragment is enabled. - @param[in] TTL The time to live field of the IP header. + @param[in] Ttl The time to live field of the IP header. @param[in] ToS The type of service field of the IP header. @retval EFI_SUCCESS Successfully configured this instance. @@ -504,7 +504,7 @@ PxeBcConfigUdp4Write ( IN EFI_IPv4_ADDRESS *Gateway, IN OUT UINT16 *SrcPort, IN BOOLEANDoNotFragment, - IN UINT8 TTL, + IN UINT8 Ttl, IN UINT8 ToS ) { @@ -516,7 +516,7 @@ PxeBcConfigUdp4Write ( Udp4CfgData.TransmitTimeout= PXEBC_DEFAULT_LIFETIME; Udp4CfgData.ReceiveTimeout = PXEBC_DEFAULT_LIFETIME; Udp4CfgData.TypeOfService = ToS; - Udp4CfgData.TimeToLive = TTL; + Udp4CfgData.TimeToLive = Ttl; Udp4CfgData.AllowDuplicatePort = TRUE; Udp4CfgData.DoNotFragment = DoNotFragment; diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h index 5d611b5..b8519ae 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h @@ -135,7 +135,7 @@ PxeBcIcmp6ErrorUpdate ( @param[in, out] SrcPort The pointer to the source port. @param[in] DoNotFragmentIf TRUE, fragment is not enabled. Otherwise, fragment is enabled. - @param[in] TTL The time to live field of the IP header. + @param[in] Ttl The time to live field of the IP header. @param[in] ToS The type of service field of the IP header. @retval EFI_SUCCESS Successfully configured this instance. @@ -150,7 +150,7 @@ PxeBcConfigUdp4Write ( IN EFI_IPv4_ADDRESS *Gateway, IN OUT UINT16 *SrcPort, IN BOOLEANDoNotFragment, - IN UINT8 TTL, + IN UINT8 Ttl, IN UINT8 ToS ); -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2] NetworkPkg: Replace ASSERT with error handling in DnsDxe
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: Wu, Jiaxin > Sent: Monday, June 20, 2016 9:46 AM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Zhang, > Lubo <lubo.zh...@intel.com> > Subject: [PATCH v2] NetworkPkg: Replace ASSERT with error handling in > DnsDxe > > v2: > *Use goto to simplify code logic. > > This patch is used to replace ASSERT with error handling in > DnsDxe driver. > > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Zhang Lubo <lubo.zh...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> > --- > NetworkPkg/DnsDxe/DnsProtocol.c | 56 --- > -- > 1 file changed, 38 insertions(+), 18 deletions(-) > > diff --git a/NetworkPkg/DnsDxe/DnsProtocol.c > b/NetworkPkg/DnsDxe/DnsProtocol.c > index e9101d6..64fca6a 100644 > --- a/NetworkPkg/DnsDxe/DnsProtocol.c > +++ b/NetworkPkg/DnsDxe/DnsProtocol.c > @@ -86,23 +86,22 @@ Dns4GetModeData ( > >OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > >Instance = DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This); >if (Instance->State == DNS_STATE_UNCONFIGED) { > -gBS->RestoreTPL (OldTpl); > -return EFI_NOT_STARTED; > +Status = EFI_NOT_STARTED; > +goto ON_EXIT; >} > >ZeroMem (DnsModeData, sizeof (EFI_DNS4_MODE_DATA)); > >// >// Get the current configuration data of this instance. >// >Status = Dns4CopyConfigure (>DnsConfigData, > >Dns4CfgData); >if (EFI_ERROR (Status)) { > -gBS->RestoreTPL (OldTpl); > -return Status; > +goto ON_EXIT; >} > >// >// Get the DnsServerCount and DnsServerList >// > @@ -110,11 +109,16 @@ Dns4GetModeData ( >NET_LIST_FOR_EACH_SAFE (Entry, Next, >Dns4ServerList) { > Index++; >} >DnsModeData->DnsServerCount = (UINT32) Index; >ServerList = AllocatePool (sizeof (EFI_IPv4_ADDRESS) * DnsModeData- > >DnsServerCount); > - ASSERT (ServerList != NULL); > + if (ServerList == NULL) { > +Status = EFI_OUT_OF_RESOURCES; > +Dns4CleanConfigure (>DnsConfigData); > +goto ON_EXIT; > + } > + >Index = 0; >NET_LIST_FOR_EACH_SAFE (Entry, Next, >Dns4ServerList) { > ServerItem = NET_LIST_USER_STRUCT (Entry, DNS4_SERVER_IP, > AllServerLink); > CopyMem (ServerList + Index, >Dns4ServerIp, sizeof > (EFI_IPv4_ADDRESS)); > Index++; > @@ -128,22 +132,28 @@ Dns4GetModeData ( >NET_LIST_FOR_EACH_SAFE (Entry, Next, >Dns4CacheList) { > Index++; >} >DnsModeData->DnsCacheCount = (UINT32) Index; >CacheList = AllocatePool (sizeof (EFI_DNS4_CACHE_ENTRY) * > DnsModeData->DnsCacheCount); > - ASSERT (CacheList != NULL); > + if (CacheList == NULL) { > +Status = EFI_OUT_OF_RESOURCES; > +Dns4CleanConfigure (>DnsConfigData); > +FreePool (ServerList); > +goto ON_EXIT; > + } > + >Index =0; >NET_LIST_FOR_EACH_SAFE (Entry, Next, >Dns4CacheList) { > CacheItem = NET_LIST_USER_STRUCT (Entry, DNS4_CACHE, AllCacheLink); > CopyMem (CacheList + Index, >DnsCache, sizeof > (EFI_DNS4_CACHE_ENTRY)); > Index++; >} >DnsModeData->DnsCacheList = CacheList; > > +ON_EXIT: >gBS->RestoreTPL (OldTpl); > - > - return EFI_SUCCESS; > + return Status; > } > > /** >Configure this DNS instance. > > @@ -907,23 +917,22 @@ Dns6GetModeData ( > >OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > >Instance = DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This); >if (Instance->State == DNS_STATE_UNCONFIGED) { > -gBS->RestoreTPL (OldTpl); > -return EFI_NOT_STARTED; > +Status = EFI_NOT_STARTED; > +goto ON_EXIT; >} > >ZeroMem (DnsModeData, sizeof (EFI_DNS6_MODE_DATA)); > >// >// Get the current configuration data of this instance. >// > - Status = Dns6CopyConfigure(>DnsConfigData, > >Dns6CfgData); > + Status = Dns6CopyConfigure (>DnsConfigData, > >Dns6CfgData); >if (EFI_ERROR (Status)) { > -gBS->RestoreTPL (OldTpl); > -return Status; > +goto ON_EXIT; >} > >// >// Get the DnsServerCount and DnsServerList >// > @@ -931,11 +940,16 @@ Dns6GetModeData ( >NET_LIST_FOR_EACH_SAFE (Entry, Next, >Dns6ServerList) { > Index++; >} >DnsModeData->DnsServerCount = (UINT32) Index; >ServerList = AllocatePool (sizeof(EFI_IPv6_ADDRESS)
Re: [edk2] [PATCH] Fix some typos of "according"
Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: Rebecca Cran [mailto:rebe...@bluestop.org] Sent: 2017年2月8日 3:41 To: edk2-devel@lists.01.org Cc: Rebecca Cran <rebe...@bluestop.org>; Tian, Feng <feng.t...@intel.com>; Zeng, Star <star.z...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com>; Gao, Liming <liming@intel.com> Subject: [PATCH] Fix some typos of "according" Cc: Feng Tian <feng.t...@intel.com> Cc: Star Zeng <star.z...@intel.com> Cc: Siyuan Fu <siyuan...@intel.com> Cc: Jiaxin Wu <jiaxin...@intel.com> Cc: Liming Gao <liming@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Rebecca Cran <rebe...@bluestop.org> --- EdkCompatibilityPkg/Sample/Tools/Source/UefiStrGather/StrGather.c | 2 +- MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c | 4 ++-- MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 2 +- MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdMemory.c | 2 +- MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c | 6 +++--- MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasmSupport.c | 2 +- MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasmSupport.h | 2 +- MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 2 +- NetworkPkg/HttpBootDxe/HttpBootConfigStrings.uni | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/EdkCompatibilityPkg/Sample/Tools/Source/UefiStrGather/StrGather.c b/EdkCompatibilityPkg/Sample/Tools/Source/UefiStrGather/StrGather.c index 535a265046..e71b5e4e7d 100644 --- a/EdkCompatibilityPkg/Sample/Tools/Source/UefiStrGather/StrGather.c +++ b/EdkCompatibilityPkg/Sample/Tools/Source/UefiStrGather/StrGather.c @@ -854,7 +854,7 @@ GetLangCode ( } // - // Convert the language accoring to the table. + // Convert the language according to the table. // for (Index = 0; LanguageConvertTable[Index].ISO639 != NULL; Index++) { if (wcscmp(LanguageConvertTable[Index].ISO639, Lang) == 0) { diff --git a/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c b/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c index eba938e2a9..6cfd35945a 100644 --- a/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c +++ b/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c @@ -785,7 +785,7 @@ SmmCoreGetMemoryMapMemoryAttributesTable ( // /** - Set MemoryProtectionAttribute accroding to PE/COFF image section alignment. + Set MemoryProtectionAttribute according to PE/COFF image section alignment. @param[in] SectionAlignmentPE/COFF section alignment **/ @@ -1225,7 +1225,7 @@ Finish: } /** - Find image record accroding to image base and size. + Find image record according to image base and size. @param[in] ImageBaseBase of PE image @param[in] ImageSizeSize of PE image diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c index a4579bf043..8734291ae3 100644 --- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c +++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c @@ -396,7 +396,7 @@ HttpParseUrl ( FoundAt = FALSE; for (Char = Url; Char < Url + Length; Char++) { // -// Update state machine accoring to next char. +// Update state machine according to next char. // State = NetHttpParseUrlChar (*Char, State); diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdMemory.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdMemory.c index 74c17bd248..3dc6376215 100644 --- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdMemory.c +++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdMemory.c @@ -37,7 +37,7 @@ EdbDisplayMemoryUnit ( UINT64 Data64; // - // Print accroding to width + // Print according to width // switch (Width) { case EdbWidthUint8: diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c index ba62c6ac27..3ca793059f 100644 --- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c +++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c @@ -70,7 +70,7 @@ GetDirNameFromFullPath ( /** - Construct full path accroding to dir and file path. + Construct full path according to dir and file path. @param DirPath - dir path @param FilePath- file path @@ -127,7 +127,7 @@ EdbSymbolTypeToStr ( /** - Find the symbol accroding to address and display symbol. + Find the symbol according to address and display symbol. @param Address - SymbolAddress @param DebuggerPrivate - EBC Debugger private data structure @@ -190,7 +190,7 @@ DebuggerDisplaySymbolAccrodingToAddress ( /** - Find the symbol accroding to name and display symbol. + Find the symbol according to name and display symbol. @param SymbolFileNa
Re: [edk2] [Patch] MdeModulePkg/DxeHttpLib: Correct the return status for the HTTP Port/ContentLength
Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: Wu, Jiaxin Sent: 2017年2月8日 12:58 To: edk2-devel@lists.01.org Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com> Subject: [Patch] MdeModulePkg/DxeHttpLib: Correct the return status for the HTTP Port/ContentLength Replace AsciiStrDecimalToUintn with AsciiStrDecimalToUintnS to return the correct status for the HTTP Port/ContentLength. Cc: Ye Ting <ting...@intel.com> Cc: Fu Siyuan <siyuan...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin...@intel.com> --- MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c index a4579bf..ff7e799 100644 --- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c +++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c @@ -1,10 +1,10 @@ /** @file This library is used to share code between UEFI network stack modules. It provides the helper routines to parse the HTTP message byte stream. -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved. +Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved. (C) Copyright 2016 Hewlett Packard Enterprise Development LP This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -719,13 +719,12 @@ HttpUrlGetPort ( if (EFI_ERROR (Status)) { return Status; } PortString[ResultLength] = '\0'; - *Port = (UINT16) AsciiStrDecimalToUintn (Url + Parser->FieldData[HTTP_URI_FIELD_PORT].Offset); - return EFI_SUCCESS; + return AsciiStrDecimalToUintnS (Url + + Parser->FieldData[HTTP_URI_FIELD_PORT].Offset, (CHAR8 **) NULL, (UINTN + *) Port); } /** Get the Path from a HTTP URL. @@ -930,12 +929,11 @@ HttpIoParseContentLengthHeader ( Header = HttpFindHeader (HeaderCount, Headers, HTTP_HEADER_CONTENT_LENGTH); if (Header == NULL) { return EFI_NOT_FOUND; } - *ContentLength = AsciiStrDecimalToUintn (Header->FieldValue); - return EFI_SUCCESS; + return AsciiStrDecimalToUintnS (Header->FieldValue, (CHAR8 **) NULL, + ContentLength); } /** Check whether the HTTP message is using the "chunked" transfer-coding. -- 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] NetworkPkg/NetworkPkg.uni: Define the prompt and help information for PcdAllowHttpConnections
Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: Wu, Jiaxin Sent: 2017年2月8日 12:59 To: edk2-devel@lists.01.org Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com> Subject: [Patch] NetworkPkg/NetworkPkg.uni: Define the prompt and help information for PcdAllowHttpConnections Cc: Ye Ting <ting...@intel.com> Cc: Fu Siyuan <siyuan...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin...@intel.com> --- NetworkPkg/NetworkPkg.uni | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/NetworkPkg/NetworkPkg.uni b/NetworkPkg/NetworkPkg.uni index 6eecd88..d0e9b36 100644 --- a/NetworkPkg/NetworkPkg.uni +++ b/NetworkPkg/NetworkPkg.uni @@ -1,11 +1,11 @@ // /** @file // This package provides network modules that conform to UEFI 2.4 specification. // // This package provides network modules that conform to UEFI 2.4 specification. // -// Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved. +// Copyright (c) 2009 - 2017, Intel Corporation. All rights +reserved. // // This program and the accompanying materials are licensed and made available under // the terms and conditions of the BSD License which accompanies this distribution. // The full text of the license may be found at // http://opensource.org/licenses/bsd-license.php @@ -44,10 +44,16 @@ #string STR_gEfiNetworkPkgTokenSpaceGuid_PcdIpsecUefiCertificateKeySize_PROMPT #language en-US "Private Key's size." #string STR_gEfiNetworkPkgTokenSpaceGuid_PcdIpsecUefiCertificateKeySize_HELP #language en-US "Private Key's size." +#string STR_gEfiNetworkPkgTokenSpaceGuid_PcdAllowHttpConnections_PROMPT #language en-US "Indicates whether HTTP connections are permitted or not." + +#string STR_gEfiNetworkPkgTokenSpaceGuid_PcdAllowHttpConnections_HELP #language en-US "Indicates whether HTTP connections are permitted or not.\n" + "TRUE - HTTP connections are allowed.\n" + "FALSE - HTTP connections are denied." + #string STR_gEfiNetworkPkgTokenSpaceGuid_PcdIpsecCertificateEnabled_PROMPT #language en-US "Enable IPsec IKEv2 Certificate Authentication." #string STR_gEfiNetworkPkgTokenSpaceGuid_PcdIpsecCertificateEnabled_HELP #language en-US "Indicates if the IPsec IKEv2 Certificate Authentication feature is enabled or not.\n" "TRUE - Certificate Authentication feature is enabled.\n" "FALSE - Does not support Certificate Authentication." -- 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v3 0/3] Enable the HTTP connections switch
Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiaxin Wu Sent: 2017年1月19日 13:18 To: edk2-devel@lists.01.org Cc: Ye, Ting <ting...@intel.com>; Justen, Jordan L <jordan.l.jus...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com>; Gary Lin <g...@suse.com>; Kinney, Michael D <michael.d.kin...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Laszlo Ersek <ler...@redhat.com> Subject: [edk2] [PATCH v3 0/3] Enable the HTTP connections switch v3: * Append patch for OVMF. Cc: Laszlo Ersek <ler...@redhat.com> Cc: Justen Jordan L <jordan.l.jus...@intel.com> Cc: Gary Lin <g...@suse.com> Cc: Ye Ting <ting...@intel.com> Cc: Fu Siyuan <siyuan...@intel.com> Cc: Kinney Michael D <michael.d.kin...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin...@intel.com> Jiaxin Wu (3): NetworkPkg: Add PCD to enable the HTTP connections switch Nt32Pkg.dsc: Add flag to control HTTP connections OvmfPkg: Allow HTTP connections if HTTP Boot enabled NetworkPkg/HttpBootDxe/HttpBootClient.c | 20 +++- NetworkPkg/HttpBootDxe/HttpBootConfig.c | 81 NetworkPkg/HttpBootDxe/HttpBootDxe.inf | 5 +- NetworkPkg/HttpBootDxe/HttpBootSupport.c | 53 - NetworkPkg/HttpBootDxe/HttpBootSupport.h | 17 ++- NetworkPkg/HttpDxe/HttpDxe.inf | 5 +- NetworkPkg/HttpDxe/HttpImpl.c| 12 - NetworkPkg/NetworkPkg.dec| 8 +++- Nt32Pkg/Nt32Pkg.dsc | 18 ++- OvmfPkg/OvmfPkgIa32.dsc | 6 ++- OvmfPkg/OvmfPkgIa32X64.dsc | 6 ++- OvmfPkg/OvmfPkgX64.dsc | 6 ++- 12 files changed, 195 insertions(+), 42 deletions(-) -- 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [patch] NetworkPkg: Fix protocol handler service in HttpDxe.
Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: Zhang, Lubo Sent: 2017年1月22日 9:41 To: edk2-devel@lists.01.org Cc: Sriram Subramanian <srira...@hpe.com>; Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com> Subject: [patch] NetworkPkg: Fix protocol handler service in HttpDxe. When we create a HTTP driver service binding private instance, there may be different DriverBindingHandle for Ipv4 or Ipv6, so it is essential to distinguish the HttpService image which will be used in open protocol or close protocol. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zh...@intel.com> Cc: Sriram Subramanian <srira...@hpe.com> Cc: Ye Ting <ting...@intel.com> Cc: Fu Siyuan <siyuan...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> --- NetworkPkg/HttpDxe/HttpDns.c| 18 NetworkPkg/HttpDxe/HttpDriver.c | 21 +- NetworkPkg/HttpDxe/HttpImpl.c | 11 -- NetworkPkg/HttpDxe/HttpProto.c | 48 - NetworkPkg/HttpDxe/HttpProto.h | 5 +++-- 5 files changed, 55 insertions(+), 48 deletions(-) diff --git a/NetworkPkg/HttpDxe/HttpDns.c b/NetworkPkg/HttpDxe/HttpDns.c index 0f5fe18..59cd7b3 100644 --- a/NetworkPkg/HttpDxe/HttpDns.c +++ b/NetworkPkg/HttpDxe/HttpDns.c @@ -1,9 +1,9 @@ /** @file Routines for HttpDxe driver to perform DNS resolution based on UEFI DNS protocols. -Copyright (c) 2015, Intel Corporation. All rights reserved. +Copyright (c) 2017, Intel Corporation. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -86,11 +86,11 @@ HttpDns4 ( // // Create a DNS child instance and get the protocol. // Status = NetLibCreateServiceChild ( Service->ControllerHandle, - Service->ImageHandle, + Service->Ip4DriverBindingHandle, , ); if (EFI_ERROR (Status)) { goto Exit; @@ -98,11 +98,11 @@ HttpDns4 ( Status = gBS->OpenProtocol ( Dns4Handle, , (VOID **) , - Service->ImageHandle, + Service->Ip4DriverBindingHandle, Service->ControllerHandle, EFI_OPEN_PROTOCOL_BY_DRIVER ); if (EFI_ERROR (Status)) { goto Exit; @@ -194,19 +194,19 @@ Exit: Dns4->Configure (Dns4, NULL); gBS->CloseProtocol ( Dns4Handle, , - Service->ImageHandle, + Service->Ip4DriverBindingHandle, Service->ControllerHandle ); } if (Dns4Handle != NULL) { NetLibDestroyServiceChild ( Service->ControllerHandle, - Service->ImageHandle, + Service->Ip4DriverBindingHandle, , Dns4Handle ); } @@ -288,11 +288,11 @@ HttpDns6 ( // // Create a DNSv6 child instance and get the protocol. // Status = NetLibCreateServiceChild ( Service->ControllerHandle, - Service->ImageHandle, + Service->Ip6DriverBindingHandle, , ); if (EFI_ERROR (Status)) { goto Exit; @@ -300,11 +300,11 @@ HttpDns6 ( Status = gBS->OpenProtocol ( Dns6Handle, , (VOID **) , - Service->ImageHandle, + Service->Ip6DriverBindingHandle, Service->ControllerHandle, EFI_OPEN_PROTOCOL_BY_DRIVER ); if (EFI_ERROR (Status)) { goto Exit; @@ -391,19 +391,19 @@ Exit: Dns6->Configure (Dns6, NULL); gBS->CloseProtocol ( Dns6Handle, , - Service->ImageHandle, + Service->Ip6DriverBindingHandle, Service->ControllerHandle ); } if (Dns6Handle != NULL) { NetLibDestroyServiceChild ( Service->ControllerHandle, - Service->ImageHandle, + Service->Ip6DriverBindingHandle, , Dns6Handle ); } diff --git a/NetworkPkg/HttpDxe/HttpDriver.c b/NetworkPkg/HttpDxe/HttpDriver.c index de27635..5727526 100644 --- a/NetworkPkg/HttpDxe/HttpDriver.c +++ b/NetworkPkg/HttpDxe/HttpDriver.c @@ -1,9 +1,9 @@ /** @file The driver binding and service binding protocol for HttpDxe driver. - Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved. + Copyright (c) 2015 - 2017, Intel Corporation. All rights + reserved. (C) Copyright 2016 Hewlett Packard Enterprise Development LP
[edk2] [Patch] Nt32Pkg: Add build flag to enable or disable IPv6 network stack.
Cc: Ruiyu Ni <ruiyu...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> --- Nt32Pkg/Nt32Pkg.dsc | 22 -- Nt32Pkg/Nt32Pkg.fdf | 12 +++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/Nt32Pkg/Nt32Pkg.dsc b/Nt32Pkg/Nt32Pkg.dsc index 47e37ec..31a60e2 100644 --- a/Nt32Pkg/Nt32Pkg.dsc +++ b/Nt32Pkg/Nt32Pkg.dsc @@ -71,6 +71,13 @@ # DEFINE ALLOW_HTTP_CONNECTIONS = TRUE + # + # This flag is to enable or disable IPv6 network stack. + # These can be changed on the command line. + # -D FLAG=VALUE + # + DEFINE NETWORK_IP6_ENABLE = TRUE + # # SKU Identification section - list of all SKU IDs supported by this @@ -135,6 +142,7 @@ NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf + TcpIoLib|MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf @@ -458,12 +466,22 @@ MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf - MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf - MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf Nt32Pkg/SnpNt32Dxe/SnpNt32Dxe.inf +!if $(NETWORK_IP6_ENABLE) == TRUE + NetworkPkg/Ip6Dxe/Ip6Dxe.inf + NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf + NetworkPkg/TcpDxe/TcpDxe.inf + NetworkPkg/Udp6Dxe/Udp6Dxe.inf + NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf + NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf + NetworkPkg/IScsiDxe/IScsiDxe.inf +!else + MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf + MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf +!endif NetworkPkg/HttpBootDxe/HttpBootDxe.inf NetworkPkg/DnsDxe/DnsDxe.inf diff --git a/Nt32Pkg/Nt32Pkg.fdf b/Nt32Pkg/Nt32Pkg.fdf index bbb4ccc..282e59c 100644 --- a/Nt32Pkg/Nt32Pkg.fdf +++ b/Nt32Pkg/Nt32Pkg.fdf @@ -256,11 +256,21 @@ INF MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf INF MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf INF MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf INF MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf -INF MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf INF Nt32Pkg/SnpNt32Dxe/SnpNt32Dxe.inf +!if $(NETWORK_IP6_ENABLE) == TRUE +INF NetworkPkg/Ip6Dxe/Ip6Dxe.inf +INF NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf +INF NetworkPkg/Udp6Dxe/Udp6Dxe.inf +INF NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf +INF NetworkPkg/TcpDxe/TcpDxe.inf +INF NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf +INF NetworkPkg/IScsiDxe/IScsiDxe.inf +!else +INF MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf INF MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf INF MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf +!endif INF NetworkPkg/HttpBootDxe/HttpBootDxe.inf INF NetworkPkg/DnsDxe/DnsDxe.inf INF NetworkPkg/HttpDxe/HttpDxe.inf -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] NetworkPkg/IpSecDxe: Add check to avoid possible divide by zero
Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: Wu, Hao A Sent: 2017年2月20日 11:03 To: edk2-devel@lists.01.org Cc: Wu, Hao A <hao.a...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com>; Fu, Siyuan <siyuan...@intel.com> Subject: [PATCH] NetworkPkg/IpSecDxe: Add check to avoid possible divide by zero Cc: Wu Jiaxin <jiaxin...@intel.com> Cc: Siyuan Fu <siyuan...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a...@intel.com> --- NetworkPkg/IpSecDxe/Ikev2/Utility.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/NetworkPkg/IpSecDxe/Ikev2/Utility.c b/NetworkPkg/IpSecDxe/Ikev2/Utility.c index c365532..2ca7f3c 100644 --- a/NetworkPkg/IpSecDxe/Ikev2/Utility.c +++ b/NetworkPkg/IpSecDxe/Ikev2/Utility.c @@ -2,7 +2,7 @@ The Common operations used by IKE Exchange Process. (C) Copyright 2015 Hewlett-Packard Development Company, L.P. - Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved. + Copyright (c) 2010 - 2017, Intel Corporation. All rights + reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -2627,6 +2627,8 @@ Ikev2ChildSaParseSaPayload ( @retval EFI_SUCCESSThe operation complete successfully. @retval EFI_INVALID_PARAMETER If NumFragments is zero. + If the authentication algorithm given by HashAlgId + cannot be found. @retval EFI_OUT_OF_RESOURCES If the required resource can't be allocated. @retval Others The operation is failed. @@ -2663,6 +2665,10 @@ Ikev2SaGenerateKey ( LocalFragments[2].Data = NULL; AuthKeyLength = IpSecGetHmacDigestLength (HashAlgId); + if (AuthKeyLength == 0) { +return EFI_INVALID_PARAMETER; + } + DigestSize= AuthKeyLength; Digest= AllocateZeroPool (AuthKeyLength); -- 1.9.5.msysgit.0 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [patch] NetworkPkg: Update the Ethernet interface name.
Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: Zhang, Lubo Sent: 2017年2月23日 10:39 To: edk2-devel@lists.01.org Cc: Sriram Subramanian <srira...@hpe.com>; Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com> Subject: [patch] NetworkPkg: Update the Ethernet interface name. Update the interface name from ethA ethB to eth10, eth11 etc if port number more than 9. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zh...@intel.com> Cc: Sriram Subramanian <srira...@hpe.com> Cc: Ye Ting <ting...@intel.com> Cc: Fu Siyuan <siyuan...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> --- NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c index e309b69..9287475 100644 --- a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c +++ b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c @@ -1439,11 +1439,11 @@ Ip6ConfigInitIfInfo ( ) { UnicodeSPrint ( IfInfo->Name, sizeof (IfInfo->Name), -L"eth%x", +L"eth%d", IpSb->Ip6ConfigInstance.IfIndex ); IfInfo->IfType= IpSb->SnpMode.IfType; IfInfo->HwAddressSize = IpSb->SnpMode.HwAddressSize; -- 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2 0/2] NetworkPkg/iScsiDxe: Update iScsiStart Policy
Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: hegdenag [mailto:nagaraj-p.he...@hpe.com] Sent: 2017年2月13日 15:20 To: edk2-devel@lists.01.org Cc: Wu, Jiaxin <jiaxin...@intel.com>; Ye, Ting <ting...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; srira...@hpe.com Subject: [PATCH v2 0/2] NetworkPkg/iScsiDxe: Update iScsiStart Policy v2: Updated list of reviewers. Today, iSCSI driver checks whether there are AIP instances installed by iSCSI HBA adapter and if yes, the iSCSI driver will return EFI_ABORTED in its driver binding Start. We can not guarantee the existence of AIP instances always during iSCSI DBStart. Hence, we might end up doing a iScsiStart even if the intent of the customer was to use only iSCSI on HBA. The series of patch will define a new PCD value for the PCD PcdIScsiAIPNetworkBootPolicy, "Always use iSCSI HBA and ignore UEFI iSCSI", update iScsiStart to check this PCD value and return EFI_ABORT in this case even before checking for AIP instances. hegdenag (2): NetworkPkg/iSCSIDxe: Update the condition for IScsiStart Abort NetworkPkg/NetworkPkg.dec: Update comments for the PCD NetworkPkg/IScsiDxe/IScsiDriver.c | 8 +++- NetworkPkg/IScsiDxe/IScsiDriver.h | 19 +++ NetworkPkg/NetworkPkg.dec | 5 +++-- 3 files changed, 21 insertions(+), 11 deletions(-) -- 2.8.3.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] NetworkPkg/HttpBootDxe: Request HTTP token notify as a DPC at TPL_CALLBACK
Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiaxin Wu Sent: 2017年2月14日 16:42 To: edk2-devel@lists.01.org Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com> Subject: [edk2] [Patch] NetworkPkg/HttpBootDxe: Request HTTP token notify as a DPC at TPL_CALLBACK This patch is to update the HTTP token notify as a DPC at TPL_CALLBACK to align with UEFI Spec. Cc: Hegde Nagaraj P <nagaraj-p.he...@hpe.com> Cc: Ye Ting <ting...@intel.com> Cc: Fu Siyuan <siyuan...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin...@intel.com> --- NetworkPkg/HttpBootDxe/HttpBootDxe.h | 3 ++- NetworkPkg/HttpBootDxe/HttpBootDxe.inf | 1 + NetworkPkg/HttpBootDxe/HttpBootSupport.c | 37 ++-- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/NetworkPkg/HttpBootDxe/HttpBootDxe.h b/NetworkPkg/HttpBootDxe/HttpBootDxe.h index 7e8cd9d..2814594 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootDxe.h +++ b/NetworkPkg/HttpBootDxe/HttpBootDxe.h @@ -1,9 +1,9 @@ /** @file UEFI HTTP boot driver's private data structure and interfaces declaration. -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved. +Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved. (C) Copyright 2016 Hewlett Packard Enterprise Development LP This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License that accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php. @@ -34,10 +34,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include #include #include +#include // // UEFI Driver Model Protocols // #include diff --git a/NetworkPkg/HttpBootDxe/HttpBootDxe.inf b/NetworkPkg/HttpBootDxe/HttpBootDxe.inf index 982e6b4..ec983ba 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootDxe.inf +++ b/NetworkPkg/HttpBootDxe/HttpBootDxe.inf @@ -58,10 +58,11 @@ DebugLib NetLib HttpLib HiiLib PrintLib + DpcLib UefiHiiServicesLib UefiBootManagerLib [Protocols] ## TO_START diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c b/NetworkPkg/HttpBootDxe/HttpBootSupport.c index 69b129f..d786d72 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c +++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c @@ -623,10 +623,43 @@ HttpBootSetHeader ( return EFI_SUCCESS; } /** + Notify the callback function when an event is triggered. + + @param[in] Context The opaque parameter to the function. + +**/ +VOID +HttpIoNotifyDpc ( + IN VOID*Context + ) +{ + *((BOOLEAN *) Context) = TRUE; +} + +/** + Request HttpIoNotifyDpc as a DPC at TPL_CALLBACK. + + @param[in] Event The event signaled. + @param[in] Context The opaque parameter to the function. + +**/ +VOID +HttpIoNotify ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + // + // Request HttpIoNotifyDpc as a DPC at TPL_CALLBACK + // + QueueDpc (TPL_CALLBACK, HttpIoNotifyDpc, Context); } + +/** Create a HTTP_IO to access the HTTP service. It will create and configure a HTTP child handle. @param[in] Image The handle of the driver image. @param[in] Controller The handle of the controller. @@ -728,11 +761,11 @@ HttpIoCreateIo ( // Create events for variuos asynchronous operations. // Status = gBS->CreateEvent ( EVT_NOTIFY_SIGNAL, TPL_NOTIFY, - HttpBootCommonNotify, + HttpIoNotify, >IsTxDone, ); if (EFI_ERROR (Status)) { goto ON_ERROR; @@ -741,11 +774,11 @@ HttpIoCreateIo ( HttpIo->ReqToken.Message = >ReqMessage; Status = gBS->CreateEvent ( EVT_NOTIFY_SIGNAL, TPL_NOTIFY, - HttpBootCommonNotify, + HttpIoNotify, >IsRxDone, ); if (EFI_ERROR (Status)) { goto ON_ERROR; -- 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] NetworkPkg/HttpBootDxe: Update to check specified media type
Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: Wu, Jiaxin Sent: 2017年2月15日 15:40 To: edk2-devel@lists.01.org Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com> Subject: [Patch] NetworkPkg/HttpBootDxe: Update to check specified media type IANA has approved below new media type for EFI http(s) boot usage: application/vnd.efi.img application/vnd.efi.iso HTTP boot driver should be updated to check the above media type from Content-Type header field. Cc: Ye Ting <ting...@intel.com> Cc: Fu Siyuan <siyuan...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin...@intel.com> --- NetworkPkg/HttpBootDxe/HttpBootDxe.h | 6 -- NetworkPkg/HttpBootDxe/HttpBootSupport.c | 10 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/NetworkPkg/HttpBootDxe/HttpBootDxe.h b/NetworkPkg/HttpBootDxe/HttpBootDxe.h index 2814594..a1e6792 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootDxe.h +++ b/NetworkPkg/HttpBootDxe/HttpBootDxe.h @@ -72,14 +72,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // Driver Version // #define HTTP_BOOT_DXE_VERSION 0xa // -// Provisional Standard Media Types defined in -// http://www.iana.org/assignments/provisional-standard-media-types/provisional-standard-media-types.xhtml +// Standard Media Types defined in +// http://www.iana.org/assignments/media-types // #define HTTP_CONTENT_TYPE_APP_EFI "application/efi" +#define HTTP_CONTENT_TYPE_APP_IMG "application/vnd.efi-img" +#define HTTP_CONTENT_TYPE_APP_ISO "application/vnd.efi-iso" // // Protocol instances // extern EFI_DRIVER_BINDING_PROTOCOL gHttpBootDxeDriverBinding; diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c b/NetworkPkg/HttpBootDxe/HttpBootSupport.c index d786d72..5cdc306 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c +++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c @@ -1174,17 +1174,25 @@ HttpBootCheckImageType ( return EFI_INVALID_PARAMETER; } // // Determine the image type by the HTTP Content-Type header field first. - // "application/efi" -> EFI Image + // "application/efi" -> EFI Image + // "application/vnd.efi-iso" -> CD/DVD Image + // "application/vnd.efi-img" -> Virtual Disk Image // Header = HttpFindHeader (HeaderCount, Headers, HTTP_HEADER_CONTENT_TYPE); if (Header != NULL) { if (AsciiStriCmp (Header->FieldValue, HTTP_CONTENT_TYPE_APP_EFI) == 0) { *ImageType = ImageTypeEfi; return EFI_SUCCESS; +} else if (AsciiStriCmp (Header->FieldValue, HTTP_CONTENT_TYPE_APP_ISO) == 0) { + *ImageType = ImageTypeVirtualCd; + return EFI_SUCCESS; +} else if (AsciiStriCmp (Header->FieldValue, HTTP_CONTENT_TYPE_APP_IMG) == 0) { + *ImageType = ImageTypeVirtualDisk; + return EFI_SUCCESS; } } // // Determine the image type by file extension: -- 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] NetworkPkg/TlsAuthConfigDxe: Declare EFIAPI for the ChooseFile handler
Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Gary Lin Sent: 2017年1月16日 14:30 To: edk2-devel@lists.01.org Cc: Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com> Subject: [edk2] [PATCH] NetworkPkg/TlsAuthConfigDxe: Declare EFIAPI for the ChooseFile handler The ChooseFile handler, UpdateCAFromFile, has to be EFIAPI or gcc would use the wrong ABI and cause the crash of the firmware. This commit also removes the unnecessary type casting in ChooseFile. Cc: Siyuan Fu <siyuan...@intel.com> Cc: Jiaxin Wu <jiaxin...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin <g...@suse.com> --- NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c b/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c index 5f04503887..fedfb01be9 100644 --- a/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c +++ b/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c @@ -1218,6 +1218,7 @@ UpdatePage( @retval FALSE Not exit caller function. **/ BOOLEAN +EFIAPI UpdateCAFromFile ( IN EFI_DEVICE_PATH_PROTOCOL*FilePath ) @@ -1728,7 +1729,7 @@ TlsAuthConfigAccessCallback ( CleanUpPage (LabelId, Private); break; case KEY_TLS_AUTH_CONFIG_ENROLL_CERT_FROM_FILE: - ChooseFile( NULL, NULL, (CHOOSE_HANDLER) UpdateCAFromFile, ); + ChooseFile( NULL, NULL, UpdateCAFromFile, ); break; case KEY_TLS_AUTH_CONFIG_VALUE_SAVE_AND_EXIT: -- 2.11.0 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH V1] SecurityPkg: AuthVariableLib: Fix potential inconsistency corner case for Time Auth variable
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Zhang, Chao B > Sent: Tuesday, August 16, 2016 10:39 AM > To: edk2-devel@lists.01.org > Cc: Fu, Siyuan <siyuan...@intel.com>; Zhang, Chao B > <chao.b.zh...@intel.com>; Zeng, Star <star.z...@intel.com> > Subject: [edk2] [PATCH V1] SecurityPkg: AuthVariableLib: Fix potential > inconsistency corner case for Time Auth variable > > 2 steps are used to create/delete a time based variable. For create, > step 1: Insert Signer Cert to CertDB. Step 2: Insert Payload to Variable. > For delete, step 1: Delete Variable. Step 2: Delete Cert from CertDB. > System may breaks between step 1 & step 2, so CertDB may contains useless > Cert in the next reboot. AuthVariableLib choose to sync consistent state > between CertDB & Time Auth Variable on initialization. However, it doesn't > apply Time Auth attribute check. Now add it. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Chao Zhang <chao.b.zh...@intel.com> > --- > SecurityPkg/Library/AuthVariableLib/AuthService.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/SecurityPkg/Library/AuthVariableLib/AuthService.c > b/SecurityPkg/Library/AuthVariableLib/AuthService.c > index 6e1e284..b013d42 100644 > --- a/SecurityPkg/Library/AuthVariableLib/AuthService.c > +++ b/SecurityPkg/Library/AuthVariableLib/AuthService.c > @@ -2100,7 +2100,7 @@ CleanCertsFromDb ( > > ); > > - if (EFI_ERROR(Status)) { > + if (EFI_ERROR(Status) || (AuthVariableInfo.Attributes & > EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) == 0) { > Status = DeleteCertsFromDb( > VariableName, > , > -- > 1.9.5.msysgit.1 > > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] MdeModulePkg: use LShiftU64() instead of "<<" to avoid IA32 build error.
Cc: Feng Tian <feng.t...@intel.com> Cc: Star Zeng <star.z...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> --- MdeModulePkg/Core/Dxe/Mem/Page.c | 2 +- MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index d596db7..7e8fa94 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -554,7 +554,7 @@ CoreAddMemoryDescriptor ( CoreReleaseMemoryLock (); ApplyMemoryProtectionPolicy (EfiMaxMemoryType, Type, Start, -EFI_PAGES_TO_SIZE (NumberOfPages)); +LShiftU64 (NumberOfPages, EFI_PAGE_SHIFT)); // // If Loading Module At Fixed Address feature is enabled. try to allocate memory with Runtime code & Boot time code type diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c index 172d667..45f360c 100644 --- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c +++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c @@ -851,7 +851,7 @@ InitializeDxeNxMemoryProtectionPolicy ( if (Attributes != 0) { SetUefiImageMemoryAttributes ( MemoryMapEntry->PhysicalStart, -EFI_PAGES_TO_SIZE (MemoryMapEntry->NumberOfPages), +LShiftU64 (MemoryMapEntry->NumberOfPages, EFI_PAGE_SHIFT), Attributes); } MemoryMapEntry = NEXT_MEMORY_DESCRIPTOR (MemoryMapEntry, DescriptorSize); -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive()
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: Wu, Jiaxin > Sent: Thursday, August 18, 2016 1:39 PM > To: edk2-devel@lists.01.org > Cc: Santhapur Naveen <nave...@amiindia.co.in>; Ye, Ting > <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com> > Subject: [Patch] MdeModulePkg: Support classless IP for DHCPv4 > TransmitReceive() > > The IP address should not be treated as classful one if DHCP options > contain a classless IP with its true subnet mask. Otherwise, DHCPv4 > TransmitReceive() will failed. This real subnet mask will be parsed > and recorded in DhcpSb->Netmask. So, we need check it before get the > IP's corresponding subnet mask. > > Cc: Santhapur Naveen <nave...@amiindia.co.in> > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> > --- > .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 28 +++-- > - > 1 file changed, 20 insertions(+), 8 deletions(-) > > diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > index 4f491b4..79f7cde 100644 > --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > @@ -1,9 +1,9 @@ > /** @file >This file implement the EFI_DHCP4_PROTOCOL interface. > > -Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved. > +Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved. > This program and the accompanying materials > are licensed and made available under the terms and conditions of the BSD > License > which accompanies this distribution. The full text of the license may be > found at > http://opensource.org/licenses/bsd-license.php > > @@ -1186,18 +1186,20 @@ Dhcp4InstanceConfigUdpIo ( >IN UDP_IO *UdpIo, >IN VOID *Context >) > { >DHCP_PROTOCOL *Instance; > + DHCP_SERVICE *DhcpSb; >EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token; >EFI_UDP4_CONFIG_DATA UdpConfigData; >IP4_ADDR ClientAddr; >IP4_ADDR Ip; >INTN Class; >IP4_ADDR SubnetMask; > >Instance = (DHCP_PROTOCOL *) Context; > + DhcpSb = Instance->Service; >Token= Instance->Token; > >ZeroMem (, sizeof (EFI_UDP4_CONFIG_DATA)); > >UdpConfigData.AcceptBroadcast= TRUE; > @@ -1206,14 +1208,19 @@ Dhcp4InstanceConfigUdpIo ( >UdpConfigData.DoNotFragment = TRUE; > >ClientAddr = EFI_NTOHL (Token->Packet->Dhcp4.Header.ClientAddr); >Ip = HTONL (ClientAddr); >CopyMem (, , sizeof (EFI_IPv4_ADDRESS)); > - > - Class = NetGetIpClass (ClientAddr); > - ASSERT (Class < IP4_ADDR_CLASSE); > - SubnetMask = gIp4AllMasks[Class << 3]; > + > + if (DhcpSb->Netmask == 0) { > +Class = NetGetIpClass (ClientAddr); > +ASSERT (Class < IP4_ADDR_CLASSE); > +SubnetMask = gIp4AllMasks[Class << 3]; > + } else { > +SubnetMask = DhcpSb->Netmask; > + } > + >Ip = HTONL (SubnetMask); >CopyMem (, , sizeof (EFI_IPv4_ADDRESS)); > >if ((Token->ListenPointCount == 0) || (Token- > >ListenPoints[0].ListenPort == 0)) { > UdpConfigData.StationPort = DHCP_CLIENT_PORT; > @@ -1574,16 +1581,21 @@ EfiDhcp4TransmitReceive ( > EndPoint.RemotePort = DHCP_SERVER_PORT; >} else { > EndPoint.RemotePort = Token->RemotePort; >} > > + if (DhcpSb->Netmask == 0) { > +Class = NetGetIpClass (ClientAddr); > +ASSERT (Class < IP4_ADDR_CLASSE); > +SubnetMask = gIp4AllMasks[Class << 3]; > + } else { > +SubnetMask = DhcpSb->Netmask; > + } > + >// >// Get the gateway. >// > - Class = NetGetIpClass (ClientAddr); > - ASSERT (Class < IP4_ADDR_CLASSE); > - SubnetMask = gIp4AllMasks[Class << 3]; >ZeroMem (, sizeof (Gateway)); >if (!IP4_NET_EQUAL (ClientAddr, EndPoint.RemoteAddr.Addr[0], > SubnetMask)) { > CopyMem (, >GatewayAddress, sizeof > (EFI_IPv4_ADDRESS)); > Gateway.Addr[0] = NTOHL (Gateway.Addr[0]); >} > -- > 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] NetworkPkg/IpSecDxe: Generate SPI randomly and correct IKE_SPI_BASE value
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: Wu, Jiaxin > Sent: Tuesday, September 6, 2016 11:39 AM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com> > Subject: [Patch] NetworkPkg/IpSecDxe: Generate SPI randomly and correct > IKE_SPI_BASE value > > This path made the following update: > * Generate SPI randomly. > * Correct IKE_SPI_BASE value according RFC 4302/4303. > > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> > --- > NetworkPkg/IpSecDxe/IkeCommon.c | 102 > +++- > NetworkPkg/IpSecDxe/IkeCommon.h | 20 --- > NetworkPkg/IpSecDxe/Ikev2/Utility.c | 11 +++- > 3 files changed, 112 insertions(+), 21 deletions(-) > > diff --git a/NetworkPkg/IpSecDxe/IkeCommon.c > b/NetworkPkg/IpSecDxe/IkeCommon.c > index 6fc7c06..b1e4321 100644 > --- a/NetworkPkg/IpSecDxe/IkeCommon.c > +++ b/NetworkPkg/IpSecDxe/IkeCommon.c > @@ -1,9 +1,9 @@ > /** @file >Common operation of the IKE > > - Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved. > + Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved. > >This program and the accompanying materials >are licensed and made available under the terms and conditions of the > BSD License >which accompanies this distribution. The full text of the license may > be found at >http://opensource.org/licenses/bsd-license.php. > @@ -16,14 +16,56 @@ > #include "Ike.h" > #include "IkeCommon.h" > #include "IpSecConfigImpl.h" > #include "IpSecDebug.h" > > -// > -// Initial the SPI > -// > -UINT32mNextSpi = IKE_SPI_BASE; > +/** > + Check whether the new generated Spi has existed. > + > + @param[in] IkeSaSession Pointer to the Child SA Session. > + @param[in] SpiValue SPI Value. > + > + @retval TRUEThis SpiValue has existed in the Child SA Session > + @retval FALSE This SpiValue doesn't exist in the Child SA Session. > + > +**/ > +BOOLEAN > +IkeSpiValueExisted ( > + IN IKEV2_SA_SESSION *IkeSaSession, > + IN UINT32SpiValue > + ) > +{ > + LIST_ENTRY *Entry; > + LIST_ENTRY *Next; > + IKEV2_CHILD_SA_SESSION *SaSession; > + > + Entry = NULL; > + Next = NULL; > + SaSession = NULL; > + > + // > + // Check whether the SPI value has existed in > ChildSaEstablishSessionList. > + // > + NET_LIST_FOR_EACH_SAFE (Entry, Next, > >ChildSaEstablishSessionList) { > +SaSession= IKEV2_CHILD_SA_SESSION_BY_IKE_SA (Entry); > +if (SaSession->LocalPeerSpi == SpiValue) { > + return TRUE; > +} > + } > + > + // > + // Check whether the SPI value has existed in ChildSaSessionList. > + // > + NET_LIST_FOR_EACH_SAFE (Entry, Next, >ChildSaSessionList) > { > +SaSession= IKEV2_CHILD_SA_SESSION_BY_IKE_SA (Entry); > +if (SaSession->LocalPeerSpi == SpiValue) { > + return TRUE; > +} > + } > + > + return FALSE; > +} > > /** >Call Crypto Lib to generate a random value with eight-octet length. > >@return the 64 byte vaule. > @@ -156,23 +198,57 @@ IkePayloadFree ( >FreePool (IkePayload); > } > > /** >Generate an new SPI. > - > - @return a SPI in 4 bytes. > + > + @param[in] IkeSaSession Pointer to IKEV2_SA_SESSION related to > this Child SA > + Session. > + @param[in out] SpiValue Pointer to the new generated SPI value. > + > + @retval EFI_SUCCESS The operation performs successfully. > + @retval Otherwise The operation is failed. > > **/ > -UINT32 > +EFI_STATUS > IkeGenerateSpi ( > - VOID > + IN IKEV2_SA_SESSION *IkeSaSession, > + OUT UINT32 *SpiValue >) > { > - // > - // TODO: should generate SPI randomly to avoid security issue > - // > - return mNextSpi++; > + EFI_STATUS Status; > + > + Status = EFI_SUCCESS; > + > + while (TRUE) { > +// > +// Generate SPI randomly > +// > +Status = IpSecCryptoIoGenerateRandomBytes ((UINT8 *)SpiValue, sizeof > (UINT32)); > +if (EFI_ERROR (Status)) { > + break; > +} > + > +// > +// The set of SPI values in the range 1 through 255 are reserved by > the > +// Internet Assigned Numbers Authority (IANA) for future use; a > r
Re: [edk2] [Patch] NetworkPkg/DnsDxe: Handle CNAME type responded from the name server
Jiaxin, For #2, it's ok, I didn't notice the change in your patch. For #1, I think we shouldn't mix the CNAME RR and A RR, they are 2 different answers and may have different TTL. Best Regards Siyuan From: Wu, Jiaxin Sent: Tuesday, September 6, 2016 3:05 PM To: Fu, Siyuan <siyuan...@intel.com>; edk2-devel@lists.01.org Cc: Hegde Nagaraj P <nagaraj-p.he...@hpe.com>; Ye, Ting <ting...@intel.com> Subject: RE: [Patch] NetworkPkg/DnsDxe: Handle CNAME type responded from the name server Hi Siyuan, > I have 2 comments for the patch. > 1. I think we can add the CNAME record to the DNS cache, just like the A and > records, so the driver won't need to repeat the query if user query the > host again. In my opinion , the CNAME is unnecessary to cache to avoid the repeat the query. Because if DnsCache is enabled, HostName and the corresponding IpAddress will be retrieved directly from EFI_DNS4_CACHE_ENTRY. > 2. We should hold the original query packet until the response is parsed > successfully, otherwise the system will crash again if a retransmit is needed. This patch already did the update to avoid the crash issue during retransmit by removing the below code after the parsing is complete. // // Parsing is complete, free the sending packet and signal Event here. // if (Item != NULL && Item->Value != NULL) { NetbufFree ((NET_BUF *) (Item->Value)); } So, the original query packet is safe until the response is parsed. > > Best Regards > Siyuan > > Thanks, Jiaxin > > -Original Message- > > From: Wu, Jiaxin > > Sent: Tuesday, September 6, 2016 11:39 AM > > To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> > > Cc: Hegde Nagaraj P > > <nagaraj-p.he...@hpe.com<mailto:nagaraj-p.he...@hpe.com>>; Fu, Siyuan > > <siyuan...@intel.com<mailto:siyuan...@intel.com>>; Ye, Ting > > <ting...@intel.com<mailto:ting...@intel.com>> > > Subject: [Patch] NetworkPkg/DnsDxe: Handle CNAME type responded from > > the name server > > > > According RFC 1034 - 3.6.2, if the query name is an alias, the name > > server will include the CNAME record in the response and restart the > > query at the domain name specified in the data field of the CNAME > > record. RFC also provides one example server action when A query > > received: > > > > Suppose a name server was processing a query with for USCISIC.ARPA, > > asking for type A information, and had the following resource records: > > USC-ISIC.ARPA IN CNAME C.ISI.EDU > > C.ISI.EDU IN A 10.0.0.52 > > Both of these RRs would be returned in the response to the type A query. > > > > Currently, DnsDxe driver doesn't handle the CNAME type response, which > > will cause any exception result. The driver need continue the packet > > parsing while CNAME type record parsed. So, this patch is used to > > handle it correctly. > > > > Cc: Hegde Nagaraj P > > <nagaraj-p.he...@hpe.com<mailto:nagaraj-p.he...@hpe.com>> > > Cc: Fu Siyuan <siyuan...@intel.com<mailto:siyuan...@intel.com>> > > Cc: Ye Ting <ting...@intel.com<mailto:ting...@intel.com>> > > Contributed-under: TianoCore Contribution Agreement 1.0 > > Signed-off-by: Jiaxin Wu <jiaxin...@intel.com<mailto:jiaxin...@intel.com>> > > --- > > NetworkPkg/DnsDxe/DnsImpl.c | 60 > > ++-- > > - > > 1 file changed, 35 insertions(+), 25 deletions(-) > > > > diff --git a/NetworkPkg/DnsDxe/DnsImpl.c > b/NetworkPkg/DnsDxe/DnsImpl.c > > index 360f68e..c68ec88 100644 > > --- a/NetworkPkg/DnsDxe/DnsImpl.c > > +++ b/NetworkPkg/DnsDxe/DnsImpl.c > > @@ -1231,17 +1231,10 @@ ParseDnsResponse ( > >if (DnsHeader->Flags.Bits.RCode != DNS_FLAGS_RCODE_NO_ERROR || > > DnsHeader->AnswersNum < 1 || \ > >DnsHeader->Flags.Bits.QR != DNS_FLAGS_QR_RESPONSE) { > >Status = EFI_ABORTED; > >goto ON_EXIT; > >} > > - > > - // > > - // Free the sending packet. > > - // > > - if (Item->Value != NULL) { > > -NetbufFree ((NET_BUF *) (Item->Value)); > > - } > > > >// > >// Do some buffer allocations. > >// > >if (Instance->Service->IpVersion == IP_VERSION_4) { @@ -1288,40 > > +1281,42 @@ ParseDnsResponse ( > >// > >// It's the GeneralLookUp querying. > >// > >Dns6TokenEntry->Token->RspData.GLookupData = AllocatePool > > (sizeof (DNS_RESOURCE_RECORD)); > >if (Dns6TokenEn
Re: [edk2] [PATCH v2] NetworkPkg/DnsDxe: Handle CNAME type responded from the name server
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Jiaxin Wu > Sent: Tuesday, September 6, 2016 4:51 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com> > Subject: [edk2] [PATCH v2] NetworkPkg/DnsDxe: Handle CNAME type responded > from the name server > > v2: > * Code refine. > * For DnsCache, the minimum value of TTL is selected between CNAME and > A/ record. > > According RFC 1034 - 3.6.2, if the query name is an alias, the name server > will include the CNAME record in the response and restart the query at the > domain name specified in the data field of the CNAME record. RFC also > provides > one example server action when A query received: > > Suppose a name server was processing a query with for USCISIC.ARPA, asking > for > type A information, and had the following resource records: > USC-ISIC.ARPA IN CNAME C.ISI.EDU > C.ISI.EDU IN A 10.0.0.52 > Both of these RRs would be returned in the response to the type A query. > > Currently, DnsDxe driver doesn't handle the CNAME type response, which > will cause > any exception result. The driver need continue the packet parsing while > CNAME type > record parsed. So, this patch is used to handle it correctly. > > Cc: Hegde Nagaraj P <nagaraj-p.he...@hpe.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> > --- > NetworkPkg/DnsDxe/DnsImpl.c | 81 +--- > - > 1 file changed, 52 insertions(+), 29 deletions(-) > > diff --git a/NetworkPkg/DnsDxe/DnsImpl.c b/NetworkPkg/DnsDxe/DnsImpl.c > index 360f68e..cfaa4c7 100644 > --- a/NetworkPkg/DnsDxe/DnsImpl.c > +++ b/NetworkPkg/DnsDxe/DnsImpl.c > @@ -1125,10 +1125,11 @@ ParseDnsResponse ( >DNS6_TOKEN_ENTRY *Dns6TokenEntry; > >UINT32IpCount; >UINT32RRCount; >UINT32AnswerSectionNum; > + UINT32CNameTtl; > >EFI_IPv4_ADDRESS *HostAddr4; >EFI_IPv6_ADDRESS *HostAddr6; > >EFI_DNS4_CACHE_ENTRY *Dns4CacheEntry; > @@ -1146,10 +1147,11 @@ ParseDnsResponse ( >Dns6TokenEntry = NULL; > >IpCount = 0; >RRCount = 0; >AnswerSectionNum = 0; > + CNameTtl = 0; > >HostAddr4= NULL; >HostAddr6= NULL; > >Dns4CacheEntry = NULL; > @@ -1231,17 +1233,10 @@ ParseDnsResponse ( >if (DnsHeader->Flags.Bits.RCode != DNS_FLAGS_RCODE_NO_ERROR || > DnsHeader->AnswersNum < 1 || \ >DnsHeader->Flags.Bits.QR != DNS_FLAGS_QR_RESPONSE) { >Status = EFI_ABORTED; >goto ON_EXIT; >} > - > - // > - // Free the sending packet. > - // > - if (Item->Value != NULL) { > -NetbufFree ((NET_BUF *) (Item->Value)); > - } > >// >// Do some buffer allocations. >// >if (Instance->Service->IpVersion == IP_VERSION_4) { > @@ -1288,40 +1283,42 @@ ParseDnsResponse ( >// >// It's the GeneralLookUp querying. >// >Dns6TokenEntry->Token->RspData.GLookupData = AllocatePool (sizeof > (DNS_RESOURCE_RECORD)); >if (Dns6TokenEntry->Token->RspData.GLookupData == NULL) { > -Status = EFI_UNSUPPORTED; > +Status = EFI_OUT_OF_RESOURCES; > goto ON_EXIT; >} >Dns6TokenEntry->Token->RspData.GLookupData->RRList = AllocatePool > (DnsHeader->AnswersNum * sizeof (DNS_RESOURCE_RECORD)); >if (Dns6TokenEntry->Token->RspData.GLookupData->RRList == NULL) { > -Status = EFI_UNSUPPORTED; > +Status = EFI_OUT_OF_RESOURCES; > goto ON_EXIT; >} > } else { >// >// It's not the GeneralLookUp querying. Check the Query type. >// >if (QuerySection->Type == DNS_TYPE_) { > Dns6TokenEntry->Token->RspData.H2AData = AllocatePool (sizeof > (DNS6_HOST_TO_ADDR_DATA)); > if (Dns6TokenEntry->Token->RspData.H2AData == NULL) { > - Status = EFI_UNSUPPORTED; > + Status = EFI_OUT_OF_RESOURCES; >goto ON_EXIT; > } > Dns6TokenEntry->Token->RspData.H2AData->IpList = AllocatePool > (DnsHeader->AnswersNum * sizeof (EFI_IPv6_ADDRESS)); > if (Dns6TokenEntry->Token->RspData.H2AData->IpList == NULL) { > - Status = EFI_UNSUPPORTED; >
[edk2] [Patch] NetworkPkg: Remove redundant code in HTTP boot driver.
Cc: Wu Jiaxin <jiaxin...@intel.com> Cc: Zhang Lubo <lubo.zh...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> --- NetworkPkg/HttpBootDxe/HttpBootDhcp6.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/NetworkPkg/HttpBootDxe/HttpBootDhcp6.c b/NetworkPkg/HttpBootDxe/HttpBootDhcp6.c index 809accc..8478642 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootDhcp6.c +++ b/NetworkPkg/HttpBootDxe/HttpBootDhcp6.c @@ -418,9 +418,6 @@ HttpBootDhcp6CallBack ( HTTP_BOOT_PRIVATE_DATA *Private; EFI_DHCP6_PACKET*SelectAd; EFI_STATUS Status; - if ((Dhcp6Event != Dhcp6RcvdAdvertise) && (Dhcp6Event != Dhcp6SelectAdvertise)) { - return EFI_SUCCESS; - } ASSERT (Packet != NULL); -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] Classless IP support for IPv4 PXE boot
Hi, Naveen May I know the GIT version of the 21543, or the subject of the commit message? I can't see the svn revision number on my side. Thanks Siyuan > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Santhapur Naveen > Sent: Wednesday, August 17, 2016 7:41 PM > To: edk2-devel@lists.01.org > Cc: Sivaraman Nainar; Madhan B. Santharam > > Subject: [edk2] Classless IP support for IPv4 PXE boot > > Hello, > > We happened to observe that the IPv4 PXE boot was happening > successfully for both classless and classful IPs until the EDKII revision > 21542. It has been found that there are some changes made in the revision > 21543 and the IPv4 PXE boot is failing for classless IP addresses. The > failure scenario was debugged and is explained here. Let's assume the > subnet range is 192.168.1.0/16. The DHCP server tries to allot an IP > (let's say 192.168.1.0) but based on the first byte of the IP address to > be assigned, the function NetGetIpClass() returns the IP class as Class-C > and its respective subnet mask as 255.255.255.0 that should be for a > classful IP address whereas 255.255.0.0 is the actual subnet in this > scenario. The changes present in function Dhcp4InstanceConfigUdpIo() seems > to be responsible for the failure. > > May we know the reason behind the changes present in the Dhcp4Impl.c of > the revision 21543? Is there any plan to bring the classless IP support in > NetworkPkg? > > > Thanks, > Naveen > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] Classless IP support for IPv4 PXE boot
Naveen, I see it, the corresponding GIT version is ce964733292e31dce34e0be651f20a9d79884132. I believe it's a regression bug, the change assume the IP address is always classful. I think it should check the option list to see if a subnet mask option is present. Could you please file a new bug in the Tianocore Bugzilla web site. In future you can directly report issues to the Bugzilla also. Thanks https://tianocore.acgmultimedia.com/ https://github.com/tianocore/tianocore.github.io/wiki/Reporting-Issues Siyuan From: Santhapur Naveen [mailto:nave...@amiindia.co.in] Sent: Thursday, August 18, 2016 11:15 AM To: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; edk2-devel@lists.01.org Cc: Sivaraman Nainar <sivaram...@amiindia.co.in>; Madhan B. Santharam <madh...@ami.com> Subject: RE: Classless IP support for IPv4 PXE boot Please find the below details and snapshot. Revision: 21543 Author: Wu.Jiaxin Date: Thursday, June 18, 2015 6:13:15 AM Message: MdeModulePkg: Remove DHCP4.TransmitReceive() and DORA process dependency. Modified: /trunk/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin...@intel.com<mailto:jiaxin...@intel.com>> Reviewed-by: Ye Ting <ting...@intel.com<mailto:ting...@intel.com>> Reviewed-by: Fu Siyuan <siyuan...@intel.com<mailto:siyuan...@intel.com>> Please check if the below snapshot may help. [cid:image001.jpg@01D1F92C.D1247640] Thanks, Naveen -Original Message- From: Ye, Ting [mailto:ting...@intel.com] Sent: Thursday, August 18, 2016 8:23 AM To: Fu, Siyuan; Santhapur Naveen; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Cc: Sivaraman Nainar; Madhan B. Santharam Subject: RE: Classless IP support for IPv4 PXE boot I searched the log messages: Revision: 21543 Author: edk2buildsystem Date: Friday, July 01, 2016 5:05:51 AM Message: MdeModulePkg VariableInfo: Fix GCC build failure GCC build failure: 'RealCommSize' may be used uninitialized Cc: Jiewen Yao <jiewen@intel.com<mailto:jiewen@intel.com>> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.z...@intel.com<mailto:star.z...@intel.com>> Reviewed-by: Giri P Mudusuru <giri.p.mudus...@intel.com<mailto:giri.p.mudus...@intel.com>> (cherry picked from commit 05b39efb669eaa173a76e58daf8e65bce2e0299e) Modified : /trunk/edk2/MdeModulePkg/Application/VariableInfo/VariableInfo.c This looks irrelevant. Could you please confirm the revision? Thanks, Ting -----Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Fu, Siyuan Sent: Thursday, August 18, 2016 10:48 AM To: Santhapur Naveen <nave...@amiindia.co.in<mailto:nave...@amiindia.co.in>>; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Cc: Sivaraman Nainar <sivaram...@amiindia.co.in<mailto:sivaram...@amiindia.co.in>>; Madhan B. Santharam <madh...@ami.com<mailto:madh...@ami.com>> Subject: Re: [edk2] Classless IP support for IPv4 PXE boot Hi, Naveen May I know the GIT version of the 21543, or the subject of the commit message? I can't see the svn revision number on my side. Thanks Siyuan > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Santhapur Naveen > Sent: Wednesday, August 17, 2016 7:41 PM > To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> > Cc: Sivaraman Nainar > <sivaram...@amiindia.co.in<mailto:sivaram...@amiindia.co.in>>; Madhan B. > Santharam > <madh...@ami.com<mailto:madh...@ami.com>> > Subject: [edk2] Classless IP support for IPv4 PXE boot > > Hello, > > We happened to observe that the IPv4 PXE boot was happening > successfully for both classless and classful IPs until the EDKII > revision 21542. It has been found that there are some changes made in > the revision > 21543 and the IPv4 PXE boot is failing for classless IP addresses. The > failure scenario was debugged and is explained here. Let's assume the > subnet range is 192.168.1.0/16. The DHCP server tries to allot an IP > (let's say 192.168.1.0) but based on the first byte of the IP address > to be assigned, the function NetGetIpClass() returns the IP class as > Class-C and its respective subnet mask as 255.255.255.0 that should be > for a classful IP address whereas 255.255.0.0 is the actual subnet in > this scenario. The changes present in function > Dhcp4InstanceConfigUdpIo() seems to be responsible for the failure. > > May we know the reason behind the changes present in the Dhcp4Impl.c > of the revision 21543? Is there any plan to bri
Re: [edk2] [patch] MdeModulePkg:Fix bug in function AsciiStrToIp4.
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: Zhang, Lubo > Sent: Friday, August 19, 2016 3:53 PM > To: edk2-devel@lists.01.org > Cc: Fu, Siyuan <siyuan...@intel.com>; Ye, Ting <ting...@intel.com>; Wu, > Jiaxin <jiaxin...@intel.com>; Hegde Nagaraj P <nagaraj-p.he...@hpe.com> > Subject: [patch] MdeModulePkg:Fix bug in function AsciiStrToIp4. > > If a FQDN contains 3 dots '.' like "a.b.c.com", the AsciiStrToIp4 > will return success as the HostName has a valid IP address. So we > need to check if it is a decimal character before using > AsciiStrDecimalToUintn. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Zhang Lubo <lubo.zh...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Wu Jiaxin <jiaxin...@intel.com> > Cc: Hegde Nagaraj P <nagaraj-p.he...@hpe.com> > --- > MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c > b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c > index ef19439..f4376e9 100644 > --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c > +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c > @@ -2724,10 +2724,13 @@ NetLibAsciiStrToIp4 ( > >for (Index = 0; Index < 4; Index++) { > TempStr = Ip4Str; > > while ((*Ip4Str != '\0') && (*Ip4Str != '.')) { > + if (!NET_IS_DIGIT(*Ip4Str)) { > +return EFI_INVALID_PARAMETER; > + } >Ip4Str++; > } > > // > // The IPv4 address is X.X.X.X > -- > 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 34/47] NetworkPkg/TcpDxe: rebase to ARRAY_SIZE()
Reviewed-by: Fu Siyuan siyuan...@intel.com > -Original Message- > From: Laszlo Ersek [mailto:ler...@redhat.com] > Sent: Thursday, October 27, 2016 3:05 AM > To: edk2-devel-01 <edk2-de...@ml01.01.org> > Cc: Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com> > Subject: [PATCH 34/47] NetworkPkg/TcpDxe: rebase to ARRAY_SIZE() > > Cc: Siyuan Fu <siyuan...@intel.com> > Cc: Jiaxin Wu <jiaxin...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Laszlo Ersek <ler...@redhat.com> > --- > NetworkPkg/TcpDxe/TcpOutput.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/NetworkPkg/TcpDxe/TcpOutput.c b/NetworkPkg/TcpDxe/TcpOutput.c > index 91e56d369a71..a46cb6099ea8 100644 > --- a/NetworkPkg/TcpDxe/TcpOutput.c > +++ b/NetworkPkg/TcpDxe/TcpOutput.c > @@ -797,7 +797,7 @@ TcpToSendData ( > Len = TcpDataToSend (Tcb, Force); > Seq = Tcb->SndNxt; > > -ASSERT ((Tcb->State) < (sizeof (mTcpOutFlag) / sizeof > (mTcpOutFlag[0]))); > +ASSERT ((Tcb->State) < (ARRAY_SIZE (mTcpOutFlag))); > Flag = mTcpOutFlag[Tcb->State]; > > if ((Flag & TCP_FLG_SYN) != 0) { > -- > 2.9.2 > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 33/47] NetworkPkg/IScsiDxe: rebase to ARRAY_SIZE()
Reviewed-by: Fu Siyuan siyuan...@intel.com > -Original Message- > From: Laszlo Ersek [mailto:ler...@redhat.com] > Sent: Thursday, October 27, 2016 3:05 AM > To: edk2-devel-01 <edk2-de...@ml01.01.org> > Cc: Wu, Jiaxin <jiaxin...@intel.com>; Fu, Siyuan <siyuan...@intel.com> > Subject: [PATCH 33/47] NetworkPkg/IScsiDxe: rebase to ARRAY_SIZE() > > Cc: Jiaxin Wu <jiaxin...@intel.com> > Cc: Siyuan Fu <siyuan...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Laszlo Ersek <ler...@redhat.com> > --- > NetworkPkg/IScsiDxe/IScsiConfig.c | 4 ++-- > NetworkPkg/IScsiDxe/IScsiDriver.c | 2 +- > NetworkPkg/IScsiDxe/IScsiMisc.c | 6 +++--- > 3 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c > b/NetworkPkg/IScsiDxe/IScsiConfig.c > index 3631e72e3455..16a90a6206aa 100644 > --- a/NetworkPkg/IScsiDxe/IScsiConfig.c > +++ b/NetworkPkg/IScsiDxe/IScsiConfig.c > @@ -,7 +,7 @@ IScsiConfigUpdateAttempt ( >NET_LIST_FOR_EACH (Entry, >AttemptConfigs) { > AttemptConfigData = NET_LIST_USER_STRUCT (Entry, > ISCSI_ATTEMPT_CONFIG_NVDATA, Link); > > -AsciiStrToUnicodeStrS (AttemptConfigData->AttemptName, AttemptName, > sizeof (AttemptName) / sizeof (AttemptName[0])); > +AsciiStrToUnicodeStrS (AttemptConfigData->AttemptName, AttemptName, > ARRAY_SIZE (AttemptName)); > UnicodeSPrint (mPrivate->PortString, (UINTN) 128, L"Attempt %s", > AttemptName); > AttemptConfigData->AttemptTitleToken = HiiSetString ( > mCallbackInfo- > >RegisteredHandle, > @@ -1240,7 +1240,7 @@ IScsiConfigDeleteAttempts ( >mPrivate->SinglePathCount--; > } > > -AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString, > sizeof (MacString) / sizeof (MacString[0])); > +AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString, > ARRAY_SIZE (MacString)); > > UnicodeSPrint ( >mPrivate->PortString, > diff --git a/NetworkPkg/IScsiDxe/IScsiDriver.c > b/NetworkPkg/IScsiDxe/IScsiDriver.c > index 279f1c049679..ac10fa26d1b9 100644 > --- a/NetworkPkg/IScsiDxe/IScsiDriver.c > +++ b/NetworkPkg/IScsiDxe/IScsiDriver.c > @@ -673,7 +673,7 @@ IScsiStart ( > Session->ConfigData = AttemptConfigData; > Session->AuthType = AttemptConfigData->AuthenticationType; > > -AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString, > sizeof (MacString) / sizeof (MacString[0])); > +AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString, > ARRAY_SIZE (MacString)); > UnicodeSPrint ( >mPrivate->PortString, >(UINTN) ISCSI_NAME_IFR_MAX_SIZE, > diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c > b/NetworkPkg/IScsiDxe/IScsiMisc.c > index 64bb2ade7b0a..11a80f2e10e4 100644 > --- a/NetworkPkg/IScsiDxe/IScsiMisc.c > +++ b/NetworkPkg/IScsiDxe/IScsiMisc.c > @@ -1109,7 +1109,7 @@ IScsiGetConfigData ( >// >// Refresh the state of this attempt to NVR. >// > - AsciiStrToUnicodeStrS (AttemptTmp->MacString, MacString, sizeof > (MacString) / sizeof (MacString[0])); > + AsciiStrToUnicodeStrS (AttemptTmp->MacString, MacString, > ARRAY_SIZE (MacString)); >UnicodeSPrint ( > mPrivate->PortString, > (UINTN) ISCSI_NAME_IFR_MAX_SIZE, > @@ -1148,7 +1148,7 @@ IScsiGetConfigData ( > // > // Refresh the state of this attempt to NVR. > // > -AsciiStrToUnicodeStrS (AttemptTmp->MacString, MacString, sizeof > (MacString) / sizeof (MacString[0])); > +AsciiStrToUnicodeStrS (AttemptTmp->MacString, MacString, > ARRAY_SIZE (MacString)); > UnicodeSPrint ( >mPrivate->PortString, >(UINTN) ISCSI_NAME_IFR_MAX_SIZE, > @@ -1239,7 +1239,7 @@ IScsiGetConfigData ( >// >// Refresh the state of this attempt to NVR. >// > - AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString, > sizeof (MacString) / sizeof (MacString[0])); > + AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString, > ARRAY_SIZE (MacString)); >UnicodeSPrint ( > mPrivate->PortString, > (UINTN) ISCSI_NAME_IFR_MAX_SIZE, > -- > 2.9.2 > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 07/47] NetworkPkg/IpsecConfig: remove module-local ARRAY_SIZE macro
Reviewed-by: Fu Siyuan siyuan...@intel.com > -Original Message- > From: Laszlo Ersek [mailto:ler...@redhat.com] > Sent: Thursday, October 27, 2016 3:04 AM > To: edk2-devel-01 <edk2-de...@ml01.01.org> > Cc: Wu, Jiaxin <jiaxin...@intel.com>; Fu, Siyuan <siyuan...@intel.com> > Subject: [PATCH 07/47] NetworkPkg/IpsecConfig: remove module-local > ARRAY_SIZE macro > > Rely on the central macro definition from "MdePkg/Include/Base.h" instead. > > Cc: Jiaxin Wu <jiaxin...@intel.com> > Cc: Siyuan Fu <siyuan...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Laszlo Ersek <ler...@redhat.com> > --- > NetworkPkg/Application/IpsecConfig/IpSecConfig.h | 4 > 1 file changed, 4 deletions(-) > > diff --git a/NetworkPkg/Application/IpsecConfig/IpSecConfig.h > b/NetworkPkg/Application/IpsecConfig/IpSecConfig.h > index 79a436a7b3b2..95bb6961136d 100644 > --- a/NetworkPkg/Application/IpsecConfig/IpSecConfig.h > +++ b/NetworkPkg/Application/IpsecConfig/IpSecConfig.h > @@ -27,10 +27,6 @@ > > #include > > -#ifndef ARRAY_SIZE > -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) > -#endif > - > #define IPSECCONFIG_STATUS_NAMEL"IpSecStatus" > > #define BIT(x) (UINT32) (1 << (x)) > -- > 2.9.2 > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 02/47] NetworkPkg/IpsecConfig: guard the definition of ARRAY_SIZE
Reviewed-by: Fu Siyuan siyuan...@intel.com > -Original Message- > From: Laszlo Ersek [mailto:ler...@redhat.com] > Sent: Thursday, October 27, 2016 3:04 AM > To: edk2-devel-01 <edk2-de...@ml01.01.org> > Cc: Wu, Jiaxin <jiaxin...@intel.com>; Fu, Siyuan <siyuan...@intel.com> > Subject: [PATCH 02/47] NetworkPkg/IpsecConfig: guard the definition of > ARRAY_SIZE > > In one of the next patches, we'll introduce ARRAY_SIZE in > "MdePkg/Include/Base.h". In order to proceed in small steps, make the > module-local definition of ARRAY_SIZE conditional. This way the > introduction of the macro under MdePkg will silently switch this module > over (after which we can remove the module-local definition completely). > > Cc: Jiaxin Wu <jiaxin...@intel.com> > Cc: Siyuan Fu <siyuan...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Laszlo Ersek <ler...@redhat.com> > --- > NetworkPkg/Application/IpsecConfig/IpSecConfig.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/NetworkPkg/Application/IpsecConfig/IpSecConfig.h > b/NetworkPkg/Application/IpsecConfig/IpSecConfig.h > index 8ebc599a12e7..79a436a7b3b2 100644 > --- a/NetworkPkg/Application/IpsecConfig/IpSecConfig.h > +++ b/NetworkPkg/Application/IpsecConfig/IpSecConfig.h > @@ -27,7 +27,9 @@ > > #include > > +#ifndef ARRAY_SIZE > #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) > +#endif > > #define IPSECCONFIG_STATUS_NAMEL"IpSecStatus" > > -- > 2.9.2 > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 1/3] MdeModulePkg: Update NetLib interface to support classless addressing.
The classful addressing (IP class A/B/C) has been deprecated according to RFC4632. This patch updates the NetLib NetGetIpClass() and NetIp4IsUnicast() accordingly. NetGetIpClass() The function is kept for compatibility, while the caller of this function could only check the returned value against with IP4_ADDR_CLASSD (multicast) or IP4_ADDR_CLASSE (reserved) now. The function has been updated to note this. NetIp4IsUnicast() The NetMask becomes a required parameter to check the unicast address. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Zhang Lubo <lubo.zh...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> --- MdeModulePkg/Include/Library/NetLib.h | 22 +- MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 26 -- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/MdeModulePkg/Include/Library/NetLib.h b/MdeModulePkg/Include/Library/NetLib.h index 87f393e..4c4f0bf 100644 --- a/MdeModulePkg/Include/Library/NetLib.h +++ b/MdeModulePkg/Include/Library/NetLib.h @@ -43,9 +43,9 @@ typedef UINT16 TCP_PORTNO; // // The address classification // -#define IP4_ADDR_CLASSA 1 -#define IP4_ADDR_CLASSB 2 -#define IP4_ADDR_CLASSC 3 +#define IP4_ADDR_CLASSA 1 // Deprecated +#define IP4_ADDR_CLASSB 2 // Deprecated +#define IP4_ADDR_CLASSC 3 // Deprecated #define IP4_ADDR_CLASSD 4 #define IP4_ADDR_CLASSE 5 @@ -379,6 +379,11 @@ NetGetMaskLength ( Return the class of the IP address, such as class A, B, C. Addr is in host byte order. + [ATTENTION] + Classful addressing (IP class A/B/C) has been deprecated according to RFC4632. + Caller of this function could only check the returned value against + IP4_ADDR_CLASSD (multicast) or IP4_ADDR_CLASSE (reserved) now. + The address of class A starts with 0. If the address belong to class A, return IP4_ADDR_CLASSA. The address of class B starts with 10. @@ -404,17 +409,16 @@ NetGetIpClass ( /** Check whether the IP is a valid unicast address according to - the netmask. If NetMask is zero, use the IP address's class to get the default mask. + the netmask. - If Ip is 0, IP is not a valid unicast address. - Class D address is used for multicasting and class E address is reserved for future. If Ip - belongs to class D or class E, Ip is not a valid unicast address. - If all bits of the host address of Ip are 0 or 1, Ip is not a valid unicast address. + ASSERT if NetMask is zero. + + If all bits of the host address of IP are 0 or 1, IP is also not a valid unicast address. @param[in] IpThe IP to check against. @param[in] NetMask The mask of the IP. - @return TRUE if Ip is a valid unicast address on the network, otherwise FALSE. + @return TRUE if IP is a valid unicast address on the network, otherwise FALSE. **/ BOOLEAN diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c index 7700f0ff..83a99e5 100644 --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c @@ -580,6 +580,11 @@ NetGetMaskLength ( Return the class of the IP address, such as class A, B, C. Addr is in host byte order. + [ATTENTION] + Classful addressing (IP class A/B/C) has been deprecated according to RFC4632. + Caller of this function could only check the returned value against + IP4_ADDR_CLASSD (multicast) or IP4_ADDR_CLASSE (reserved) now. + The address of class A starts with 0. If the address belong to class A, return IP4_ADDR_CLASSA. The address of class B starts with 10. @@ -628,11 +633,10 @@ NetGetIpClass ( /** Check whether the IP is a valid unicast address according to - the netmask. If NetMask is zero, use the IP address's class to get the default mask. + the netmask. - If Ip is 0, IP is not a valid unicast address. - Class D address is used for multicasting and class E address is reserved for future. If Ip - belongs to class D or class E, IP is not a valid unicast address. + ASSERT if NetMask is zero. + If all bits of the host address of IP are 0 or 1, IP is also not a valid unicast address. @param[in] IpThe IP to check against. @@ -648,18 +652,12 @@ NetIp4IsUnicast ( IN IP4_ADDR NetMask ) { - INTN Class; - - Class = NetGetIpClass (Ip); - - if ((Ip == 0) || (Class >= IP4_ADDR_CLASSD)) { + ASSERT (NetMask != 0); + + if (Ip == 0) { return FALSE; } - - if (NetMask == 0) { -NetMask = gIp4AllMasks[Class << 3]; - } - + if (((Ip &~NetMask) == ~NetMask) || ((Ip &~NetMask) == 0)) { return FALSE; } -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 2/3] MdeModulePkg: Update IP4 stack drivers for classless address unicast check.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Zhang Lubo <lubo.zh...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> --- MdeModulePkg/Include/Library/IpIoLib.h | 4 ++- MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c | 9 ++- MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c| 7 - .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 29 ++--- MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c | 6 + .../Universal/Network/IScsiDxe/IScsiConfig.c | 18 ++--- .../Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 15 +++ .../Universal/Network/Ip4Dxe/Ip4Config2Nv.c| 30 -- MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c | 7 + .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c | 9 +-- MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.c | 7 ++--- MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c | 9 +-- MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c | 5 ++-- .../Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 27 +-- 14 files changed, 61 insertions(+), 121 deletions(-) diff --git a/MdeModulePkg/Include/Library/IpIoLib.h b/MdeModulePkg/Include/Library/IpIoLib.h index 37cba07..aab0c68 100644 --- a/MdeModulePkg/Include/Library/IpIoLib.h +++ b/MdeModulePkg/Include/Library/IpIoLib.h @@ -2,7 +2,7 @@ This library is only intended to be used by UEFI network stack modules. It provides the combined IpIo layer on the EFI IP4 Protocol and EFI IP6 protocol. -Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved. +Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License that accompanies this distribution. The full text of the license may be found at @@ -261,6 +261,8 @@ typedef struct _IP_IO { PKT_RCVD_NOTIFY PktRcvdNotify; ///< See IP_IO_OPEN_DATA::PktRcvdNotify. PKT_SENT_NOTIFY PktSentNotify; ///< See IP_IO_OPEN_DATA::PktSentNotify. UINT8 IpVersion; + IP4_ADDR StationIp; + IP4_ADDR SubnetMask; } IP_IO; /// diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c index ab4df80..d4e9dc1 100644 --- a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c +++ b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c @@ -1029,7 +1029,9 @@ IpIoListenHandlerDpc ( if (IpIo->IpVersion == IP_VERSION_4) { if ((EFI_IP4 (RxData->Ip4RxData.Header->SourceAddress) != 0) && -!NetIp4IsUnicast (EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) RxData)->Header->SourceAddress), 0)) { +(IpIo->SubnetMask != 0) && +IP4_NET_EQUAL (IpIo->StationIp, EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) RxData)->Header->SourceAddress), IpIo->SubnetMask) && +!NetIp4IsUnicast (EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) RxData)->Header->SourceAddress), IpIo->SubnetMask)) { // // The source address is not zero and it's not a unicast IP address, discard it. // @@ -1300,6 +1302,11 @@ IpIoOpen ( if (OpenData->IpConfigData.Ip4CfgData.RawData) { return EFI_UNSUPPORTED; } + +if (!OpenData->IpConfigData.Ip4CfgData.UseDefaultAddress) { + IpIo->StationIp = EFI_NTOHL (OpenData->IpConfigData.Ip4CfgData.StationAddress); + IpIo->SubnetMask = EFI_NTOHL (OpenData->IpConfigData.Ip4CfgData.SubnetMask); +} Status = IpIo->Ip.Ip4->Configure ( IpIo->Ip.Ip4, diff --git a/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c b/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c index afe4929..d1cebbb 100644 --- a/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c +++ b/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c @@ -942,13 +942,6 @@ ArpConfigureInstance ( if (ConfigData->SwAddressType == IPV4_ETHER_PROTO_TYPE) { CopyMem (, ConfigData->StationAddress, sizeof (IP4_ADDR)); - -if (!NetIp4IsUnicast (NTOHL (Ip), 0)) { - // - // The station address is not a valid IPv4 unicast address. - // - return EFI_INVALID_PARAMETER; -} } // diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c index 79f7cde..51cb4fd 100644 --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c @@ -660,11 +660,6 @@ EfiDhcp4Configure ( } CopyMem (, >ClientAddress, sizeof (IP4_ADDR)); - -if ((Ip != 0) && !NetIp4IsUnicast (NTOHL (Ip), 0)) { - - return EFI_INVALID_PARAMETER; -} } Instance = DHCP_IN
[edk2] [PATCH v2 1/3] MdeModulePkg: Update NetLib interface to support classless addressing.
V2: Add macro IP4_IS_UNSPECIFIED. The classful addressing (IP class A/B/C) has been deprecated according to RFC4632. This patch updates the NetLib NetGetIpClass() and NetIp4IsUnicast() accordingly. NetGetIpClass() The function is kept for compatibility, while the caller of this function could only check the returned value against with IP4_ADDR_CLASSD (multicast) or IP4_ADDR_CLASSE (reserved) now. The function has been updated to note this. NetIp4IsUnicast() The NetMask becomes a required parameter to check the unicast address. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Zhang Lubo <lubo.zh...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> --- MdeModulePkg/Include/Library/NetLib.h | 23 ++- MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 26 -- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/MdeModulePkg/Include/Library/NetLib.h b/MdeModulePkg/Include/Library/NetLib.h index c5c0fc2..26709af 100644 --- a/MdeModulePkg/Include/Library/NetLib.h +++ b/MdeModulePkg/Include/Library/NetLib.h @@ -43,9 +43,9 @@ typedef UINT16 TCP_PORTNO; // // The address classification // -#define IP4_ADDR_CLASSA 1 -#define IP4_ADDR_CLASSB 2 -#define IP4_ADDR_CLASSC 3 +#define IP4_ADDR_CLASSA 1 // Deprecated +#define IP4_ADDR_CLASSB 2 // Deprecated +#define IP4_ADDR_CLASSC 3 // Deprecated #define IP4_ADDR_CLASSD 4 #define IP4_ADDR_CLASSE 5 @@ -231,6 +231,7 @@ typedef struct { // Test the IP's attribute, All the IPs are in host byte order. // #define IP4_IS_MULTICAST(Ip) (((Ip) & 0xF000) == 0xE000) +#define IP4_IS_UNSPECIFIED(Ip)((Ip) == 0) #define IP4_IS_LOCAL_BROADCAST(Ip)((Ip) == 0x) #define IP4_NET_EQUAL(Ip1, Ip2, NetMask) (((Ip1) & (NetMask)) == ((Ip2) & (NetMask))) #define IP4_IS_VALID_NETMASK(Ip) (NetGetMaskLength (Ip) != (IP4_MASK_MAX + 1)) @@ -379,6 +380,11 @@ NetGetMaskLength ( Return the class of the IP address, such as class A, B, C. Addr is in host byte order. + [ATTENTION] + Classful addressing (IP class A/B/C) has been deprecated according to RFC4632. + Caller of this function could only check the returned value against + IP4_ADDR_CLASSD (multicast) or IP4_ADDR_CLASSE (reserved) now. + The address of class A starts with 0. If the address belong to class A, return IP4_ADDR_CLASSA. The address of class B starts with 10. @@ -404,17 +410,16 @@ NetGetIpClass ( /** Check whether the IP is a valid unicast address according to - the netmask. If NetMask is zero, use the IP address's class to get the default mask. + the netmask. - If Ip is 0, IP is not a valid unicast address. - Class D address is used for multicasting and class E address is reserved for future. If Ip - belongs to class D or class E, Ip is not a valid unicast address. - If all bits of the host address of Ip are 0 or 1, Ip is not a valid unicast address. + ASSERT if NetMask is zero. + + If all bits of the host address of IP are 0 or 1, IP is also not a valid unicast address. @param[in] IpThe IP to check against. @param[in] NetMask The mask of the IP. - @return TRUE if Ip is a valid unicast address on the network, otherwise FALSE. + @return TRUE if IP is a valid unicast address on the network, otherwise FALSE. **/ BOOLEAN diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c index 148bebf..f520845 100644 --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c @@ -580,6 +580,11 @@ NetGetMaskLength ( Return the class of the IP address, such as class A, B, C. Addr is in host byte order. + [ATTENTION] + Classful addressing (IP class A/B/C) has been deprecated according to RFC4632. + Caller of this function could only check the returned value against + IP4_ADDR_CLASSD (multicast) or IP4_ADDR_CLASSE (reserved) now. + The address of class A starts with 0. If the address belong to class A, return IP4_ADDR_CLASSA. The address of class B starts with 10. @@ -628,11 +633,10 @@ NetGetIpClass ( /** Check whether the IP is a valid unicast address according to - the netmask. If NetMask is zero, use the IP address's class to get the default mask. + the netmask. - If Ip is 0, IP is not a valid unicast address. - Class D address is used for multicasting and class E address is reserved for future. If Ip - belongs to class D or class E, IP is not a valid unicast address. + ASSERT if NetMask is zero. + If all bits of the host address of IP are 0 or 1, IP is also not a valid unicast address. @param[in] IpThe IP to check against. @@ -648,18 +652,12 @@ NetIp4IsUnicast (
[edk2] [PATCH v2 3/3] NetworkPkg: Update IP4 stack drivers for classless address unicast check.
V2 update: Keep the zero address and broadcast check if network mask is not available. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Zhang Lubo <lubo.zh...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> --- NetworkPkg/IScsiDxe/IScsiConfig.c | 16 ++ NetworkPkg/TcpDxe/TcpMain.c| 6 ++--- NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c| 40 +++--- NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 4 +++- 4 files changed, 45 insertions(+), 21 deletions(-) diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c b/NetworkPkg/IScsiDxe/IScsiConfig.c index 16a90a6..57571ad 100644 --- a/NetworkPkg/IScsiDxe/IScsiConfig.c +++ b/NetworkPkg/IScsiDxe/IScsiConfig.c @@ -164,7 +164,10 @@ IpIsUnicast ( ) { if (IpMode == IP_MODE_IP4) { -return NetIp4IsUnicast (NTOHL (Ip->Addr[0]), 0); +if (IP4_IS_UNSPECIFIED (NTOHL (Ip->Addr[0])) || IP4_IS_LOCAL_BROADCAST (NTOHL (Ip->Addr[0]))) { + return FALSE; +} +return TRUE; } else if (IpMode == IP_MODE_IP6) { return NetIp6IsValidUnicast (>v6); } else { @@ -2349,7 +2352,9 @@ IScsiFormCallback ( case KEY_LOCAL_IP: Status = NetLibStrToIp4 (IfrNvData->LocalIp, ); - if (EFI_ERROR (Status) || !NetIp4IsUnicast (NTOHL (HostIp.Addr[0]), 0)) { + if (EFI_ERROR (Status) || + ((Private->Current->SessionConfigData.SubnetMask.Addr[0] != 0) && + !NetIp4IsUnicast (NTOHL (HostIp.Addr[0]), NTOHL(*(UINT32*)Private->Current->SessionConfigData.SubnetMask.Addr { CreatePopUp ( EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, , @@ -2383,7 +2388,10 @@ IScsiFormCallback ( case KEY_GATE_WAY: Status = NetLibStrToIp4 (IfrNvData->Gateway, ); - if (EFI_ERROR (Status) || ((Gateway.Addr[0] != 0) && !NetIp4IsUnicast (NTOHL (Gateway.Addr[0]), 0))) { + if (EFI_ERROR (Status) || + ((Gateway.Addr[0] != 0) && + (Private->Current->SessionConfigData.SubnetMask.Addr[0] != 0) && + !NetIp4IsUnicast (NTOHL (Gateway.Addr[0]), NTOHL(*(UINT32*)Private->Current->SessionConfigData.SubnetMask.Addr { CreatePopUp ( EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, , @@ -2400,7 +2408,7 @@ IScsiFormCallback ( case KEY_TARGET_IP: UnicodeStrToAsciiStrS (IfrNvData->TargetIp, IpString, sizeof (IpString)); Status = IScsiAsciiStrToIp (IpString, IfrNvData->IpMode, ); - if (EFI_ERROR (Status) || !IpIsUnicast (, IfrNvData->IpMode)) { + if (EFI_ERROR (Status) || IP4_IS_LOCAL_BROADCAST (EFI_NTOHL(HostIp.v4)) || IP4_IS_UNSPECIFIED (EFI_NTOHL(HostIp.v4))) { CreatePopUp ( EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, , diff --git a/NetworkPkg/TcpDxe/TcpMain.c b/NetworkPkg/TcpDxe/TcpMain.c index 96a295a..03942ee 100644 --- a/NetworkPkg/TcpDxe/TcpMain.c +++ b/NetworkPkg/TcpDxe/TcpMain.c @@ -147,10 +147,10 @@ Tcp4Configure ( if (NULL != TcpConfigData) { CopyMem (, >AccessPoint.RemoteAddress, sizeof (IP4_ADDR)); -if ((Ip != 0) && !NetIp4IsUnicast (NTOHL (Ip), 0)) { +if (IP4_IS_LOCAL_BROADCAST (NTOHL (Ip))) { return EFI_INVALID_PARAMETER; } - + if (TcpConfigData->AccessPoint.ActiveFlag && (0 == TcpConfigData->AccessPoint.RemotePort || (Ip == 0))) { return EFI_INVALID_PARAMETER; } @@ -159,7 +159,7 @@ Tcp4Configure ( CopyMem (, >AccessPoint.StationAddress, sizeof (IP4_ADDR)); CopyMem (, >AccessPoint.SubnetMask, sizeof (IP4_ADDR)); - if (!NetIp4IsUnicast (NTOHL (Ip), 0) || !IP4_IS_VALID_NETMASK (NTOHL (SubnetMask))) { + if (!IP4_IS_VALID_NETMASK (NTOHL (SubnetMask)) || !NetIp4IsUnicast (NTOHL (Ip), NTOHL (SubnetMask))) { return EFI_INVALID_PARAMETER; } } diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c index c7c5bd6..52095c5 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c @@ -856,8 +856,7 @@ EfiPxeBcMtftp ( (BufferSize == NULL) || (ServerIp == NULL) || ((BufferPtr == NULL) && DontUseBuffer) || - ((BlockSize != NULL) && (*BlockSize < PXE_MTFTP_DEFAULT_BLOCK_SIZE)) || - (!NetIp4IsUnicast (NTOHL (ServerIp->Addr[0]), 0) && !NetIp6IsValidUnicast (>v6))) { + ((BlockSize != NULL) && (*BlockSize < PXE_MTFTP_DEFAULT_BLOCK_SIZE))) { return EFI_INVALID_PARAMETER; } @@ -867,6 +866,16 @@ EfiPxeBcMtftp ( Mode = Private->PxeBc.Mode; if (Mode->UsingIpv6) { +if (!NetIp6IsValidUnicast (>v6)) { + return EFI_INVALID_PARAMETER; +} + } else { +if (IP4_IS_UNSPECIFIED (NTOHL (ServerIp->Addr[0])) || IP4_IS_LOCAL_BROADCAST (NTOHL (ServerIp->Addr[0]))) { +
[edk2] [PATCH v2 2/3] MdeModulePkg: Update IP4 stack drivers for classless address unicast check.
V2 update: Keep the zero address and broadcast check if network mask is not available. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Zhang Lubo <lubo.zh...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> --- MdeModulePkg/Include/Library/IpIoLib.h | 4 +++- MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c | 9 ++- MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c| 4 ++-- .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 28 +++--- MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c | 6 + .../Universal/Network/IScsiDxe/IScsiConfig.c | 15 .../Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 9 --- .../Universal/Network/Ip4Dxe/Ip4Config2Nv.c| 24 +-- MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c | 7 +- .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c | 8 ++- MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.c | 6 ++--- MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c | 9 +-- MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c | 8 +++ .../Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 24 --- 14 files changed, 75 insertions(+), 86 deletions(-) diff --git a/MdeModulePkg/Include/Library/IpIoLib.h b/MdeModulePkg/Include/Library/IpIoLib.h index 37cba07..aab0c68 100644 --- a/MdeModulePkg/Include/Library/IpIoLib.h +++ b/MdeModulePkg/Include/Library/IpIoLib.h @@ -2,7 +2,7 @@ This library is only intended to be used by UEFI network stack modules. It provides the combined IpIo layer on the EFI IP4 Protocol and EFI IP6 protocol. -Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved. +Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License that accompanies this distribution. The full text of the license may be found at @@ -261,6 +261,8 @@ typedef struct _IP_IO { PKT_RCVD_NOTIFY PktRcvdNotify; ///< See IP_IO_OPEN_DATA::PktRcvdNotify. PKT_SENT_NOTIFY PktSentNotify; ///< See IP_IO_OPEN_DATA::PktSentNotify. UINT8 IpVersion; + IP4_ADDR StationIp; + IP4_ADDR SubnetMask; } IP_IO; /// diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c index 27fef71..9a70e90 100644 --- a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c +++ b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c @@ -1029,7 +1029,9 @@ IpIoListenHandlerDpc ( if (IpIo->IpVersion == IP_VERSION_4) { if ((EFI_IP4 (RxData->Ip4RxData.Header->SourceAddress) != 0) && -!NetIp4IsUnicast (EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) RxData)->Header->SourceAddress), 0)) { +(IpIo->SubnetMask != 0) && +IP4_NET_EQUAL (IpIo->StationIp, EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) RxData)->Header->SourceAddress), IpIo->SubnetMask) && +!NetIp4IsUnicast (EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) RxData)->Header->SourceAddress), IpIo->SubnetMask)) { // // The source address is not zero and it's not a unicast IP address, discard it. // @@ -1300,6 +1302,11 @@ IpIoOpen ( if (OpenData->IpConfigData.Ip4CfgData.RawData) { return EFI_UNSUPPORTED; } + +if (!OpenData->IpConfigData.Ip4CfgData.UseDefaultAddress) { + IpIo->StationIp = EFI_NTOHL (OpenData->IpConfigData.Ip4CfgData.StationAddress); + IpIo->SubnetMask = EFI_NTOHL (OpenData->IpConfigData.Ip4CfgData.SubnetMask); +} Status = IpIo->Ip.Ip4->Configure ( IpIo->Ip.Ip4, diff --git a/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c b/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c index afe4929..a02de20 100644 --- a/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c +++ b/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c @@ -943,9 +943,9 @@ ArpConfigureInstance ( if (ConfigData->SwAddressType == IPV4_ETHER_PROTO_TYPE) { CopyMem (, ConfigData->StationAddress, sizeof (IP4_ADDR)); -if (!NetIp4IsUnicast (NTOHL (Ip), 0)) { +if (IP4_IS_UNSPECIFIED (Ip) || IP4_IS_LOCAL_BROADCAST (Ip)) { // - // The station address is not a valid IPv4 unicast address. + // The station address should not be zero or broadcast address. // return EFI_INVALID_PARAMETER; } diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c index 79f7cde..11a536d 100644 --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c @@ -660,9 +660,7 @@ EfiDhcp4Co
[edk2] [PATCH v2 0/3] classless address network unicast check
V2 update: Keep the zero address and broadcast check if network mask is not available. The classful addressing (IP class A/B/C) has been deprecated according to RFC4632. This patch updates the NetLib and network drivers for the unicast check in classless network. Fu Siyuan (3): MdeModulePkg: Update NetLib interface to support classless addressing. MdeModulePkg: Update IP4 stack drivers for classless address unicast check. NetworkPkg: Update IP4 stack drivers for classless address unicast check. MdeModulePkg/Include/Library/IpIoLib.h | 4 ++- MdeModulePkg/Include/Library/NetLib.h | 23 - MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c | 9 - MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 26 +++--- MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c| 4 +-- .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 28 ++- MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c | 6 +--- .../Universal/Network/IScsiDxe/IScsiConfig.c | 15 +--- .../Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 9 +++-- .../Universal/Network/Ip4Dxe/Ip4Config2Nv.c| 24 ++--- MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c | 7 +--- .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c | 8 ++--- MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.c | 6 ++-- MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c | 9 +++-- MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c | 8 ++--- .../Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 24 - NetworkPkg/IScsiDxe/IScsiConfig.c | 16 ++--- NetworkPkg/TcpDxe/TcpMain.c| 6 ++-- NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c| 40 +++--- NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 4 ++- 20 files changed, 146 insertions(+), 130 deletions(-) -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch 2/3] MdeModulePkg: Update IP4 stack drivers for classless address unicast check.
Hi, Ting Yes you are right, I have made the v2 patch to keep the zero address and broadcast address check, thanks. BestRegards Fu Siyuan > -Original Message- > From: Ye, Ting > Sent: Thursday, October 27, 2016 3:18 PM > To: Fu, Siyuan <siyuan...@intel.com>; edk2-devel@lists.01.org > Cc: Zhang, Lubo <lubo.zh...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com> > Subject: RE: [edk2] [Patch 2/3] MdeModulePkg: Update IP4 stack drivers for > classless address unicast check. > > Hi Siyuan, > > When checking IPv4 address without subnet mask, do you think we need keep > ALL-ZERO address check? I see the patch removes all checking, for example, > when user input local IP/Gateway from UI in Ip4Config2Nv.c. > > Best Regards, > Ye Ting > > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Fu > Siyuan > Sent: Thursday, October 27, 2016 9:29 AM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com>; Wu, > Jiaxin <jiaxin...@intel.com> > Subject: [edk2] [Patch 2/3] MdeModulePkg: Update IP4 stack drivers for > classless address unicast check. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Fu Siyuan <siyuan...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Zhang Lubo <lubo.zh...@intel.com> > Cc: Wu Jiaxin <jiaxin...@intel.com> > --- > MdeModulePkg/Include/Library/IpIoLib.h | 4 ++- > MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c | 9 ++- > MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c| 7 - > .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 29 ++--- > > MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c | 6 + > .../Universal/Network/IScsiDxe/IScsiConfig.c | 18 ++--- > .../Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 15 +++ > .../Universal/Network/Ip4Dxe/Ip4Config2Nv.c| 30 - > - > MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c | 7 + > .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c | 9 +-- > MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.c | 7 ++--- > MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c | 9 +-- > MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c | 5 ++-- > .../Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 27 + > -- > 14 files changed, 61 insertions(+), 121 deletions(-) > > diff --git a/MdeModulePkg/Include/Library/IpIoLib.h > b/MdeModulePkg/Include/Library/IpIoLib.h > index 37cba07..aab0c68 100644 > --- a/MdeModulePkg/Include/Library/IpIoLib.h > +++ b/MdeModulePkg/Include/Library/IpIoLib.h > @@ -2,7 +2,7 @@ >This library is only intended to be used by UEFI network stack modules. >It provides the combined IpIo layer on the EFI IP4 Protocol and EFI IP6 > protocol. > > -Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved. > +Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved. > This program and the accompanying materials are licensed and made > available under the terms and conditions of the BSD License that > accompanies this distribution. > The full text of the license may be found at @@ -261,6 +261,8 @@ typedef > struct _IP_IO { >PKT_RCVD_NOTIFY PktRcvdNotify; ///< See > IP_IO_OPEN_DATA::PktRcvdNotify. >PKT_SENT_NOTIFY PktSentNotify; ///< See > IP_IO_OPEN_DATA::PktSentNotify. >UINT8 IpVersion; > + IP4_ADDR StationIp; > + IP4_ADDR SubnetMask; > } IP_IO; > > /// > diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c > b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c > index ab4df80..d4e9dc1 100644 > --- a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c > +++ b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c > @@ -1029,7 +1029,9 @@ IpIoListenHandlerDpc ( > >if (IpIo->IpVersion == IP_VERSION_4) { > if ((EFI_IP4 (RxData->Ip4RxData.Header->SourceAddress) != 0) && > -!NetIp4IsUnicast (EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) RxData)- > >Header->SourceAddress), 0)) { > +(IpIo->SubnetMask != 0) && > +IP4_NET_EQUAL (IpIo->StationIp, EFI_NTOHL (((EFI_IP4_RECEIVE_DATA > *) RxData)->Header->SourceAddress), IpIo->SubnetMask) && > +!NetIp4IsUnicast (EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) > + RxData)->Header->SourceAddress), IpIo->SubnetMask)) { >// >// The source address is not zero and it's not a unicast IP address, > discard it. >// > @@ -1300,6 +1302,11 @@ IpIoOpen ( > i
Re: [edk2] [PATCH 23/33] NetworkPkg: Fix typos in comments
NetworkPkg patch committed d1c85a17fa8623e3fe60a6fe398f01e46d427a96 BestRegards Fu Siyuan > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Gary Lin > Sent: Wednesday, October 19, 2016 3:01 PM > To: edk2-devel@lists.01.org > Cc: Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com> > Subject: [edk2] [PATCH 23/33] NetworkPkg: Fix typos in comments > > - assocated -> associated > - malformated -> malformatted > - mal-formated -> mal-formatted > - formated -> formatted > - octects -> octets > - responsiblity -> responsibility > - enought -> enough > - immediatly -> immediately > - integar -> integer > - Alogrithem -> Algorithm > - Initializeion -> Initialization > - primelenght -> primelength > - Vlaue -> Value > - perfoms -> performs > - randome -> random > - verifed -> verified > - finallization -> finalization > - Intializes -> Initializes > - specifed -> specified > - if -> If > - Decrption -> Decryption > - Autahentication -> Authentication > - informatino -> information > - alogrithm -> algorithm > - Authenticaion -> Authentication > - Alogrithem -> Algorithm > - containning -> containing > - paramter -> parameter > > Cc: Siyuan Fu <siyuan...@intel.com> > Cc: Jiaxin Wu <jiaxin...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Gary Lin <g...@suse.com> > --- > NetworkPkg/Application/Ping6/Ping6.c | 8 +-- > NetworkPkg/IScsiDxe/IScsiProto.c | 4 +- > NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c| 2 +- > NetworkPkg/Ip6Dxe/Ip6Option.c| 16 ++--- > NetworkPkg/Ip6Dxe/Ip6Option.h| 10 +-- > NetworkPkg/Ip6Dxe/Ip6Output.c| 8 +-- > NetworkPkg/IpSecDxe/IpSecCryptIo.c | 50 +++ > NetworkPkg/IpSecDxe/IpSecCryptIo.h | 66 ++-- > 8 files changed, 82 insertions(+), 82 deletions(-) > > diff --git a/NetworkPkg/Application/Ping6/Ping6.c > b/NetworkPkg/Application/Ping6/Ping6.c > index 55314e5..66daac2 100644 > --- a/NetworkPkg/Application/Ping6/Ping6.c > +++ b/NetworkPkg/Application/Ping6/Ping6.c > @@ -1103,7 +1103,7 @@ InitializePing6 ( >BufferSize = 16; > >// > - // Parse the paramter of count number. > + // Parse the parameter of count number. >// >ValueStr = ShellCommandLineGetValue (ParamPackage, L"-n"); >ValueStrPtr = ValueStr; > @@ -1120,7 +1120,7 @@ InitializePing6 ( > } >} >// > - // Parse the paramter of buffer size. > + // Parse the parameter of buffer size. >// >ValueStr = ShellCommandLineGetValue (ParamPackage, L"-l"); >ValueStrPtr = ValueStr; > @@ -1141,7 +1141,7 @@ InitializePing6 ( >ZeroMem (, sizeof (EFI_IPv6_ADDRESS)); > >// > - // Parse the paramter of source ip address. > + // Parse the parameter of source ip address. >// >ValueStr = ShellCommandLineGetValue (ParamPackage, L"-s"); >ValueStrPtr = ValueStr; > @@ -1155,7 +1155,7 @@ InitializePing6 ( > } >} >// > - // Parse the paramter of destination ip address. > + // Parse the parameter of destination ip address. >// >NonOptionCount = ShellCommandLineGetCount(ParamPackage); >ValueStr = ShellCommandLineGetRawValue (ParamPackage, > (UINT32)(NonOptionCount-1)); > diff --git a/NetworkPkg/IScsiDxe/IScsiProto.c > b/NetworkPkg/IScsiDxe/IScsiProto.c > index 88d9bdd..eb77d75 100644 > --- a/NetworkPkg/IScsiDxe/IScsiProto.c > +++ b/NetworkPkg/IScsiDxe/IScsiProto.c > @@ -786,7 +786,7 @@ IScsiPrepareLoginReq ( > >case ISCSI_LOGIN_OPERATIONAL_NEGOTIATION: > // > -// Only negotiate the paramter once. > +// Only negotiate the parameter once. > // > if (!Conn->ParamNegotiated) { >IScsiFillOpParams (Conn, Nbuf); > @@ -2117,7 +2117,7 @@ IScsiNewDataSegment ( > >@param[in] Packet The EXT SCSI PASS THRU request packet containing the > SCSI command. >@param[in] LunThe LUN. > - @param[in] TcbThe tcb assocated with this SCSI command. > + @param[in] TcbThe tcb associated with this SCSI command. > >@return The created iSCSI SCSI command PDU. >@retval NULL Other errors as indicated. > diff --git a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c > b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c > index 75ecec1..9b6a62e 100644 > --- a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c > +++ b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c > @@ -121,7 +121,7 @@ Ip6ConfigOnPolicyChanged ( > >if (NewPolicy == Ip6ConfigPolicyAutomatic) { > // > -// Set paramters to tr
Re: [edk2] [patch] NetworkPkg: Add error handling logic when using AllocateZeorPool
Reviewed-by: Fu Siyuan siyuan...@intel.com > -Original Message- > From: Zhang, Lubo > Sent: Thursday, October 27, 2016 3:41 PM > To: edk2-devel@lists.01.org > Cc: Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com> > Subject: [patch] NetworkPkg: Add error handling logic when using > AllocateZeorPool > > Add error handling logic if failed to apply new memory. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Zhang Lubo <lubo.zh...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Wu Jiaxin <jiaxin...@intel.com> > --- > NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c | 8 ++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c > b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c > index 45377e3..eba8e1d 100644 > --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c > +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c > @@ -1296,12 +1296,13 @@ PxeBcSelectDhcp6Offer ( > /** >Handle the DHCPv6 offer packet. > >@param[in] Private The pointer to PXEBC_PRIVATE_DATA. > > - @retval EFI_SUCCESS Handled the DHCPv6 offer packet > successfully. > - @retval EFI_NO_RESPONSE No response to the following request > packet. > + @retval EFI_SUCCESS Handled the DHCPv6 offer packet > successfully. > + @retval EFI_NO_RESPONSE No response to the following request > packet. > + @retval EFI_OUT_OF_RESOURCES Failed to allocate resources. > > **/ > EFI_STATUS > PxeBcHandleDhcp6Offer ( >IN PXEBC_PRIVATE_DATA*Private > @@ -1323,10 +1324,13 @@ PxeBcHandleDhcp6Offer ( >// >// First try to cache DNS server address if DHCP6 offer provides. >// >if (Cache6->OptList[PXEBC_DHCP6_IDX_DNS_SERVER] != NULL) { > Private->DnsServer = AllocateZeroPool (NTOHS (Cache6- > >OptList[PXEBC_DHCP6_IDX_DNS_SERVER]->OpLen)); > +if (Private->DnsServer == NULL) { > + return EFI_OUT_OF_RESOURCES; > +} > CopyMem (Private->DnsServer, Cache6- > >OptList[PXEBC_DHCP6_IDX_DNS_SERVER]->Data, sizeof (EFI_IPv6_ADDRESS)); >} > >if (Cache6->OfferType == PxeOfferTypeDhcpBinl) { > // > -- > 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [patch] ShellPkg: update ping6 to use timer service instead of timer arch protocol .
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: Zhang, Lubo > Sent: Tuesday, November 8, 2016 7:08 PM > To: edk2-devel@lists.01.org > Cc: Ni, Ruiyu <ruiyu...@intel.com>; Ye, Ting <ting...@intel.com>; Fu, > Siyuan <siyuan...@intel.com> > Subject: [patch] ShellPkg: update ping6 to use timer service instead of > timer arch protocol . > > This patch update the shell ping command to use timer service to calculate > the > RTT time, instead of using the timer arch protocol. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Zhang Lubo <lubo.zh...@intel.com> > Cc: Ni Ruiyu <ruiyu...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > --- > .../Library/UefiShellNetwork2CommandsLib/Ping6.c | 241 ++-- > - > .../UefiShellNetwork2CommandsLib.inf | 1 + > .../UefiShellNetwork2CommandsLib.uni | 4 +- > 3 files changed, 170 insertions(+), 76 deletions(-) > > diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c > b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c > index 90a2604..a30c064 100644 > --- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c > +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c > @@ -17,45 +17,44 @@ > > #define PING6_DEFAULT_TIMEOUT 5000 > #define PING6_MAX_SEND_NUMBER 1 > #define PING6_MAX_BUFFER_SIZE 32768 > #define PING6_ONE_SECOND 1000 > - > -// > -// A similar amount of time that passes in femtoseconds > -// for each increment of TimerValue. It is for NT32 only. > -// > -#define NTTIMERPERIOD358049 > +#define STALL_1_MILLI_SECOND 1000 > > #pragma pack(1) > > typedef struct _ICMP6_ECHO_REQUEST_REPLY { >UINT8 Type; >UINT8 Code; >UINT16 Checksum; >UINT16 Identifier; >UINT16 SequenceNum; > - UINT64 TimeStamp; > + UINT32 TimeStamp; >UINT8 Data[1]; > } ICMP6_ECHO_REQUEST_REPLY; > > #pragma pack() > > typedef struct _PING6_ICMP6_TX_INFO { >LIST_ENTRY Link; >UINT16 SequenceNum; > - UINT64 TimeStamp; > + UINT32 TimeStamp; >EFI_IP6_COMPLETION_TOKEN*Token; > } PING6_ICMP6_TX_INFO; > > typedef struct _PING6_PRIVATE_DATA { >EFI_HANDLE ImageHandle; >EFI_HANDLE NicHandle; >EFI_HANDLE Ip6ChildHandle; >EFI_IP6_PROTOCOL*Ip6; >EFI_EVENT Timer; > > + UINT32 TimerPeriod; > + UINT32 RttTimerTick; > + EFI_EVENT RttTimer; > + >EFI_STATUS Status; >LIST_ENTRY TxList; >EFI_IP6_COMPLETION_TOKENRxToken; >UINT16 RxCount; >UINT16 TxCount; > @@ -97,100 +96,193 @@ SHELL_PARAM_ITEMPing6ParamList[] = { > // > // Global Variables in Ping6 application. > // > CONST CHAR16*mIp6DstString; > CONST CHAR16*mIp6SrcString; > -UINT64 mFrequency = 0; > -UINT64 mIp6CurrentTick = 0; > EFI_CPU_ARCH_PROTOCOL *Cpu = NULL; > > +/** > + RTT timer tick routine. > > + @param[in]EventA EFI_EVENT type event. > + @param[in]Context The pointer to Context. > + > +**/ > +VOID > +EFIAPI > +Ping6RttTimerTickRoutine ( > + IN EFI_EVENTEvent, > + IN VOID *Context > + ) > +{ > + UINT32 *RttTimerTick; > + > + RttTimerTick = (UINT32*) Context; > + (*RttTimerTick)++; > +} > > /** > - Reads and returns the current value of the Time. > + Get the timer period of the system. > + > + This function tries to get the system timer period by creating > + an 1ms period timer. > > - @return The current tick value. > + @return System timer period in MS, or 0 if operation failed. > > **/ > -UINT64 > -Ping6ReadTime () > +UINT32 > +Ping6GetTimerPeriod( > + VOID > + ) > { > - UINT64 TimerPeriod; > - EFI_STATUS Status; > + EFI_STATUS Status; > + UINT32 RttTimerTick; > + EFI_EVENT TimerEvent; > + UINT32 StallCounter; > + EFI_TPLOldTpl; > > - ASSERT (Cpu != NULL); > + R
Re: [edk2] [Patch] ShellPkg: update ping to use timer service instead of timer arch protocol .
Hi, Nagaraj The 0~2ms doesn't mean 0.2ms, it means 0 to 2 ms. It's not an accurate time because we are using the timer event service and gBS->Stall to estimate the system timer period, see the new added GetTimerPeriod() function. It first create a period timer with 1ms interval, and use a Stall(1m) to wait in a while loop until the 1ms timer is triggered 10 times, and finally return the estimate system timer period by StallCounter / RttTimerTick. You got "0~2ms" result because you platform may set the timer period to 2ms (or bigger), and the minimum time interval we could count by the timer service is 2ms, so we use 0~2ms, means the reply is arrived within 2ms. The reason we make these change is because the UEFI shell is not allowed to use neither PI protocol nor platform specific library, so there is no standard way to get the real time period only by UEFI service. It's a little tricky, if you have better idea I'm glad to hear that. I will make another patch to fix the ttl print issue, and also the ping6 update. Thanks. BestRegards Fu Siyuan > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Hegde, Nagaraj P > Sent: Wednesday, October 19, 2016 6:38 PM > To: Fu, Siyuan <siyuan...@intel.com>; edk2-devel@lists.01.org > Cc: Ni, Ruiyu <ruiyu...@intel.com>; Ye, Ting <ting...@intel.com>; Zhang, > Lubo <lubo.zh...@intel.com> > Subject: Re: [edk2] [Patch] ShellPkg: update ping to use timer service > instead of timer arch protocol . > > Hi Siyuan, > > Few comments: > > 1. We need the same code change for Ping6 > (ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c) > 2. From the patch that I could view, in STR_PING_REPLY_INFO, we print time > as 0~2ms for 0.2 ms. Why not use "." itself? Any reason for using tild (~)? > 3. We print ttl=%d in STR_PING_REPLY_INFO, which is always 0 for IPv4 Ping. > We need to fix that. > > I have tested your code and looks fine. > > Regards, > Nagaraj. > > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Fu > Siyuan > Sent: Monday, October 17, 2016 11:52 AM > To: edk2-devel@lists.01.org > Cc: Ni Ruiyu <ruiyu...@intel.com>; Ye Ting <ting...@intel.com>; Zhang Lubo > <lubo.zh...@intel.com> > Subject: [edk2] [Patch] ShellPkg: update ping to use timer service instead > of timer arch protocol . > > This patch update the shell ping command to use timer service to calculate > the RTT time, instead of using the timer arch protocol. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Fu Siyuan <siyuan...@intel.com> > Cc: Ni Ruiyu <ruiyu...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Zhang Lubo <lubo.zh...@intel.com> > --- > .../Library/UefiShellNetwork1CommandsLib/Ping.c| 233 +++- > - > .../UefiShellNetwork1CommandsLib.inf | 3 +- > .../UefiShellNetwork1CommandsLib.uni | 4 +- > 3 files changed, 171 insertions(+), 69 deletions(-) > > diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c > b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c > index 38625fe..2e1e878 100644 > --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c > +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c > @@ -86,7 +86,7 @@ typedef struct _ICMPX_ECHO_REQUEST_REPLY { >UINT16 Checksum; >UINT16 Identifier; >UINT16 SequenceNum; > - UINT64 TimeStamp; > + UINT32 TimeStamp; >UINT8 Data[1]; > } ICMPX_ECHO_REQUEST_REPLY; > #pragma pack() > @@ -94,7 +94,7 @@ typedef struct _ICMPX_ECHO_REQUEST_REPLY { typedef > struct _PING_ICMP_TX_INFO { >LIST_ENTRYLink; >UINT16SequenceNum; > - UINT64TimeStamp; > + UINT32TimeStamp; >PING_IPX_COMPLETION_TOKEN *Token; > } PING_ICMPX_TX_INFO; > > @@ -109,6 +109,7 @@ typedef struct _PING_ICMP_TX_INFO { > #define DEFAULT_BUFFER_SIZE 16 > #define ICMP_V4_ECHO_REQUEST 0x8 > #define ICMP_V4_ECHO_REPLY0x0 > +#define STALL_1_MILLI_SECOND 1000 > > #define PING_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('P', 'i', 'n', 'g') > typedef struct _PING_PRIVATE_DATA { @@ -117,6 +118,10 @@ typedef struct > _PING_PRIVATE_DATA { >EFI_HANDLE IpChildHandle; >EFI_EVENT Timer; > > + UINT32 TimerPeriod; > + UINT32 RttTimerTick; > + EFI_EVENT RttTimer; > + >EFI_STATU
Re: [edk2] [patch] NetworkPkg: Support bracketed IPv6 address during a redirection in iSCSI
Reviewed-by: Fu Siyuan siyuan...@intel.com > -Original Message- > From: Zhang, Lubo > Sent: Friday, October 14, 2016 2:45 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, > Jiaxin <jiaxin...@intel.com> > Subject: [patch] NetworkPkg: Support bracketed IPv6 address during a > redirection in iSCSI > > According to RFC 3720, the TargetAddress provided in a redirection > might be a DNS host name, a dotted-decimal IPv4 address, or a > bracketed IPv6 address. Current ISCSI driver in Networkpkg only > supports dotted-decimal IPv4 address, so we need add IPv6 address > support since it is a combo driver supporting dual stack. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Zhang Lubo <lubo.zh...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Wu Jiaxin <jiaxin...@intel.com> > --- > NetworkPkg/IScsiDxe/IScsiProto.c | 51 ++- > - > NetworkPkg/IScsiDxe/IScsiProto.h | 5 +++- > 2 files changed, 43 insertions(+), 13 deletions(-) > > diff --git a/NetworkPkg/IScsiDxe/IScsiProto.c > b/NetworkPkg/IScsiDxe/IScsiProto.c > index 5092365..a9bf491 100644 > --- a/NetworkPkg/IScsiDxe/IScsiProto.c > +++ b/NetworkPkg/IScsiDxe/IScsiProto.c > @@ -1087,26 +1087,53 @@ IScsiUpdateTargetAddress ( > TargetAddress = IScsiGetValueByKeyFromList (KeyValueList, > ISCSI_KEY_TARGET_ADDRESS); > if (TargetAddress == NULL) { >break; > } > > -if (!NET_IS_DIGIT (TargetAddress[0])) { > +// > +// RFC 3720 defines format of the > TargetAddress=domainname[:port][,portal-group-tag] > +// The domainname can be specified as either a DNS host name, > adotted-decimal IPv4 address, > +// or a bracketed IPv6 address as specified in [RFC2732]. > +// > +if (NET_IS_DIGIT (TargetAddress[0])) { >// > - // The domainname of the target may be presented in three formats: > a DNS host name, > - // a dotted-decimal IPv4 address, or a bracketed IPv6 address. Only > accept dotted > - // IPv4 address. > + // The domainname of the target is presented in a dotted-decimal > IPv4 address format. >// > - continue; > -} > - > -IpStr = TargetAddress; > + IpStr = TargetAddress; > > -while ((*TargetAddress != 0) && (*TargetAddress != ':') && > (*TargetAddress != ',')) { > + while ((*TargetAddress != '\0') && (*TargetAddress != ':') && > (*TargetAddress != ',')) { > +// > +// NULL, ':', or ',' ends the IPv4 string. > +// > +TargetAddress++; > + } > + > +} else if (*TargetAddress == ISCSI_REDIRECT_ADDR_START_DELIMITER){ >// > - // NULL, ':', or ',' ends the IPv4 string. > + // The domainname of the target is presented in a bracketed IPv6 > address format. >// > - TargetAddress++; > + TargetAddress ++; > + IpStr = TargetAddress; > + while ((*TargetAddress != '\0') && (*TargetAddress != > ISCSI_REDIRECT_ADDR_END_DELIMITER)) { > +// > +// ']' ends the IPv6 string. > +// > +TargetAddress++; > + } > + > + if (*TargetAddress != ISCSI_REDIRECT_ADDR_END_DELIMITER) { > +continue; > + } > + > + *TargetAddress = '\0'; > + TargetAddress ++; > + > +} else { > + // > + // The domainname of the target is presented in the format of a DNS > host name. > + // Temporary not supported. > + continue; > } > > if (*TargetAddress == ',') { >// >// Comma and the portal group tag MUST be ommitted if the > TargetAddress is sent > @@ -1124,11 +1151,11 @@ IScsiUpdateTargetAddress ( >} else { > Session->ConfigData->SessionConfigData.TargetPort = (UINT16) > Number; >} > } else { >// > - // The string only contains the IPv4 address. Use the well-known > port. > + // The string only contains the Target address. Use the well-known > port. >// >Session->ConfigData->SessionConfigData.TargetPort = > ISCSI_WELL_KNOWN_PORT; > } > // > // Update the target IP address. > diff --git a/NetworkPkg/IScsiDxe/IScsiProto.h > b/NetworkPkg/IScsiDxe/IScsiProto.h > index 8099f34..367914d 100644 > --- a/NetworkPkg/IScsiDxe/IScsiProto.h > +++ b/NetworkPkg/IScsiDxe/IScsiProto.h > @@ -1,9 +1,9 @@ > /** @file >The header file of iSCSI Protocol that defines many specific data > struc
Re: [edk2] [patch] NetworkPkg: Enhance the code in DNS driver.
Reviewed-by: Fu Siyuan siyuan...@intel.com > -Original Message- > From: Zhang, Lubo > Sent: Friday, October 14, 2016 2:54 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, > Jiaxin <jiaxin...@intel.com> > Subject: [patch] NetworkPkg: Enhance the code in DNS driver. > > There may be an error happens when we use the > configure function to set or change the configuration > data for the DNS6 instance, So we will free the > DnsServerList without configured to NULL. If we reset > the instance with the parameter DnsConfigData to NULL, the > DnsServerList will be freed twice. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Zhang Lubo <lubo.zh...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Wu Jiaxin <jiaxin...@intel.com> > --- > NetworkPkg/DnsDxe/DnsProtocol.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/NetworkPkg/DnsDxe/DnsProtocol.c > b/NetworkPkg/DnsDxe/DnsProtocol.c > index 64fca6a..6d117b2 100644 > --- a/NetworkPkg/DnsDxe/DnsProtocol.c > +++ b/NetworkPkg/DnsDxe/DnsProtocol.c > @@ -285,10 +285,11 @@ Dns4Configure ( > // > Status = Dns4ConfigUdp (Instance, Instance->UdpIo); > if (EFI_ERROR (Status)) { >if (Instance->Dns4CfgData.DnsServerList != NULL) { > FreePool (Instance->Dns4CfgData.DnsServerList); > +Instance->Dns4CfgData.DnsServerList = NULL; >} >goto ON_EXIT; > } > > // > @@ -296,10 +297,11 @@ Dns4Configure ( > // > Status = AddDns4ServerIp (>Dns4ServerList, Instance- > >SessionDnsServer.v4); > if (EFI_ERROR (Status)) { >if (Instance->Dns4CfgData.DnsServerList != NULL) { > FreePool (Instance->Dns4CfgData.DnsServerList); > +Instance->Dns4CfgData.DnsServerList = NULL; >} >goto ON_EXIT; > } > > Instance->State = DNS_STATE_CONFIGED; > @@ -1106,10 +1108,11 @@ Dns6Configure ( > // > Status = Dns6ConfigUdp (Instance, Instance->UdpIo); > if (EFI_ERROR (Status)) { >if (Instance->Dns6CfgData.DnsServerList != NULL) { > FreePool (Instance->Dns6CfgData.DnsServerList); > +Instance->Dns6CfgData.DnsServerList = NULL; >} >goto ON_EXIT; > } > > // > @@ -1117,10 +1120,11 @@ Dns6Configure ( > // > Status = AddDns6ServerIp (>Dns6ServerList, Instance- > >SessionDnsServer.v6); > if (EFI_ERROR (Status)) { >if (Instance->Dns6CfgData.DnsServerList != NULL) { > FreePool (Instance->Dns6CfgData.DnsServerList); > +Instance->Dns6CfgData.DnsServerList = NULL; >} >goto ON_EXIT; > } > > Instance->State = DNS_STATE_CONFIGED; > -- > 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [patch] NetworkPkg: Add dns support for pxe boot based on IPv6.
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: Zhang, Lubo > Sent: Friday, October 14, 2016 3:28 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, > Jiaxin <jiaxin...@intel.com> > Subject: [patch] NetworkPkg: Add dns support for pxe boot based on IPv6. > > The BootFileURL option (59) in dhcpv6 is used to deliver > the next server address with bootfile name, as an example > "tftp://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]/BOOTFILE_NAME; > mode=octet", it can also be “tftp://domain_name/BOOTFILE_NAME; > mode=octet”, this patch is to support this case. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Zhang Lubo <lubo.zh...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Wu Jiaxin <jiaxin...@intel.com> > --- > NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c | 18 ++- > NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c | 269 > +++ > NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.h | 5 +- > NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h | 3 + > NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf | 4 +- > 5 files changed, 261 insertions(+), 38 deletions(-) > > diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c > b/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c > index 8eff13c..fc50a82 100644 > --- a/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c > +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c > @@ -619,31 +619,33 @@ PxeBcDhcp6BootInfo ( >} > >ASSERT (Cache6->OptList[PXEBC_DHCP6_IDX_BOOT_FILE_URL] != NULL); > >// > + // Set the station address to IP layer. > + // > + Status = PxeBcSetIp6Address (Private); > + if (EFI_ERROR (Status)) { > +return Status; > + } > + > + > + // >// Parse (m)tftp server ip address and bootfile name. >// >Status = PxeBcExtractBootFileUrl ( > + Private, > >BootFileName, > >ServerIp.v6, > (CHAR8 *) (Cache6->OptList[PXEBC_DHCP6_IDX_BOOT_FILE_URL]- > >Data), > NTOHS (Cache6->OptList[PXEBC_DHCP6_IDX_BOOT_FILE_URL]->OpLen) > ); >if (EFI_ERROR (Status)) { > return Status; >} > >// > - // Set the station address to IP layer. > - // > - Status = PxeBcSetIp6Address (Private); > - if (EFI_ERROR (Status)) { > -return Status; > - } > - > - // >// Parse the value of boot file size. >// >if (Cache6->OptList[PXEBC_DHCP6_IDX_BOOT_FILE_PARAM] != NULL) { > // > // Parse it out if have the boot file parameter option. > diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c > b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c > index 41d3d30..45377e3 100644 > --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c > +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c > @@ -91,14 +91,15 @@ PxeBcBuildDhcp6Options ( > >// >// Append client option request option >// >OptList[Index]->OpCode = HTONS (DHCP6_OPT_ORO); > - OptList[Index]->OpLen = HTONS (4); > + OptList[Index]->OpLen = HTONS (6); >OptEnt.Oro = (PXEBC_DHCP6_OPTION_ORO *) OptList[Index]- > >Data; >OptEnt.Oro->OpCode[0] = HTONS(DHCP6_OPT_BOOT_FILE_URL); >OptEnt.Oro->OpCode[1] = HTONS(DHCP6_OPT_BOOT_FILE_PARAM); > + OptEnt.Oro->OpCode[2] = HTONS(DHCP6_OPT_DNS_SERVERS); >Index++; >OptList[Index] = GET_NEXT_DHCP6_OPTION (OptList[Index - 1]); > >// >// Append client network device interface option > @@ -214,14 +215,177 @@ PxeBcFreeBootFileOption ( > RemoveEntryList (Entry); > FreePool (Node); >} > } > > +/** > + Retrieve the boot server address using the EFI_DNS6_PROTOCOL. > + > + @param[in] Private Pointer to PxeBc private data. > + @param[in] HostNamePointer to buffer containing hostname. > + @param[out] IpAddress On output, pointer to buffer containing > IPv6 address. > + > + @retval EFI_SUCCESS Operation succeeded. > + @retval EFI_OUT_OF_RESOURCESFailed to allocate needed resources. > + @retval EFI_DEVICE_ERRORAn unexpected network error occurred. > + @retval Others Other errors as indicated. > + > +**/ > +EFI_STATUS > +PxeBcDns6 ( > + IN PXEBC_PRIVATE_DATA *Private, > + IN CHAR16 *HostName, > + OUT EFI_IPv6_ADDRESS *IpAddress > + ) > +{ > + EFI_STATUS Status; > + EFI_DNS6_PROTOCOL *Dns6; > + EFI_DNS6_C
Re: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive()
Hi, Naveen I checked the code and found the IP4 stack is actually doesn't support classless IP address now, the main reason is in the NetLib interface NetGetIpClass() and NetIp4IsUnicast(). These 2 interfaces do not consider the netmask so it won't recognize a classless IP configuration. Almost all other network drivers (IP4, ARP, iSCSI, Mtftp, PXE, TCP, UDP) are using these 2 interfaces so I guess they may have the same problem. Please help to submit a ticket in tianocore Bugzilla for this issue, thanks. BestRegards Fu Siyuan From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Santhapur Naveen Sent: Friday, October 14, 2016 3:19 PM To: Wu, Jiaxin <jiaxin...@intel.com>; edk2-devel@lists.01.org Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com> Subject: Re: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Hello Jiaxin, We've run into one more problem with PXE boot. The PXE boot is not happening when the server tries to assign an IP address whose last octet is zero. The below is my configuration: [Server Configuration] Ipv4 address : 192.168.0.1/16 Netmask: 255.255.0.0 DHCPv4 Scope: Range: 192.168.0.2 to 192.168.10.10 Netmask: 255.255.0.0 I've observed that in the given address range, if the server tries to allocate any IP address with the last octet as 0 i.e., for instance 192.168.A.0 where A vary from 1 to 10, then the PXE boot fails saying "PXE-E09: Could not allocate I/O buffers." I agree that the x.y.z.0 and x.y.z.255 are network address any can't be assigned based on the subnet (In this case, 192.168.0.0 and 192.168.255.255). But here, the Netmask is different which expects the IP address x.y.a.0 which is within the range is valid and can be assigned to any client in the network. I captured Wireshark log and as per it, the D.O.R.A process is finished but the client is sending a Decline packet. I suspect the function NetIp4IsUnicast() has a role to play in this. Please provide your comments on this. Best regards, Naveen -Original Message- From: Santhapur Naveen Sent: Friday, September 02, 2016 11:46 AM To: 'Wu, Jiaxin'; 'edk2-devel@lists.01.org' Cc: 'Ye, Ting'; 'Fu, Siyuan' Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Hello Jiaxin, My sincere apologies for the delayed response. I've verified the patch from my side and PXE boot is happening successfully even in classless IP network. May I know whether this will be included in EDK2? If yes, can you please provide any schedule for the same? Best regards, Naveen -Original Message- From: Santhapur Naveen Sent: Thursday, August 18, 2016 11:14 AM To: 'Wu, Jiaxin'; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Cc: Ye, Ting; Fu, Siyuan; Sivaraman Nainar; Madhan B. Santharam Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Jiaxin, We will verify the patch and update you the result. Thanks, Naveen -Original Message- From: Wu, Jiaxin [mailto:jiaxin...@intel.com] Sent: Thursday, August 18, 2016 11:12 AM To: Santhapur Naveen; Wu, Jiaxin; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Cc: Ye, Ting; Fu, Siyuan; Sivaraman Nainar; Madhan B. Santharam Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Naveen, Can you help to verify this patch to support the classless IP. Thanks, Jiaxin > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Jiaxin Wu > Sent: Thursday, August 18, 2016 1:39 PM > To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> > Cc: Ye, Ting <ting...@intel.com<mailto:ting...@intel.com>>; Fu, Siyuan > <siyuan...@intel.com<mailto:siyuan...@intel.com>>; > Santhapur Naveen <nave...@amiindia.co.in<mailto:nave...@amiindia.co.in>> > Subject: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 > TransmitReceive() > > The IP address should not be treated as classful one if DHCP options > contain a classless IP with its true subnet mask. Otherwise, DHCPv4 > TransmitReceive() will failed. This real subnet mask will be parsed > and recorded in DhcpSb->Netmask. So, we need check it before get the > IP's corresponding subnet mask. > > Cc: Santhapur Naveen <nave...@amiindia.co.in<mailto:nave...@amiindia.co.in>> > Cc: Ye Ting <ting...@intel.com<mailto:ting...@intel.com>> > Cc: Fu Siyuan <siyuan...@intel.com<mailto:siyuan...@intel.com>> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin...@intel.com<mailto:jiaxin...@intel.com>> > --- > .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 28 +++- > -- > 1 file changed, 20 insertions(+),
Re: [edk2] [Patch] MdeModulePkg/DxeNetLib: Allow the IPv4/prefix case when AsciiStrToIp4
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Jiaxin Wu > Sent: Friday, November 18, 2016 3:40 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com>; Fu, > Siyuan <siyuan...@intel.com> > Subject: [edk2] [Patch] MdeModulePkg/DxeNetLib: Allow the IPv4/prefix case > when AsciiStrToIp4 > > This patch is used to allow the IPv4 with prefix case. > > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Zhang Lubo <lubo.zh...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> > --- > MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 10 +- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c > b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c > index 04d8345..0804052 100644 > --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c > +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c > @@ -2722,13 +2722,21 @@ NetLibAsciiStrToIp4 ( > >for (Index = 0; Index < 4; Index++) { > TempStr = Ip4Str; > > while ((*Ip4Str != '\0') && (*Ip4Str != '.')) { > - if (!NET_IS_DIGIT (*Ip4Str)) { > + if (Index != 3 && !NET_IS_DIGIT (*Ip4Str)) { > return EFI_INVALID_PARAMETER; >} > + > + // > + // Allow the IPv4 with prefix case, e.g. 192.168.10.10/24 > + // > + if (Index == 3 && !NET_IS_DIGIT (*Ip4Str) && *Ip4Str != '/') { > +return EFI_INVALID_PARAMETER; > + } > + >Ip4Str++; > } > > // > // The IPv4 address is X.X.X.X > -- > 1.9.5.msysgit.1 > > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [staging/HTTPS-TLS][PATCH] Readme.MD: Add the feature support scope
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: Wu, Jiaxin > Sent: Friday, November 25, 2016 11:58 AM > To: edk2-devel@lists.01.org > Cc: Palmer Thomas <thomas.pal...@hpe.com>; Ye, Ting <ting...@intel.com>; > Fu, Siyuan <siyuan...@intel.com>; Long, Qin <qin.l...@intel.com>; Li, Ruth > <ruth...@intel.com>; Zimmer, Vincent <vincent.zim...@intel.com>; Wu, > Jiaxin <jiaxin...@intel.com> > Subject: [staging/HTTPS-TLS][PATCH] Readme.MD: Add the feature support > scope > > This patch is used to add the feature support scope to indicate > the feature completeness criteria, and some contents are also > updated/refined, e.g. Timeline and Feature Verification section. > > Cc: Palmer Thomas <thomas.pal...@hpe.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Long Qin <qin.l...@intel.com> > Cc: Li Ruth <ruth...@intel.com> > Cc: Zimmer Vincent <vincent.zim...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Wu Jiaxin <jiaxin...@intel.com> > --- > Readme.MD | 15 --- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/Readme.MD b/Readme.MD > index a69a2f1..d16eb4c 100644 > --- a/Readme.MD > +++ b/Readme.MD > @@ -33,11 +33,11 @@ NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf > ``` > > HTTPS Authentication > TLS supports three authentication modes > ([RFC5246](https://tools.ietf.org/html/rfc5246)): > ``` > -1. Total anonymity: the server and client won’t authenticate each other. > +1. Total anonymity: the server and client will not authenticate each > other. > 2. One-way authentication: server authentication with an unauthenticated > client. > 3. Two-way authentication: authentication of both parties. > ``` > Currently, HTTPS boot feature only support server authentication with an > unauthenticated client mode. Others are not in our current feature support > scope. To support one-way authentication mode, server CA certificate is > required by Client. Private variable is used to configure this CA > certificate. **EFI_SIGNATURE_LIST** format is used for this variable. In > sum, the Server CA certificate must be configured first to enable HTTPS > boot feature. The variable name and GUID are defined as below. > ``` > @@ -54,20 +54,29 @@ Currently, HTTPS boot feature only support server > authentication with an unauthe > | Time | Event | Related Module | > |::|:-:|:--:| > | 2015.12 | Initial implementation for HTTPS boot feature by leveraging > OpenSSL. | HttpDxe, OpensslTlsLib, TlsLib, TlsDxe | > | 2016.3 | Provided an UI configured driver to support TLS server > authentication. | TlsAuthConfigDxe | > | 2016.4-7 | Hotfix and code refine according community feedback. | > Tls1.h, TlsLib, HttpDxe | > +| 2016.8 | Prevent the CA certificates from the runtime phase attack. | > TlsAuthConfigDxe | > | 2016.9 | Support TLS Version negotiation. | TlsLib, HttpDxe | > |...|...|...| > > +## Feature Support Scope > +*Feature usage: Load the specified file from the remote HTTPS server > successfully and steadily. > +* UEFI Arch: IA32 and X64 platform. > +*TLS version: TLS1.0/1.1/1.2, version negotiation. > +*HTTPS authentication mode: One-way authentication. > +*CA certificates management: Private variable, prevent runtime phase > attack. > + > ## Feature Verification > -Tomcat and IIS8 are selected as the HTTPS server to verifiy the result, > Detiled see below table. > +Tomcat, IIS 8 and Apache2 are selected as the HTTPS server to verify the > result of loading the UEFI shell boot file (Shell.efi), detailed see below > table. > > | HTTPS Server | TLS 1.0 | TLS 1.1 | TLS1.2 | > |::|:---:|:---:|:--:| > |Tomcat | Pass |Pass | Pass | > -|IIS8 | Pass | Pass | Failure | > +|IIS 8 | Pass | Pass | Failure | > +|Apache2 | Pass | Pass | Pass | > > ### NOTES > TLS version 1.2 in windows server 2012 R2 IIS8 (As HTTPS server) CAN NOT > collaborate with UEFI HTTPS client while version 1.1/1.0 works well. To > make the UEFI HTTPS client in staging works properly, we have to disable > TLS version 1.2 in windows server 2012 R2 by the below PowerShell script: > ``` > New-Item > 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protoco > ls\TLS 1.2\Server' -Force | Out-Null > -- > 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] MdeModulePkg/NetLib: Handle an invalid IPv6 address case
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: Wu, Jiaxin > Sent: Friday, November 25, 2016 2:16 PM > To: edk2-devel@lists.01.org > Cc: Zhang, Lubo <lubo.zh...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; > Ye, Ting <ting...@intel.com> > Subject: [Patch] MdeModulePkg/NetLib: Handle an invalid IPv6 address case > > Handle an invalid IPv6 address in NetLibAsciiStrToIp6(), > like '2000:::1com'. > > Cc: Zhang Lubo <lubo.zh...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> > --- > MdeModulePkg/Include/Library/NetLib.h | 1 + > MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 11 +++ > 2 files changed, 12 insertions(+) > > diff --git a/MdeModulePkg/Include/Library/NetLib.h > b/MdeModulePkg/Include/Library/NetLib.h > index 26709af..09ead09 100644 > --- a/MdeModulePkg/Include/Library/NetLib.h > +++ b/MdeModulePkg/Include/Library/NetLib.h > @@ -521,10 +521,11 @@ extern IP4_ADDR gIp4AllMasks[IP4_MASK_NUM]; > > > extern EFI_IPv4_ADDRESS mZeroIp4Addr; > > #define NET_IS_DIGIT(Ch)(('0' <= (Ch)) && ((Ch) <= '9')) > +#define NET_IS_HEX(Ch) ((('0' <= (Ch)) && ((Ch) <= '9')) || > (('A' <= (Ch)) && ((Ch) <= 'F')) || (('a' <= (Ch)) && ((Ch) <= 'f'))) > #define NET_ROUNDUP(size, unit) (((size) + (unit) - 1) & (~((unit) - > 1))) > #define NET_IS_LOWER_CASE_CHAR(Ch) (('a' <= (Ch)) && ((Ch) <= 'z')) > #define NET_IS_UPPER_CASE_CHAR(Ch) (('A' <= (Ch)) && ((Ch) <= 'Z')) > > #define TICKS_PER_MS1U > diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c > b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c > index 0804052..0a7117c 100644 > --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c > +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c > @@ -2830,10 +2830,21 @@ NetLibAsciiStrToIp6 ( > >for (Index = 0; Index < 15; Index = (UINT8) (Index + 2)) { > TempStr = Ip6Str; > > while ((*Ip6Str != '\0') && (*Ip6Str != ':')) { > + if (Index != 14 && !NET_IS_HEX (*Ip6Str)) { > +return EFI_INVALID_PARAMETER; > + } > + > + // > + // Allow the IPv6 with prefix case, e.g. 2000:::10/24 > + // > + if (Index == 14 && !NET_IS_HEX (*Ip6Str) && *Ip6Str != '/') { > +return EFI_INVALID_PARAMETER; > + } > + >Ip6Str++; > } > > if ((*Ip6Str == '\0') && (Index != 14)) { >return EFI_INVALID_PARAMETER; > -- > 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [patch] ShellPkg: Add error prompt message in Ifconfig6 command.
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Zhang Lubo > Sent: Monday, November 28, 2016 1:43 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, > Jiaxin <jiaxin...@intel.com> > Subject: [edk2] [patch] ShellPkg: Add error prompt message in Ifconfig6 > command. > > It should display error prompt message when Ifconfig6 can > not configure correctly. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Zhang Lubo <lubo.zh...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Wu Jiaxin <jiaxin...@intel.com> > --- > ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c | 15 > +++ > .../UefiShellNetwork2CommandsLib.uni | 9 + > 2 files changed, 24 insertions(+) > > diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c > b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c > index 32dd284..fb308cc 100644 > --- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c > +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c > @@ -1315,10 +1315,24 @@ IfConfig6SetInterfaceInfo ( > goto ON_EXIT; >} > >VarArg= VarArg->Next; > > + if (StrCmp (VarArg->Arg, L"host") == 0) { > +ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_IFCONFIG6_ERR_INVALID_IP_CONFIG), gShellNetwork2HiiHandle, Status); > +ShellStatus = EFI_INVALID_PARAMETER; > +goto ON_EXIT; > + } else if (StrCmp (VarArg->Arg, L"gw") == 0) { > +ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_IFCONFIG6_ERR_INVALID_GW_CONFIG), gShellNetwork2HiiHandle, Status); > +ShellStatus = EFI_INVALID_PARAMETER; > +goto ON_EXIT; > + } else if (StrCmp (VarArg->Arg, L"dns") == 0) { > +ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_IFCONFIG6_ERR_INVALID_DNS_CONFIG), gShellNetwork2HiiHandle, Status); > +ShellStatus = EFI_INVALID_PARAMETER; > +goto ON_EXIT; > + } > + > } else if (StrCmp (VarArg->Arg, L"man") == 0) { >// >// Set manual config policy. >// >Policy = Ip6ConfigPolicyManual; > @@ -1509,10 +1523,11 @@ IfConfig6SetInterfaceInfo ( >CfgAddr >); > >if (EFI_ERROR (Status)) { > ShellStatus = SHELL_ACCESS_DENIED; > +ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_IFCONFIG6_ERR_MAN_GW), gShellNetwork2HiiHandle, Status); > goto ON_EXIT; >} > > } else if (StrCmp (VarArg->Arg, L"dns") == 0) { >// > diff --git > a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsL > ib.uni > b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsL > ib.uni > index c3445bb..66ff05c 100644 > --- > a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsL > ib.uni > +++ > b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsL > ib.uni > @@ -75,10 +75,19 @@ > #string STR_IFCONFIG6_ERR_LACK_ARGUMENTS #language en-US"Lack > arguments. Bad command %H%s%N is skipped.\r\n" >"Hint: > Please type 'IfConfig6 -?' for help info.\r\n" > #string STR_IFCONFIG6_ERR_LACK_OPTION #language en-US"Lack > options.\r\n" >"Hint: > Please type 'IfConfig6 -?' for help info.\r\n" > #string STR_IFCONFIG6_ERR_MAN_HOST #language en-US"Manual > address configuration failed. Please retry.\r\n" > + > +#string STR_IFCONFIG6_ERR_MAN_GW #language en-US"Getway > address configuration failed. Please check the argument.\r\n" > + > +#string STR_IFCONFIG6_ERR_INVALID_IP_CONFIG#language en-US"Don't > support to change the IP address manual if the policy is set to auto. Set > IP address fail.\r\n" > + > +#string STR_IFCONFIG6_ERR_INVALID_GW_CONFIG#language en-US"Don't > support to change the IP address manual if the policy is set to auto. Set > Getway fail.\r\n" > + > +#string STR_IFCONFIG6_ERR_INVALID_DNS_CONFIG #language en-US"Don't > support to change the IP address manual if the policy is set to auto. Set > DNS fail.\r\n" > + > #str
[edk2] [Patch 0/2] Check-for-the-max-DHCP-packet-length
Updates the PXE and HTTP boot driver to drop the input DHCP packet if it exceed the maximum length. Fu Siyuan (2): MdeModulePkg: Check for the max DHCP packet length before use it. NetworkPkg: Check for the max DHCP packet length before use it. .../Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c | 23 +++ .../Universal/Network/UefiPxeBcDxe/PxeBcDhcp.h | 2 +- NetworkPkg/HttpBootDxe/HttpBootDhcp4.h | 4 ++- NetworkPkg/HttpBootDxe/HttpBootDhcp6.c | 6 NetworkPkg/HttpBootDxe/HttpBootDhcp6.h | 4 ++- NetworkPkg/HttpBootDxe/HttpBootImpl.c | 4 +-- NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c | 34 -- NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.h | 6 ++-- NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c | 29 ++ NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.h | 6 ++-- NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c| 16 +- 11 files changed, 115 insertions(+), 19 deletions(-) -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 2/2] NetworkPkg: Check for the max DHCP packet length before use it.
This patch updates the PXE and HTTP boot driver to drop the input DHCP packet if it exceed the maximum length. Cc: Ye Ting <ting...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> --- NetworkPkg/HttpBootDxe/HttpBootDhcp4.h | 4 +++- NetworkPkg/HttpBootDxe/HttpBootDhcp6.c | 6 ++ NetworkPkg/HttpBootDxe/HttpBootDhcp6.h | 4 +++- NetworkPkg/HttpBootDxe/HttpBootImpl.c | 4 ++-- NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c | 34 -- NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.h | 6 -- NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c | 29 + NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.h | 6 -- NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c| 16 9 files changed, 91 insertions(+), 18 deletions(-) diff --git a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.h b/NetworkPkg/HttpBootDxe/HttpBootDhcp4.h index 27d9498..0b2cafb 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.h +++ b/NetworkPkg/HttpBootDxe/HttpBootDhcp4.h @@ -178,10 +178,12 @@ typedef struct { UINT32 Reserved; } HTTP_BOOT_VENDOR_OPTION; +#define HTTP_CACHED_DHCP4_PACKET_MAX_SIZE (OFFSET_OF (EFI_DHCP4_PACKET, Dhcp4) + HTTP_BOOT_DHCP4_PACKET_MAX_SIZE) + typedef union { EFI_DHCP4_PACKETOffer; EFI_DHCP4_PACKETAck; - UINT8 Buffer[HTTP_BOOT_DHCP4_PACKET_MAX_SIZE]; + UINT8 Buffer[HTTP_CACHED_DHCP4_PACKET_MAX_SIZE]; } HTTP_BOOT_DHCP4_PACKET; typedef struct { diff --git a/NetworkPkg/HttpBootDxe/HttpBootDhcp6.c b/NetworkPkg/HttpBootDxe/HttpBootDhcp6.c index 8478642..ca84f2a 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootDhcp6.c +++ b/NetworkPkg/HttpBootDxe/HttpBootDhcp6.c @@ -427,6 +427,12 @@ HttpBootDhcp6CallBack ( case Dhcp6RcvdAdvertise: Status = EFI_NOT_READY; +if (Packet->Length > HTTP_BOOT_DHCP6_PACKET_MAX_SIZE) { + // + // Ignore the incoming packets which exceed the maximum length. + // + break; +} if (Private->OfferNum < HTTP_BOOT_OFFER_MAX_NUM) { // // Cache the dhcp offers to OfferBuffer[] for select later, and record diff --git a/NetworkPkg/HttpBootDxe/HttpBootDhcp6.h b/NetworkPkg/HttpBootDxe/HttpBootDhcp6.h index 14d6db0..9f29898 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootDhcp6.h +++ b/NetworkPkg/HttpBootDxe/HttpBootDhcp6.h @@ -75,10 +75,12 @@ typedef union { HTTP_BOOT_DHCP6_OPTION_VENDOR_CLASS *VendorClass; } HTTP_BOOT_DHCP6_OPTION_ENTRY; +#define HTTP_CACHED_DHCP6_PACKET_MAX_SIZE (OFFSET_OF (EFI_DHCP6_PACKET, Dhcp6) + HTTP_BOOT_DHCP6_PACKET_MAX_SIZE) + typedef union { EFI_DHCP6_PACKETOffer; EFI_DHCP6_PACKETAck; - UINT8 Buffer[HTTP_BOOT_DHCP6_PACKET_MAX_SIZE]; + UINT8 Buffer[HTTP_CACHED_DHCP6_PACKET_MAX_SIZE]; } HTTP_BOOT_DHCP6_PACKET; typedef struct { diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c b/NetworkPkg/HttpBootDxe/HttpBootImpl.c index babd3e6..cf6de80 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c +++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c @@ -126,11 +126,11 @@ HttpBootStart ( ZeroMem (Private->OfferBuffer, sizeof (Private->OfferBuffer)); if (!Private->UsingIpv6) { for (Index = 0; Index < HTTP_BOOT_OFFER_MAX_NUM; Index++) { - Private->OfferBuffer[Index].Dhcp4.Packet.Offer.Size = HTTP_BOOT_DHCP4_PACKET_MAX_SIZE; + Private->OfferBuffer[Index].Dhcp4.Packet.Offer.Size = HTTP_CACHED_DHCP4_PACKET_MAX_SIZE; } } else { for (Index = 0; Index < HTTP_BOOT_OFFER_MAX_NUM; Index++) { - Private->OfferBuffer[Index].Dhcp6.Packet.Offer.Size = HTTP_BOOT_DHCP6_PACKET_MAX_SIZE; + Private->OfferBuffer[Index].Dhcp6.Packet.Offer.Size = HTTP_CACHED_DHCP6_PACKET_MAX_SIZE; } } diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c index 6566afd..44b0714 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c @@ -256,7 +256,7 @@ PxeBcBuildDhcp4Options ( OptList[Index]->OpCode = DHCP4_TAG_MAXMSG; OptList[Index]->Length = (UINT8) sizeof (PXEBC_DHCP4_OPTION_MAX_MESG_SIZE); OptEnt.MaxMesgSize = (PXEBC_DHCP4_OPTION_MAX_MESG_SIZE *) OptList[Index]->Data; -Value = NTOHS (PXEBC_DHCP4_PACKET_MAX_SIZE - 8); +Value = NTOHS (PXEBC_DHCP4_PACKET_MAX_SIZE); CopyMem (>Size, , sizeof (UINT16)); Index++; OptList[Index] = GET_NEXT_DHCP_OPTION (OptList[Index - 1]); @@ -1183,7 +1183,7 @@ PxeBcDhcp4CallBack ( DHCP4_TAG_MAXMSG ); if (MaxMsgSize != NULL) { -Value = HTONS (PXEBC_DHCP4_PACKET_MAX_SIZE - 8); +Value = HTONS (PXEBC_DHCP4_PACKET_MAX_SIZE); CopyMem (MaxMsgSize->Data, , sizeof (Value)); } @@ -1209,6 +1209,14 @@ PxeBcDhcp4CallBack ( sw
[edk2] [Patch 1/2] MdeModulePkg: Check for the max DHCP packet length before use it.
This patch updates the PXE driver to drop the input DHCP packet if it exceed the maximum length. Cc: Ye Ting <ting...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> --- .../Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c | 23 ++ .../Universal/Network/UefiPxeBcDxe/PxeBcDhcp.h | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c index eac955c..f03176b 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c @@ -912,6 +912,14 @@ PxeBcDhcpCallBack ( case Dhcp4SendDiscover: case Dhcp4SendRequest: +if (Packet->Length > PXEBC_DHCP4_MAX_PACKET_SIZE) { + // + // If the to be sent packet exceeds the maximum length, abort the DHCP process. + // + Status = EFI_ABORTED; + break; +} + if (Mode->SendGUID) { // // send the system GUID instead of the MAC address as the hardware address @@ -942,6 +950,13 @@ PxeBcDhcpCallBack ( case Dhcp4RcvdOffer: Status = EFI_NOT_READY; +if (Packet->Length > PXEBC_DHCP4_MAX_PACKET_SIZE) { + // + // Ignore the incoming Offers which exceed the maximum length. + // + break; +} + if (Private->NumOffers < PXEBC_MAX_OFFER_NUM) { // // Cache the dhcp offers in Private->Dhcp4Offers[] @@ -967,6 +982,14 @@ PxeBcDhcpCallBack ( break; case Dhcp4RcvdAck: +if (Packet->Length > PXEBC_DHCP4_MAX_PACKET_SIZE) { + // + // Abort the DHCP if the ACK packet exceeds the maximum length. + // + Status = EFI_ABORTED; + break; +} + // // Cache Ack // diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.h b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.h index abdf05d..614ea75 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.h +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.h @@ -18,7 +18,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define PXEBC_DHCP4_MAX_OPTION_NUM 16 #define PXEBC_DHCP4_MAX_OPTION_SIZE312 -#define PXEBC_DHCP4_MAX_PACKET_SIZE1472 +#define PXEBC_DHCP4_MAX_PACKET_SIZE(sizeof (EFI_PXE_BASE_CODE_PACKET)) #define PXEBC_DHCP4_S_PORT 67 #define PXEBC_DHCP4_C_PORT 68 -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 0/2] Check for NULL pointer before dereference
Fu Siyuan (2): MdeModulePkg: Check for NULL pointer before dereference it. NetworkPkg: Check for NULL pointer before dereference it. MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 8 NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | 10 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 2/2] NetworkPkg: Check for NULL pointer before dereference it.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Zhang Lubo <lubo.zh...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> --- NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c index 52095c5..0552174 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c @@ -2013,10 +2013,14 @@ EfiPxeBcSetStationIP ( return EFI_INVALID_PARAMETER; } - if (!Mode->UsingIpv6 && NewStationIp != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) { -return EFI_INVALID_PARAMETER; + if (!Mode->UsingIpv6 && NewStationIp != NULL) { +if (IP4_IS_UNSPECIFIED(NTOHL (NewStationIp->Addr[0])) || +IP4_IS_LOCAL_BROADCAST(NTOHL (NewStationIp->Addr[0])) || +(NewSubnetMask != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0] { + return EFI_INVALID_PARAMETER; +} } - + if (!Mode->Started) { return EFI_NOT_STARTED; } -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 1/2] MdeModulePkg: Check for NULL pointer before dereference it.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Zhang Lubo <lubo.zh...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> --- MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 8 1 file changed, 8 insertions(+) diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c index 4746256..43568ed 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c @@ -2317,6 +2317,14 @@ EfiPxeBcSetStationIP ( if (NewSubnetMask != NULL && !IP4_IS_VALID_NETMASK (NTOHL (NewSubnetMask->Addr[0]))) { return EFI_INVALID_PARAMETER; } + + if (NewStationIp != NULL) { +if (IP4_IS_UNSPECIFIED(NTOHL (NewStationIp->Addr[0])) || +IP4_IS_LOCAL_BROADCAST(NTOHL (NewStationIp->Addr[0])) || +(NewSubnetMask != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0] { + return EFI_INVALID_PARAMETER; +} + } if (NewStationIp != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) { return EFI_INVALID_PARAMETER; -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH v3 2/3] MdeModulePkg: Update IP4 stack drivers for classless address unicast check.
V3: Keep original logic in EfiDhcp4TransmitReceive() and add comments for it. V2 update: Keep the zero address and broadcast check if network mask is not available. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Zhang Lubo <lubo.zh...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> --- MdeModulePkg/Include/Library/IpIoLib.h | 4 +++- MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c | 9 +++- MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c| 4 ++-- .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 27 +- MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c | 6 + .../Universal/Network/IScsiDxe/IScsiConfig.c | 15 .../Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 9 .../Universal/Network/Ip4Dxe/Ip4Config2Nv.c| 24 +-- MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c | 7 +- .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c | 8 ++- MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.c | 6 ++--- MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c | 9 ++-- MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c | 8 +++ .../Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 24 +++ 14 files changed, 83 insertions(+), 77 deletions(-) diff --git a/MdeModulePkg/Include/Library/IpIoLib.h b/MdeModulePkg/Include/Library/IpIoLib.h index 37cba07..aab0c68 100644 --- a/MdeModulePkg/Include/Library/IpIoLib.h +++ b/MdeModulePkg/Include/Library/IpIoLib.h @@ -2,7 +2,7 @@ This library is only intended to be used by UEFI network stack modules. It provides the combined IpIo layer on the EFI IP4 Protocol and EFI IP6 protocol. -Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved. +Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License that accompanies this distribution. The full text of the license may be found at @@ -261,6 +261,8 @@ typedef struct _IP_IO { PKT_RCVD_NOTIFY PktRcvdNotify; ///< See IP_IO_OPEN_DATA::PktRcvdNotify. PKT_SENT_NOTIFY PktSentNotify; ///< See IP_IO_OPEN_DATA::PktSentNotify. UINT8 IpVersion; + IP4_ADDR StationIp; + IP4_ADDR SubnetMask; } IP_IO; /// diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c index 27fef71..9a70e90 100644 --- a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c +++ b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c @@ -1029,7 +1029,9 @@ IpIoListenHandlerDpc ( if (IpIo->IpVersion == IP_VERSION_4) { if ((EFI_IP4 (RxData->Ip4RxData.Header->SourceAddress) != 0) && -!NetIp4IsUnicast (EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) RxData)->Header->SourceAddress), 0)) { +(IpIo->SubnetMask != 0) && +IP4_NET_EQUAL (IpIo->StationIp, EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) RxData)->Header->SourceAddress), IpIo->SubnetMask) && +!NetIp4IsUnicast (EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) RxData)->Header->SourceAddress), IpIo->SubnetMask)) { // // The source address is not zero and it's not a unicast IP address, discard it. // @@ -1300,6 +1302,11 @@ IpIoOpen ( if (OpenData->IpConfigData.Ip4CfgData.RawData) { return EFI_UNSUPPORTED; } + +if (!OpenData->IpConfigData.Ip4CfgData.UseDefaultAddress) { + IpIo->StationIp = EFI_NTOHL (OpenData->IpConfigData.Ip4CfgData.StationAddress); + IpIo->SubnetMask = EFI_NTOHL (OpenData->IpConfigData.Ip4CfgData.SubnetMask); +} Status = IpIo->Ip.Ip4->Configure ( IpIo->Ip.Ip4, diff --git a/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c b/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c index afe4929..a02de20 100644 --- a/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c +++ b/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c @@ -943,9 +943,9 @@ ArpConfigureInstance ( if (ConfigData->SwAddressType == IPV4_ETHER_PROTO_TYPE) { CopyMem (, ConfigData->StationAddress, sizeof (IP4_ADDR)); -if (!NetIp4IsUnicast (NTOHL (Ip), 0)) { +if (IP4_IS_UNSPECIFIED (Ip) || IP4_IS_LOCAL_BROADCAST (Ip)) { // - // The station address is not a valid IPv4 unicast address. + // The station address should not be zero or broadcast address. // return EFI_INVALID_PARAMETER; } diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c index 79f7cde..18796fd 100644 --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c +++ b/MdeModulePkg/
Re: [edk2] [Patch 0/2] Fix the wrong Timer event check
Reviewed-by: Fu Siyuan siyuan...@intel.com > -Original Message- > From: Wu, Jiaxin > Sent: Friday, October 28, 2016 2:34 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Zhang, > Lubo <lubo.zh...@intel.com> > Subject: [Patch 0/2] Fix the wrong Timer event check > > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Zhang Lubo <lubo.zh...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> > > Jiaxin Wu (2): > MdeModulePkg: Fix the wrong Timer event check > NetworkPkg: Fix the wrong Timer event check > > MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c | 4 ++-- > NetworkPkg/DnsDxe/DnsImpl.c | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) > > -- > 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch 1/2] MdeModulePkg: Check for NULL pointer before dereference it.
Thanks Jiaxin, you are correct. I will delete these line when commit the patch. BestRegards Fu Siyuan From: Wu, Jiaxin Sent: Monday, October 31, 2016 3:22 PM To: Fu, Siyuan <siyuan...@intel.com>; edk2-devel@lists.01.org Cc: Ye, Ting <ting...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com> Subject: RE: [Patch 1/2] MdeModulePkg: Check for NULL pointer before dereference it. Siyuan, I think the below piece code should be dropped in EfiPxeBcSetStationIP() function: if (NewStationIp != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) { return EFI_INVALID_PARAMETER; } Others is good to me. Reviewed-By: Wu Jiaxin <jiaxin...@intel.com<mailto:jiaxin...@intel.com>> Best Regards! Jiaxin > -Original Message- > From: Fu, Siyuan > Sent: Monday, October 31, 2016 10:23 AM > To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> > Cc: Ye, Ting <ting...@intel.com<mailto:ting...@intel.com>>; Zhang, Lubo > <lubo.zh...@intel.com<mailto:lubo.zh...@intel.com>>; Wu, > Jiaxin <jiaxin...@intel.com<mailto:jiaxin...@intel.com>> > Subject: [Patch 1/2] MdeModulePkg: Check for NULL pointer before > dereference it. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Fu Siyuan <siyuan...@intel.com<mailto:siyuan...@intel.com>> > Cc: Ye Ting <ting...@intel.com<mailto:ting...@intel.com>> > Cc: Zhang Lubo <lubo.zh...@intel.com<mailto:lubo.zh...@intel.com>> > Cc: Wu Jiaxin <jiaxin...@intel.com<mailto:jiaxin...@intel.com>> > --- > MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 8 > 1 file changed, 8 insertions(+) > > diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c > b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c > index 4746256..43568ed 100644 > --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c > +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c > @@ -2317,6 +2317,14 @@ EfiPxeBcSetStationIP ( >if (NewSubnetMask != NULL && !IP4_IS_VALID_NETMASK (NTOHL > (NewSubnetMask->Addr[0]))) { > return EFI_INVALID_PARAMETER; >} > + > + if (NewStationIp != NULL) { > +if (IP4_IS_UNSPECIFIED(NTOHL (NewStationIp->Addr[0])) || > +IP4_IS_LOCAL_BROADCAST(NTOHL (NewStationIp->Addr[0])) || > +(NewSubnetMask != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp- > >Addr[0]), NTOHL (NewSubnetMask->Addr[0] { > + return EFI_INVALID_PARAMETER; > +} > + } > >if (NewStationIp != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp- > >Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) { > return EFI_INVALID_PARAMETER; > -- > 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] NetworkPkg: Record user configured TargetIP/Port in iBFT
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: Ye, Ting > Sent: Thursday, September 29, 2016 1:59 PM > To: edk2-devel@lists.01.org > Cc: Subramanian; Sriram <srira...@hpe.com>; Fu, Siyuan > <siyuan...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com> > Subject: [Patch] NetworkPkg: Record user configured TargetIP/Port in iBFT > > Current ISCSI driver records redirected iSCSI targetIP/Port in iBFT > once redirection occurs, which removes the possibility of the OS > to reconnect to the configured IP for load balancing. The behavior > is not explicitly described in IBFT spec, though the MSFT expert > confirm we should record original user setting rather than > publish the redirected IP. > > Thanks Sriram for reviewing and validating this patch in his test-bed. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ye Ting <ting...@intel.com> > Cc: Subramanian, Sriram <srira...@hpe.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Zhang Lubo <lubo.zh...@intel.com> > --- > NetworkPkg/IScsiDxe/IScsiDriver.c | 19 +++ > NetworkPkg/IScsiDxe/IScsiMisc.c | 10 +- > NetworkPkg/IScsiDxe/IScsiMisc.h | 7 ++- > NetworkPkg/IScsiDxe/IScsiProto.c | 36 +- > -- > 4 files changed, 55 insertions(+), 17 deletions(-) > > diff --git a/NetworkPkg/IScsiDxe/IScsiDriver.c > b/NetworkPkg/IScsiDxe/IScsiDriver.c > index c3ab2c9..279f1c0 100644 > --- a/NetworkPkg/IScsiDxe/IScsiDriver.c > +++ b/NetworkPkg/IScsiDxe/IScsiDriver.c > @@ -356,10 +356,11 @@ IScsiStart ( >CHAR16 MacString[ISCSI_MAX_MAC_STRING_LEN]; >BOOLEAN NeedUpdate; >VOID*Interface; >EFI_GUID*ProtocolGuid; >UINT8 NetworkBootPolicy; > + ISCSI_SESSION_CONFIG_NVDATA *NvData; > >// >// Test to see if iSCSI driver supports the given controller. >// > > @@ -699,10 +700,28 @@ IScsiStart ( >Status = IScsiSessionLogin (Session); > } else if (Status == EFI_NOT_READY) { >Status = IScsiSessionReLogin (Session); > } > > +// > +// Restore the origial user setting which specifies the proxy/virtual > iSCSI target to NV region. > +// > +NvData = >SessionConfigData; > +if (NvData->RedirectFlag) { > + NvData->TargetPort = NvData->OriginalTargetPort; > + CopyMem (>TargetIp, >OriginalTargetIp, sizeof > (EFI_IP_ADDRESS)); > + NvData->RedirectFlag = FALSE; > + > + gRT->SetVariable ( > + mPrivate->PortString, > + , > + ISCSI_CONFIG_VAR_ATTR, > + sizeof (ISCSI_ATTEMPT_CONFIG_NVDATA), > + AttemptConfigData > + ); > +} > + > if (EFI_ERROR (Status)) { >// >// In Single path mode, only the successful attempt will be > recorded in iBFT; >// in multi-path mode, all the attempt entries in MPIO will be > recorded in iBFT. >// > diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c > b/NetworkPkg/IScsiDxe/IScsiMisc.c > index a39c268..64bb2ad 100644 > --- a/NetworkPkg/IScsiDxe/IScsiMisc.c > +++ b/NetworkPkg/IScsiDxe/IScsiMisc.c > @@ -1186,15 +1186,15 @@ IScsiGetConfigData ( >MacString, >(UINTN) AttemptConfigOrder[Index] >); > > GetVariable2 ( > - mPrivate->PortString, > - , > - (VOID**), > - NULL > - ); > + mPrivate->PortString, > + , > + (VOID**), > + NULL > + ); > > if (AttemptConfigData == NULL) { >continue; > } > > diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.h > b/NetworkPkg/IScsiDxe/IScsiMisc.h > index 1bcaeb8..912a871 100644 > --- a/NetworkPkg/IScsiDxe/IScsiMisc.h > +++ b/NetworkPkg/IScsiDxe/IScsiMisc.h > @@ -48,13 +48,18 @@ typedef struct _ISCSI_SESSION_CONFIG_NVDATA { >CHAR8 TargetName[ISCSI_NAME_MAX_SIZE]; >EFI_IP_ADDRESSTargetIp; >UINT8 PrefixLength; >UINT8 BootLun[8]; > > - UINT16ConnectTimeout; ///< timout value in milliseconds > + UINT16ConnectTimeout; ///< timout value in milliseconds. >UINT8 ConnectRetryCount; >UINT8 IsId[6]; > + > + BOOLEAN RedirectFlag; > + UINT16OriginalTargetPort; // The port of proxy/virtual > target. > + EFI_IP_ADDRESSOriginalTargetIp; // The address
[edk2] [Patch] ShellPkg: update ping to use timer service instead of timer arch protocol .
This patch update the shell ping command to use timer service to calculate the RTT time, instead of using the timer arch protocol. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> Cc: Ni Ruiyu <ruiyu...@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Zhang Lubo <lubo.zh...@intel.com> --- .../Library/UefiShellNetwork1CommandsLib/Ping.c| 233 +++-- .../UefiShellNetwork1CommandsLib.inf | 3 +- .../UefiShellNetwork1CommandsLib.uni | 4 +- 3 files changed, 171 insertions(+), 69 deletions(-) diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c index 38625fe..2e1e878 100644 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c @@ -86,7 +86,7 @@ typedef struct _ICMPX_ECHO_REQUEST_REPLY { UINT16 Checksum; UINT16 Identifier; UINT16 SequenceNum; - UINT64 TimeStamp; + UINT32 TimeStamp; UINT8 Data[1]; } ICMPX_ECHO_REQUEST_REPLY; #pragma pack() @@ -94,7 +94,7 @@ typedef struct _ICMPX_ECHO_REQUEST_REPLY { typedef struct _PING_ICMP_TX_INFO { LIST_ENTRYLink; UINT16SequenceNum; - UINT64TimeStamp; + UINT32TimeStamp; PING_IPX_COMPLETION_TOKEN *Token; } PING_ICMPX_TX_INFO; @@ -109,6 +109,7 @@ typedef struct _PING_ICMP_TX_INFO { #define DEFAULT_BUFFER_SIZE 16 #define ICMP_V4_ECHO_REQUEST 0x8 #define ICMP_V4_ECHO_REPLY0x0 +#define STALL_1_MILLI_SECOND 1000 #define PING_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('P', 'i', 'n', 'g') typedef struct _PING_PRIVATE_DATA { @@ -117,6 +118,10 @@ typedef struct _PING_PRIVATE_DATA { EFI_HANDLE IpChildHandle; EFI_EVENT Timer; + UINT32 TimerPeriod; + UINT32 RttTimerTick; + EFI_EVENT RttTimer; + EFI_STATUS Status; LIST_ENTRY TxList; UINT16 RxCount; @@ -221,93 +226,186 @@ STATIC CONST SHELL_PARAM_ITEMPingParamList[] = { // STATIC CONST CHAR16 *mDstString; STATIC CONST CHAR16 *mSrcString; -STATIC UINT64mFrequency = 0; EFI_CPU_ARCH_PROTOCOL*gCpu = NULL; /** - Read the current time. + RTT timer tick routine. + + @param[in]EventA EFI_EVENT type event. + @param[in]Context The pointer to Context. - @retval the current tick value. **/ -UINT64 -ReadTime ( +VOID +EFIAPI +RttTimerTickRoutine ( + IN EFI_EVENTEvent, + IN VOID *Context + ) +{ + UINT32 *RttTimerTick; + + RttTimerTick = (UINT32*) Context; + (*RttTimerTick)++; +} + +/** + Get the timer period of the system. + + This function tries to get the system timer period by creating + an 1ms period timer. + + @return System timer period in MS, or 0 if operation failed. + +**/ +UINT32 +GetTimerPeriod( VOID ) { - UINT64 TimerPeriod; - EFI_STATUS Status; + EFI_STATUS Status; + UINT32 RttTimerTick; + EFI_EVENT TimerEvent; + UINT32 StallCounter; + EFI_TPLOldTpl; - ASSERT (gCpu != NULL); + RttTimerTick = 0; + StallCounter = 0; - Status = gCpu->GetTimerValue (gCpu, 0, , ); + Status = gBS->CreateEvent ( + EVT_TIMER | EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + RttTimerTickRoutine, + , + + ); if (EFI_ERROR (Status)) { -// -// The WinntGetTimerValue will return EFI_UNSUPPORTED. Set the -// TimerPeriod by ourselves. -// -mCurrentTick += 100; +return 0; + } + + OldTpl = gBS->RaiseTPL (TPL_CALLBACK); + Status = gBS->SetTimer ( + TimerEvent, + TimerPeriodic, + TICKS_PER_MS + ); + if (EFI_ERROR (Status)) { +gBS->CloseEvent (TimerEvent); +return 0; + } + + while (RttTimerTick < 10) { +gBS->Stall (STALL_1_MILLI_SECOND); +++StallCounter; } - - return mCurrentTick; -} + gBS->RestoreTPL (OldTpl); + + gBS->SetTimer (TimerEvent, TimerCancel, 0); + gBS->CloseEvent (TimerEvent); + + return StallCounter / RttTimerTick; +} /** - Get and calculate the frequency in ticks/ms. - The result is saved in the global variable mFrequency + Initialize the timer event for RTT (round trip time). - @retval EFI_SUCCESSCalculated the frequency successfully. - @retval Others Failed to calculate the frequency. + @param[in]PrivateThe pointer to PING_PRIVATE_DATA. + + @retval EFI_SUCCESS RTT timer is starte
Re: [edk2] [Patch 01/10] MdePkg: Add TLS related protocol definition
Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: Wu, Jiaxin Sent: 2016年12月14日 15:34 To: edk2-devel@lists.01.org Cc: Long, Qin <qin.l...@intel.com>; Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com>; Gao, Liming <liming@intel.com>; Kinney, Michael D <michael.d.kin...@intel.com>; Thomas Palmer <thomas.pal...@hpe.com>; Wu, Jiaxin <jiaxin...@intel.com> Subject: [Patch 01/10] MdePkg: Add TLS related protocol definition This patch is used to add Tls.h and TlsConfig.h header files to define EFI TLS Configuration Protocol, EFI TLS Service Binding Protocol and EFI TLS Configuration Protocol. Cc: Long Qin <qin.l...@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Fu Siyuan <siyuan...@intel.com> Cc: Zhang Lubo <lubo.zh...@intel.com> Cc: Liming Gao <liming@intel.com> Cc: Michael D Kinney <michael.d.kin...@intel.com> Cc: Thomas Palmer <thomas.pal...@hpe.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin...@intel.com> --- MdePkg/Include/Protocol/Tls.h | 460 MdePkg/Include/Protocol/TlsConfig.h | 132 +++ MdePkg/MdePkg.dec | 9 + 3 files changed, 601 insertions(+) create mode 100644 MdePkg/Include/Protocol/Tls.h create mode 100644 MdePkg/Include/Protocol/TlsConfig.h diff --git a/MdePkg/Include/Protocol/Tls.h b/MdePkg/Include/Protocol/Tls.h new file mode 100644 index 000..51a3cda --- /dev/null +++ b/MdePkg/Include/Protocol/Tls.h @@ -0,0 +1,460 @@ +/** @file + EFI TLS Protocols as defined in UEFI 2.5. + + The EFI TLS Service Binding Protocol is used to locate EFI TLS + Protocol drivers to create and destroy child of the driver to + communicate with other host using TLS protocol. + The EFI TLS Protocol provides the ability to manage TLS session. + + Copyright (c) 2016, Intel Corporation. All rights reserved. This + program and the accompanying materials are licensed and made + available under the terms and conditions of the BSD License which + accompanies this distribution. The full text of the license may be + found at http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + @par Revision Reference: + This Protocol is introduced in UEFI Specification 2.5 + +**/ + +#ifndef __EFI_TLS_PROTOCOL_H__ +#define __EFI_TLS_PROTOCOL_H__ + +/// +/// The EFI TLS Service Binding Protocol is used to locate EFI TLS +Protocol drivers to /// create and destroy child of the driver to +communicate with other host using TLS /// protocol. +/// +#define EFI_TLS_SERVICE_BINDING_PROTOCOL_GUID \ + { \ +0x952cb795, 0xff36, 0x48cf, {0xa2, 0x49, 0x4d, 0xf4, 0x86, 0xd6, +0xab, 0x8d } \ + } + +/// +/// The EFI TLS protocol provides the ability to manage TLS session. +/// +#define EFI_TLS_PROTOCOL_GUID \ + { \ +0xca959f, 0x6cfa, 0x4db1, {0x95, 0xbc, 0xe4, 0x6c, 0x47, 0x51, +0x43, 0x90 } \ + } + +typedef struct _EFI_TLS_PROTOCOL EFI_TLS_PROTOCOL; + +/// +/// EFI_TLS_SESSION_DATA_TYPE +/// +typedef enum { + /// + /// Session Configuration + /// + + /// + /// TLS session Version. The corresponding Data is of type EFI_TLS_VERSION. + /// + EfiTlsVersion, + /// + /// TLS session as client or as server. The corresponding Data is of + /// EFI_TLS_CONNECTION_END. + /// + EfiTlsConnectionEnd, + /// + /// A priority list of preferred algorithms for the TLS session. + /// The corresponding Data is a list of EFI_TLS_CIPHER. + /// + EfiTlsCipherList, + /// + /// TLS session compression method. + /// The corresponding Data is of type EFI_TLS_COMPRESSION. + /// + EfiTlsCompressionMethod, + /// + /// TLS session extension data. + /// The corresponding Data is a list of type EFI_TLS_EXTENDION. + /// + EfiTlsExtensionData, + /// + /// TLS session verify method. + /// The corresponding Data is of type EFI_TLS_VERIFY. + /// + EfiTlsVerifyMethod, + /// + /// TLS session data session ID. + /// For SetSessionData(), it is TLS session ID used for session resumption. + /// For GetSessionData(), it is the TLS session ID used for current session. + /// The corresponding Data is of type EFI_TLS_SESSION_ID. + /// + EfiTlsSessionID, + /// + /// TLS session data session state. + /// The corresponding Data is of type EFI_TLS_SESSION_STATE. + /// + EfiTlsSessionState, + + /// + /// Session information + /// + + /// + /// TLS session data client random. + /// The corresponding Data is of type EFI_TLS_RANDOM. + /// + EfiTlsClientRandom, + /// + /// TLS session data server random. + /// The corresponding Data is of type EFI_TLS_RANDOM. + /// + EfiTlsServerRandom, + /// + /// TLS session data key material. + /// The cor
Re: [edk2] [Patch 02/10] MdePkg: Add a header to standardize TLS definitions
Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: Wu, Jiaxin Sent: 2016年12月14日 15:34 To: edk2-devel@lists.01.org Cc: Long, Qin <qin.l...@intel.com>; Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com>; Gao, Liming <liming@intel.com>; Kinney, Michael D <michael.d.kin...@intel.com>; Thomas Palmer <thomas.pal...@hpe.com>; Wu, Jiaxin <jiaxin...@intel.com> Subject: [Patch 02/10] MdePkg: Add a header to standardize TLS definitions This path is used to standardize TLS definitions from related RFCs. Including TLS Cipher Suites, TLS Version, TLS Content Type and TLS Record Header, etc. Cc: Long Qin <qin.l...@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Fu Siyuan <siyuan...@intel.com> Cc: Zhang Lubo <lubo.zh...@intel.com> Cc: Liming Gao <liming@intel.com> Cc: Michael D Kinney <michael.d.kin...@intel.com> Cc: Thomas Palmer <thomas.pal...@hpe.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin...@intel.com> --- MdePkg/Include/IndustryStandard/Tls1.h | 93 ++ 1 file changed, 93 insertions(+) create mode 100644 MdePkg/Include/IndustryStandard/Tls1.h diff --git a/MdePkg/Include/IndustryStandard/Tls1.h b/MdePkg/Include/IndustryStandard/Tls1.h new file mode 100644 index 000..14eb265 --- /dev/null +++ b/MdePkg/Include/IndustryStandard/Tls1.h @@ -0,0 +1,93 @@ +/** @file + Transport Layer Security -- TLS 1.0/1.1/1.2 Standard definitions, from RFC 2246/4346/5246 + + This file contains common TLS 1.0/1.1/1.2 definitions from RFC + 2246/4346/5246 + + Copyright (c) 2016, Intel Corporation. All rights reserved. This + program and the accompanying materials are licensed and made + available under the terms and conditions of the BSD License which + accompanies this distribution. The full text of the license may be + found at http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +**/ + +#ifndef __TLS_1_H__ +#define __TLS_1_H__ + +#pragma pack(1) + +/// +/// TLS Cipher Suite, refers to A.5 of rfc-2246, rfc-4346 and rfc-5246. +/// +#define TLS_RSA_WITH_NULL_MD5{0x00, 0x01} +#define TLS_RSA_WITH_NULL_SHA{0x00, 0x02} +#define TLS_RSA_WITH_RC4_128_MD5 {0x00, 0x04} +#define TLS_RSA_WITH_RC4_128_SHA {0x00, 0x05} +#define TLS_RSA_WITH_IDEA_CBC_SHA{0x00, 0x07} +#define TLS_RSA_WITH_DES_CBC_SHA {0x00, 0x09} +#define TLS_RSA_WITH_3DES_EDE_CBC_SHA{0x00, 0x0A} +#define TLS_DH_DSS_WITH_DES_CBC_SHA {0x00, 0x0C} +#define TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA {0x00, 0x0D} +#define TLS_DH_RSA_WITH_DES_CBC_SHA {0x00, 0x0F} +#define TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA {0x00, 0x10} +#define TLS_DHE_DSS_WITH_DES_CBC_SHA {0x00, 0x12} +#define TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA{0x00, 0x13} +#define TLS_DHE_RSA_WITH_DES_CBC_SHA {0x00, 0x15} +#define TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA{0x00, 0x16} +#define TLS_RSA_WITH_AES_128_CBC_SHA {0x00, 0x2F} +#define TLS_DH_DSS_WITH_AES_128_CBC_SHA {0x00, 0x30} +#define TLS_DH_RSA_WITH_AES_128_CBC_SHA {0x00, 0x31} +#define TLS_DHE_DSS_WITH_AES_128_CBC_SHA {0x00, 0x32} +#define TLS_DHE_RSA_WITH_AES_128_CBC_SHA {0x00, 0x33} +#define TLS_RSA_WITH_AES_256_CBC_SHA {0x00, 0x35} +#define TLS_DH_DSS_WITH_AES_256_CBC_SHA {0x00, 0x36} +#define TLS_DH_RSA_WITH_AES_256_CBC_SHA {0x00, 0x37} +#define TLS_DHE_DSS_WITH_AES_256_CBC_SHA {0x00, 0x38} +#define TLS_DHE_RSA_WITH_AES_256_CBC_SHA {0x00, 0x39} +#define TLS_RSA_WITH_NULL_SHA256 {0x00, 0x3B} +#define TLS_RSA_WITH_AES_128_CBC_SHA256 {0x00, 0x3C} +#define TLS_RSA_WITH_AES_256_CBC_SHA256 {0x00, 0x3D} +#define TLS_DH_DSS_WITH_AES_128_CBC_SHA256 {0x00, 0x3E} +#define TLS_DH_RSA_WITH_AES_128_CBC_SHA256 {0x00, 0x3F} +#define TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 {0x00, 0x40} +#define TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 {0x00, 0x67} +#define TLS_DH_DSS_WITH_AES_256_CBC_SHA256 {0x00, 0x68} +#define TLS_DH_RSA_WITH_AES_256_CBC_SHA256 {0x00, 0x69} +#define TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 {0x00, 0x6A} +#define TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 {0x00, 0x6B} + +/// +/// TLS Version, refers to A.1 of rfc-2246, rfc-4346 and rfc-5246. +/// +#define TLS10_PROTOCOL_VERSION_MAJOR 0x03 #define +TLS10_PROTOCOL_VERSION_MINOR 0x01 #define TLS11_PROTOCOL_VERSION_MAJOR +0x03 #define TLS11_PROTOCOL_VERSION_MINOR 0x02 #define +TLS12_PROTOCOL_VERSION_MAJOR 0x03 #define TLS12_PROTOCOL_VERSION_
Re: [edk2] [Patch 05/10] NetworkPkg/TlsDxe: TlsDxe driver implementation over OpenSSL
Hi, Jiaxin Some comments as below: In TlsImpl.c Should the ASSERT in line 104 be an error handling? I mean is the input buffer coming from external input, and have we checked ContentType within it? Seems the TempRecordHeader pointer will be modified in the while loop, shouldn't the 3rd parameter be the reminding buffer size of the output buffer? Should we return error if the TlsCtrlTrafficOut return a failure? Similar questions for the decrypt packet function. Best Regards, Siyuan -Original Message- From: Wu, Jiaxin Sent: 2016年12月14日 15:34 To: edk2-devel@lists.01.org Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com>; Long, Qin <qin.l...@intel.com>; Thomas Palmer <thomas.pal...@hpe.com>; Wu, Jiaxin <jiaxin...@intel.com> Subject: [Patch 05/10] NetworkPkg/TlsDxe: TlsDxe driver implementation over OpenSSL This patch is the implementation of EFI TLS Service Binding Protocol, EFI TLS Protocol and EFI TLS Configuration Protocol Interfaces. Cc: Ye Ting <ting...@intel.com> Cc: Fu Siyuan <siyuan...@intel.com> Cc: Zhang Lubo <lubo.zh...@intel.com> Cc: Long Qin <qin.l...@intel.com> Cc: Thomas Palmer <thomas.pal...@hpe.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin...@intel.com> --- NetworkPkg/TlsDxe/TlsConfigProtocol.c | 152 NetworkPkg/TlsDxe/TlsDriver.c | 498 +++ NetworkPkg/TlsDxe/TlsDriver.h | 237 + NetworkPkg/TlsDxe/TlsDxe.inf | 65 NetworkPkg/TlsDxe/TlsDxe.uni | 25 ++ NetworkPkg/TlsDxe/TlsDxeExtra.uni | 18 + NetworkPkg/TlsDxe/TlsImpl.c | 270 +++ NetworkPkg/TlsDxe/TlsImpl.h | 315 + NetworkPkg/TlsDxe/TlsProtocol.c | 632 ++ 9 files changed, 2212 insertions(+) create mode 100644 NetworkPkg/TlsDxe/TlsConfigProtocol.c create mode 100644 NetworkPkg/TlsDxe/TlsDriver.c create mode 100644 NetworkPkg/TlsDxe/TlsDriver.h create mode 100644 NetworkPkg/TlsDxe/TlsDxe.inf create mode 100644 NetworkPkg/TlsDxe/TlsDxe.uni create mode 100644 NetworkPkg/TlsDxe/TlsDxeExtra.uni create mode 100644 NetworkPkg/TlsDxe/TlsImpl.c create mode 100644 NetworkPkg/TlsDxe/TlsImpl.h create mode 100644 NetworkPkg/TlsDxe/TlsProtocol.c diff --git a/NetworkPkg/TlsDxe/TlsConfigProtocol.c b/NetworkPkg/TlsDxe/TlsConfigProtocol.c new file mode 100644 index 000..2ec79c9 --- /dev/null +++ b/NetworkPkg/TlsDxe/TlsConfigProtocol.c @@ -0,0 +1,152 @@ +/** @file + Implementation of EFI TLS Configuration Protocol Interfaces. + + Copyright (c) 2016, Intel Corporation. All rights reserved. + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include "TlsImpl.h" + +EFI_TLS_CONFIGURATION_PROTOCOL mTlsConfigurationProtocol = { + TlsConfigurationSetData, + TlsConfigurationGetData +}; + +/** + Set TLS configuration data. + + The SetData() function sets TLS configuration to non-volatile storage or volatile + storage. + + @param[in] ThisPointer to the EFI_TLS_CONFIGURATION_PROTOCOL instance. + @param[in] DataTypeConfiguration data type. + @param[in] DataPointer to configuration data. + @param[in] DataSizeTotal size of configuration data. + + @retval EFI_SUCCESS The TLS configuration data is set successfully. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + This is NULL. + Data is NULL. + DataSize is 0. + @retval EFI_UNSUPPORTED The DataType is unsupported. + @retval EFI_OUT_OF_RESOURCESRequired system resources could not be allocated. + +**/ +EFI_STATUS +EFIAPI +TlsConfigurationSetData ( + IN EFI_TLS_CONFIGURATION_PROTOCOL *This, + IN EFI_TLS_CONFIG_DATA_TYPEDataType, + IN VOID*Data, + IN UINTN DataSize + ) +{ + EFI_STATUSStatus; + TLS_INSTANCE *Instance; + EFI_TPL OldTpl; + + Status = EFI_SUCCESS; + + if (This == NULL || Data == NULL || DataSize == 0) { +return EFI_INVALID_PARAMETER; + } + + OldTpl = gBS->RaiseTPL (TPL_CALLBACK); + + Instance = TLS_INSTANCE_FROM_CONFIGURATION_THIS (This); + + switch (DataType) { + case EfiTlsConfigDataTypeCACertificate: +Status = TlsSetCaCertific
[edk2] [Patch 0/2] Replace ASSERT with error return code in PXE and HTTP boot.
This patch remove the ASSERT when receive a DHCP packet large than the maximum cache buffer size. Fu Siyuan (2): MdeModulePkg: Replace ASSERT with error return code in PXE driver. NetworkPkg: Replace ASSERT with error return code in PXE and HTTP boot driver. .../Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c | 99 +++-- .../Universal/Network/UefiPxeBcDxe/PxeBcDhcp.h | 5 +- NetworkPkg/HttpBootDxe/HttpBootDhcp4.c | 32 +- NetworkPkg/HttpBootDxe/HttpBootDhcp6.c | 29 +++-- NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c | 119 +++-- NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c | 67 6 files changed, 249 insertions(+), 102 deletions(-) -- 2.7.4.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 2/2] NetworkPkg: Replace ASSERT with error return code in PXE and HTTP boot driver.
This patch remove the ASSERT when receive a DHCP packet large than the maximum cache buffer size. Cc: Yao Jiewen <jiewen@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> --- NetworkPkg/HttpBootDxe/HttpBootDhcp4.c | 32 +++-- NetworkPkg/HttpBootDxe/HttpBootDhcp6.c | 29 ++-- NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c | 119 +++-- NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c | 67 +-- 4 files changed, 181 insertions(+), 66 deletions(-) diff --git a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c b/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c index a47a8f4..fcea916 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c +++ b/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c @@ -220,17 +220,24 @@ HttpBootParseDhcp4Options ( @param[in] Dst Pointer to the cache buffer for DHCPv4 packet. @param[in] Src Pointer to the DHCPv4 packet to be cached. + @retval EFI_SUCCESSPacket is copied. + @retval EFI_BUFFER_TOO_SMALL Cache buffer is not big enough to hold the packet. + **/ -VOID +EFI_STATUS HttpBootCacheDhcp4Packet ( IN EFI_DHCP4_PACKET *Dst, IN EFI_DHCP4_PACKET *Src ) { - ASSERT (Dst->Size >= Src->Length); + if (Dst->Size < Src->Length) { +return EFI_BUFFER_TOO_SMALL; + } CopyMem (>Dhcp4, >Dhcp4, Src->Length); Dst->Length = Src->Length; + + return EFI_SUCCESS; } /** @@ -429,8 +436,10 @@ HttpBootParseDhcp4Packet ( @param[in] Private Pointer to HTTP boot driver private data. @param[in] RcvdOffer Pointer to the received offer packet. + @retval EFI_SUCCESS Cache and parse the packet successfully. + @retval Others Operation failed. **/ -VOID +EFI_STATUS HttpBootCacheDhcp4Offer ( IN HTTP_BOOT_PRIVATE_DATA *Private, IN EFI_DHCP4_PACKET*RcvdOffer @@ -439,6 +448,7 @@ HttpBootCacheDhcp4Offer ( HTTP_BOOT_DHCP4_PACKET_CACHE *Cache4; EFI_DHCP4_PACKET *Offer; HTTP_BOOT_OFFER_TYPE OfferType; + EFI_STATUSStatus; ASSERT (Private->OfferNum < HTTP_BOOT_OFFER_MAX_NUM); Cache4 = >OfferBuffer[Private->OfferNum].Dhcp4; @@ -447,13 +457,16 @@ HttpBootCacheDhcp4Offer ( // // Cache the content of DHCPv4 packet firstly. // - HttpBootCacheDhcp4Packet (Offer, RcvdOffer); + Status = HttpBootCacheDhcp4Packet (Offer, RcvdOffer); + if (EFI_ERROR (Status)) { +return Status; + } // // Validate the DHCPv4 packet, and parse the options and offer type. // if (EFI_ERROR (HttpBootParseDhcp4Packet (Cache4))) { -return; +return EFI_ABORTED; } // @@ -465,6 +478,8 @@ HttpBootCacheDhcp4Offer ( Private->OfferIndex[OfferType][Private->OfferCount[OfferType]] = Private->OfferNum; Private->OfferCount[OfferType]++; Private->OfferNum++; + + return EFI_SUCCESS; } /** @@ -618,10 +633,17 @@ HttpBootDhcp4CallBack ( switch (Dhcp4Event) { case Dhcp4RcvdOffer: Status = EFI_NOT_READY; +if (Packet->Length > HTTP_BOOT_DHCP4_PACKET_MAX_SIZE) { + // + // Ignore the incoming packets which exceed the maximum length. + // + break; +} if (Private->OfferNum < HTTP_BOOT_OFFER_MAX_NUM) { // // Cache the DHCPv4 offers to OfferBuffer[] for select later, and record // the OfferIndex and OfferCount. + // If error happens, just ignore this packet and continue to wait more offer. // HttpBootCacheDhcp4Offer (Private, Packet); } diff --git a/NetworkPkg/HttpBootDxe/HttpBootDhcp6.c b/NetworkPkg/HttpBootDxe/HttpBootDhcp6.c index ca84f2a..f2b8195 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootDhcp6.c +++ b/NetworkPkg/HttpBootDxe/HttpBootDhcp6.c @@ -329,17 +329,24 @@ HttpBootParseDhcp6Packet ( @param[in] Dst The pointer to the cache buffer for DHCPv6 packet. @param[in] Src The pointer to the DHCPv6 packet to be cached. + @retval EFI_SUCCESSPacket is copied. + @retval EFI_BUFFER_TOO_SMALL Cache buffer is not big enough to hold the packet. + **/ -VOID +EFI_STATUS HttpBootCacheDhcp6Packet ( IN EFI_DHCP6_PACKET *Dst, IN EFI_DHCP6_PACKET *Src ) { - ASSERT (Dst->Size >= Src->Length); + if (Dst->Size < Src->Length) { +return EFI_BUFFER_TOO_SMALL; + } CopyMem (>Dhcp6, >Dhcp6, Src->Length); Dst->Length = Src->Length; + + return EFI_SUCCESS; } /** @@ -348,8 +355,11 @@ HttpBootCacheDhcp6Packet ( @param[in] Private The pointer to HTTP_BOOT_PRIVATE_DATA. @param[in] RcvdOffer The pointer to the received offer packet. + @retval EFI_SUCCESS Cache and parse the packet successfully. + @retval
[edk2] [Patch 1/2] MdeModulePkg: Replace ASSERT with error return code in PXE driver.
This patch remove the ASSERT when receive a DHCP packet large than the maximum cache buffer size. Cc: Yao Jiewen <jiewen@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan...@intel.com> --- .../Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c | 99 ++ .../Universal/Network/UefiPxeBcDxe/PxeBcDhcp.h | 5 +- 2 files changed, 68 insertions(+), 36 deletions(-) diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c index f03176b..f0720e5 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c @@ -69,20 +69,26 @@ PxeBcInitSeedPacket ( /** Copy the DCHP4 packet from srouce to destination. - @param Dst Pointer to the EFI_DHCP4_PROTOCOL instance. - @param Src Pointer to the EFI_DHCP4_PROTOCOL instance. + @param[in] Dst Pointer to the cache buffer for DHCPv4 packet. + @param[in] Src Pointer to the DHCPv4 packet to be cached. + + @retval EFI_SUCCESSPacket is copied. + @retval EFI_BUFFER_TOO_SMALL Cache buffer is not big enough to hold the packet. **/ -VOID +EFI_STATUS PxeBcCopyEfiDhcp4Packet ( IN EFI_DHCP4_PACKET *Dst, IN EFI_DHCP4_PACKET *Src ) { - ASSERT (Dst->Size >= Src->Length); + if (Dst->Size < Src->Length) { +return EFI_BUFFER_TOO_SMALL; + } CopyMem (>Dhcp4, >Dhcp4, Src->Length); Dst->Length = Src->Length; + return EFI_SUCCESS; } @@ -93,8 +99,11 @@ PxeBcCopyEfiDhcp4Packet ( @param OfferIndexIndex of cached packets as complements of pxe mode data, the index is maximum offer number. + @retval EFI_SUCCESSCache and parse the packet successfully. + @retval EFI_BUFFER_TOO_SMALL Cache buffer is not big enough to hold the packet. + **/ -VOID +EFI_STATUS PxeBcCopyProxyOffer ( IN PXEBC_PRIVATE_DATA *Private, IN UINT32 OfferIndex @@ -102,6 +111,7 @@ PxeBcCopyProxyOffer ( { EFI_PXE_BASE_CODE_MODE *Mode; EFI_DHCP4_PACKET*Offer; + EFI_STATUS Status; ASSERT (OfferIndex < Private->NumOffers); ASSERT (OfferIndex < PXEBC_MAX_OFFER_NUM); @@ -109,11 +119,15 @@ PxeBcCopyProxyOffer ( Mode = Private->PxeBc.Mode; Offer = >Dhcp4Offers[OfferIndex].Packet.Offer; - PxeBcCopyEfiDhcp4Packet (>ProxyOffer.Packet.Offer, Offer); + Status = PxeBcCopyEfiDhcp4Packet (>ProxyOffer.Packet.Offer, Offer); + if (EFI_ERROR(Status)) { +return Status; + } CopyMem (>ProxyOffer, >Dhcp4, Offer->Length); Mode->ProxyOfferReceived = TRUE; PxeBcParseCachedDhcpPacket (>ProxyOffer); + return EFI_SUCCESS; } @@ -411,8 +425,9 @@ PxeBcTryBinlProxy ( @param Private Pointer to PxeBc private data. - @retval EFI_SUCCESS Operational successful. - @retval EFI_NO_RESPONSE Offer dhcp service failed. + @retval EFI_SUCCESSOperational successful. + @retval EFI_NO_RESPONSEOffer dhcp service failed. + @retval EFI_BUFFER_TOO_SMALL Failed to copy the packet to Pxe base code mode. **/ EFI_STATUS @@ -515,7 +530,7 @@ PxeBcCheckSelectedOffer ( // // Copy the proxy offer to Mode and set the flag // -PxeBcCopyProxyOffer (Private, ProxyOfferIndex); +Status = PxeBcCopyProxyOffer (Private, ProxyOfferIndex); } } else { // @@ -543,7 +558,7 @@ PxeBcCheckSelectedOffer ( // Other type of ACK is already cached. Bootp is special that we should // use the bootp reply as the ACK and put it into the DHCP_ONLY buffer. // - PxeBcCopyEfiDhcp4Packet (>Dhcp4Ack.Packet.Ack, Offer); + Status = PxeBcCopyEfiDhcp4Packet (>Dhcp4Ack.Packet.Ack, Offer); } PxeBcParseCachedDhcpPacket (>Dhcp4Ack); @@ -566,8 +581,11 @@ PxeBcCheckSelectedOffer ( @param PrivatePointer to PxeBc private data. @param RcvdOffer Pointer to the received Dhcp proxy offer packet. + @retval EFI_SUCCESS Cache and parse the packet successfully. + @retval Others Operation failed. + **/ -VOID +EFI_STATUS PxeBcCacheDhcpOffer ( IN PXEBC_PRIVATE_DATA *Private, IN EFI_DHCP4_PACKET*RcvdOffer @@ -576,6 +594,7 @@ PxeBcCacheDhcpOffer ( PXEBC_CACHED_DHCP4_PACKET *CachedOffer; EFI_DHCP4_PACKET *Offer; UINT8 OfferType; + EFI_STATUSStatus; CachedOffer = >Dhcp4Offers[Private->NumOffers]; Offer = >Packet.Offer; @@ -583,18 +602,21 @@ PxeBcCacheDhcpOffer ( // // Cache the orignal dhcp packet // - PxeBcCopyEfiDhcp4Packet (Offer, RcvdOffer); + Status = PxeBcCopyEfiDhcp4Packet (Offer, RcvdOffer); +
Re: [edk2] [PATCH] ShellPkg: Assign the correct value to ShellStatus
Reviewed-by: Fu Siyuan <siyuan...@intel.com> > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Gary Lin > Sent: Wednesday, December 7, 2016 11:41 AM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com>; Fu, > Siyuan <siyuan...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com> > Subject: [edk2] [PATCH] ShellPkg: Assign the correct value to ShellStatus > > Since the type of ShellStatus is SHELL_STATUS, we should use > SHELL_INVALID_PARAMETER instead of EFI_INVALID_PARAMETER. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Gary Lin <g...@suse.com> > Cc: Zhang Lubo <lubo.zh...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Wu Jiaxin <jiaxin...@intel.com> > --- > ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c > b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c > index fb308cc3b6..d71688ed66 100644 > --- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c > +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c > @@ -1319,15 +1319,15 @@ IfConfig6SetInterfaceInfo ( > >if (StrCmp (VarArg->Arg, L"host") == 0) { > ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_IFCONFIG6_ERR_INVALID_IP_CONFIG), gShellNetwork2HiiHandle, Status); > -ShellStatus = EFI_INVALID_PARAMETER; > +ShellStatus = SHELL_INVALID_PARAMETER; > goto ON_EXIT; >} else if (StrCmp (VarArg->Arg, L"gw") == 0) { > ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_IFCONFIG6_ERR_INVALID_GW_CONFIG), gShellNetwork2HiiHandle, Status); > -ShellStatus = EFI_INVALID_PARAMETER; > +ShellStatus = SHELL_INVALID_PARAMETER; > goto ON_EXIT; >} else if (StrCmp (VarArg->Arg, L"dns") == 0) { > ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_IFCONFIG6_ERR_INVALID_DNS_CONFIG), gShellNetwork2HiiHandle, Status); > -ShellStatus = EFI_INVALID_PARAMETER; > +ShellStatus = SHELL_INVALID_PARAMETER; > goto ON_EXIT; >} > > -- > 2.11.0 > > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 4/6] MdeModulePkg/DxeNetLib: Rewrite NetblockChecksum function logic
Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: Wu, Hao A Sent: 2016年12月14日 19:27 To: edk2-devel@lists.01.org Cc: Wu, Hao A <hao.a...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Ye, Ting <ting...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com> Subject: [PATCH 4/6] MdeModulePkg/DxeNetLib: Rewrite NetblockChecksum function logic This commit rewrites the logic for NetblockChecksum. It processes the checksum of the left-over byte first to prevent possible mis-reports by static code checkers. Cc: Fu Siyuan <siyuan...@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a...@intel.com> --- MdeModulePkg/Library/DxeNetLib/NetBuffer.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/MdeModulePkg/Library/DxeNetLib/NetBuffer.c b/MdeModulePkg/Library/DxeNetLib/NetBuffer.c index bbbdbc0..95cb717 100644 --- a/MdeModulePkg/Library/DxeNetLib/NetBuffer.c +++ b/MdeModulePkg/Library/DxeNetLib/NetBuffer.c @@ -1,7 +1,7 @@ /** @file Network library functions providing net buffer operation support. -Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved. +Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -1661,6 +1661,13 @@ NetblockChecksum ( Sum = 0; + // + // Add left-over byte, if any + // + if (Len % 2 != 0) { +Sum += *(Bulk + Len - 1); + } + while (Len > 1) { Sum += *(UINT16 *) Bulk; Bulk += 2; @@ -1668,13 +1675,6 @@ NetblockChecksum ( } // - // Add left-over byte, if any - // - if (Len > 0) { -Sum += *(UINT8 *) Bulk; - } - - // // Fold 32-bit sum to 16 bits // while ((Sum >> 16) != 0) { -- 1.9.5.msysgit.0 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 5/6] MdeModulePkg/UefiPxeBcDxe: Refine the CvtNum function logic
Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: Wu, Hao A Sent: 2016年12月14日 19:27 To: edk2-devel@lists.01.org Cc: Wu, Hao A <hao.a...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Ye, Ting <ting...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com> Subject: [PATCH 5/6] MdeModulePkg/UefiPxeBcDxe: Refine the CvtNum function logic This commit refines the logic for the CvtNum function. It avoids using the decrement operator '--' for array index to prevent possible mis-reports by static code checkers. Cc: Fu Siyuan <siyuan...@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a...@intel.com> --- MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c index 0865ddd..0779056 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c @@ -132,11 +132,10 @@ CvtNum ( { UINTN Remainder; - while (Length > 0) { + for (; Length > 0; Length--) { Remainder = Number % 10; Number /= 10; -Length--; -Buffer[Length] = (UINT8) ('0' + Remainder); +Buffer[Length - 1] = (UINT8) ('0' + Remainder); } } -- 1.9.5.msysgit.0 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 6/6] NetworkPkg: Refine UintnToAscDecWithFormat functions logic
Reviewed-by: Fu Siyuan <siyuan...@intel.com> -Original Message- From: Wu, Hao A Sent: 2016年12月14日 19:27 To: edk2-devel@lists.01.org Cc: Wu, Hao A <hao.a...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Ye, Ting <ting...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com> Subject: [PATCH 6/6] NetworkPkg: Refine UintnToAscDecWithFormat functions logic This commit refines the logic for HttpBootUintnToAscDecWithFormat and PxeBcUintnToAscDecWithFormat. It avoids using the decrement operator '--' for array index to prevent possible mis-reports by static code checkers. Cc: Fu Siyuan <siyuan...@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a...@intel.com> --- NetworkPkg/HttpBootDxe/HttpBootSupport.c | 5 ++--- NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c b/NetworkPkg/HttpBootDxe/HttpBootSupport.c index 9410bf9..bdb29ae 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c +++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c @@ -86,11 +86,10 @@ HttpBootUintnToAscDecWithFormat ( { UINTN Remainder; - while (Length > 0) { -Length--; + for (; Length > 0; Length--) { Remainder = Number % 10; Number/= 10; -Buffer[Length] = (UINT8) ('0' + Remainder); +Buffer[Length - 1] = (UINT8) ('0' + Remainder); } } diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c index 00c652d..568360d 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c @@ -1383,11 +1383,10 @@ PxeBcUintnToAscDecWithFormat ( { UINTN Remainder; - while (Length > 0) { -Length--; + for (; Length > 0; Length--) { Remainder = Number % 10; Number/= 10; -Buffer[Length] = (UINT8) ('0' + Remainder); +Buffer[Length - 1] = (UINT8) ('0' + Remainder); } } -- 1.9.5.msysgit.0 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch 06/10] NetworkPkg/TlsAuthConfigDxe: Provide the UI to support TLS auth configuration
Hi, Jiaxin PrintLib support "%g" to print a GUID so you don't need to use "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" in GuidToString(). Beside of that, I do see a lot of drivers has similar internal function StringToGuid() or StrToGuid(), do we have a common library interface for this? if not I think it may worth to create one. Other parts are good with me. Reviewed-by: Fu Siyuan <siyuan...@intel.com> Best Regards Siyuan -Original Message- From: Wu, Jiaxin Sent: 2016年12月14日 15:34 To: edk2-devel@lists.01.org Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com>; Long, Qin <qin.l...@intel.com>; Thomas Palmer <thomas.pal...@hpe.com>; Wu, Jiaxin <jiaxin...@intel.com> Subject: [Patch 06/10] NetworkPkg/TlsAuthConfigDxe: Provide the UI to support TLS auth configuration This patch provides the UI to support TLS auth configuration. * EFI_SIGNATURE_LIST format is used for 'TlsCaCertificate' variable. So, TLS supports multiple certificate configuration. * The variable attribute is BS with NV, which only target at preventing runtime phase attack. Cc: Ye Ting <ting...@intel.com> Cc: Fu Siyuan <siyuan...@intel.com> Cc: Zhang Lubo <lubo.zh...@intel.com> Cc: Long Qin <qin.l...@intel.com> Cc: Thomas Palmer <thomas.pal...@hpe.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin...@intel.com> --- NetworkPkg/Include/Guid/TlsAuthConfigHii.h | 25 + NetworkPkg/Include/Guid/TlsAuthentication.h| 29 + NetworkPkg/NetworkPkg.dec |7 + NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.c | 135 ++ NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf | 73 + NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.uni | 21 + .../TlsAuthConfigDxe/TlsAuthConfigDxeExtra.uni | 19 + .../TlsAuthConfigDxe/TlsAuthConfigDxeStrings.uni | 39 + NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c| 1841 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.h| 282 +++ NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigNvData.h | 49 + NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigVfr.vfr | 152 ++ 12 files changed, 2672 insertions(+) create mode 100644 NetworkPkg/Include/Guid/TlsAuthConfigHii.h create mode 100644 NetworkPkg/Include/Guid/TlsAuthentication.h create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.c create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.uni create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxeExtra.uni create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxeStrings.uni create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.h create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigNvData.h create mode 100644 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigVfr.vfr diff --git a/NetworkPkg/Include/Guid/TlsAuthConfigHii.h b/NetworkPkg/Include/Guid/TlsAuthConfigHii.h new file mode 100644 index 000..9d21426 --- /dev/null +++ b/NetworkPkg/Include/Guid/TlsAuthConfigHii.h @@ -0,0 +1,25 @@ +/** @file + GUIDs used as HII FormSet and HII Package list GUID in TlsAuthConfigDxe driver. + +Copyright (c) 2016, Intel Corporation. All rights reserved. +This program and the accompanying materials are licensed and made available under +the terms and conditions of the BSD License that accompanies this distribution. +The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php. + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __TLS_AUTH_CONFIG_HII_GUID_H__ +#define __TLS_AUTH_CONFIG_HII_GUID_H__ + +#define TLS_AUTH_CONFIG_GUID \ + { \ +0xb0eae4f8, 0x9a04, 0x4c6d, { 0xa7, 0x48, 0x79, 0x3d, 0xaa, 0xf, 0x65, 0xdf } \ + } + +extern EFI_GUID gTlsAuthConfigGuid; + +#endif diff --git a/NetworkPkg/Include/Guid/TlsAuthentication.h b/NetworkPkg/Include/Guid/TlsAuthentication.h new file mode 100644 index 000..2e800dc --- /dev/null +++ b/NetworkPkg/Include/Guid/TlsAuthentication.h @@ -0,0 +1,29 @@ +/** @file + This file defines TlsCaCertificate variable. + +Copyright (c) 2016, Intel Corporation. All rights reserved. +This program and the accompanying materials are licensed and made available under +the terms and conditions of the BSD License that accompanies this distribution. +The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php. + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WAR