/* Convert a string of the format "192.168.0.1" to an IP address. */
EFI_STATUS NetStringToIp(IN UINT8 *Str, OUT IP4_ADDR *Ip)
/* Convert a string of the format "192.168.0.1" to an IP address. */
EFI_STATUS NetStringToIp(IN UINT8 *Str, OUT IP4_ADDR *Ip)
{
  UINT32  Byte;
  UINT32  Addr;
  UINTN   Index;
  *Ip  = 0;
  Addr = 0;
  for (Index = 0; Index < 4; Index++) {
    if (!NET_IS_DIGIT (*Str)) {
      return EFI_INVALID_PARAMETER;
    }
    Byte = NetStringToU32 (Str);
    if (Byte > 255) {
      return EFI_INVALID_PARAMETER;
    }
    Addr = (Addr << 8) | Byte;
    while (NET_IS_DIGIT (*Str)) {
      Str++;
    }
    if ((Index < 3) && (*Str != '.')) {
      return EFI_INVALID_PARAMETER;
    }
    Str++;
  }
  *Ip = Addr;
  return EFI_SUCCESS;
}