Hi Michael,

Thanks for catching this.

While we re-checked the spec, and realized there're some inconsistency in the 
UEFI Spec about the Override Data definition. As we know, 0.0.0.0 is  clearly 
not a valid unicast address.

In "Related Definitions" under EFI_MTFTP4_PROTOCOL.GetInfo():
ServerIp IP address of the MTFTPv4 server. If set to 0.0.0.0, it will use the 
value that was set by the EFI_MTFTP4_PROTOCOL.Configure()  function.
In "Status Codes Returned" table:
         EFI_INVALID_PARAMETER  One or more IPv4 addresses in OverrideData are 
not valid unicast IPv4 addresses if OverrideData is not  NULL.

We'd better have specification to clarify this. At the same time, how about you 
update your code to set a valid IP address so that to get the code running 
first?

Thanks,
Ruth
From: Michael Lorer [mailto:[email protected]]
Sent: Wednesday, April 09, 2014 3:04 PM
To: [email protected]<mailto:[email protected]>
Subject: [edk2] MdeModulePkg maintainer: Possible bug in 
Network/Mtftp4Dxe/Mtftp4Impl.c

Hi,

I think I found a bug in MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
Regarding UEFI Specification 2.4 EFI_MTFTP_PROTCOL.GetInfo() (PDF page 1411) in 
the related definitions of Override Data is mentioned that if I use a ServerIp 
address of 0.0.0.0 the currently configured address is used instead.
But the code that checks the incoming Override parameter is checked with this 
function:
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c#L187

BOOLEAN
Mtftp4OverrideValid (
  IN MTFTP4_PROTOCOL          *Instance,
  IN EFI_MTFTP4_OVERRIDE_DATA *Override
  )
{
  EFI_MTFTP4_CONFIG_DATA    *Config;
  IP4_ADDR                  Ip;
  IP4_ADDR                  Netmask;
  IP4_ADDR                  Gateway;

  CopyMem (&Ip, &Override->ServerIp, sizeof (IP4_ADDR));
  if (!NetIp4IsUnicast (NTOHL (Ip), 0)) {
    return FALSE;
  }
...

And if I pass there a 0.0.0.0 ip address the whole function returns FALSE and 
the calling function returns EFI_INVALID_PARAMETER:
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c#L411

Did I get something wrong or is there a bug in the code?
Compared to the gateway the gateway address is only checked with the 
NetIp4IsUnicast-function if it is not null:
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c#L196


  if (!Config->UseDefaultSetting && (Gateway != 0)) {

...

Regards,
Michael

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to