/* Process the ICMP query message. If it is an ICMP echo request, answer it. Otherwise deliver it to upper layer. */
EFI_STATUS Ip4ProcessIcmpQuery(IN IP4_SERVICE *IpSb, IN IP4_HEAD *Head, IN NET_BUF *Packet)
/* Process the ICMP query message. If it is an ICMP echo request, answer it. Otherwise deliver it to upper layer. */
EFI_STATUS Ip4ProcessIcmpQuery(IN IP4_SERVICE *IpSb, IN IP4_HEAD *Head, IN NET_BUF *Packet)
{
  IP4_ICMP_QUERY_HEAD  Icmp;
  if (Packet->TotalSize < sizeof (Icmp)) {
    NetbufFree (Packet);
    return EFI_INVALID_PARAMETER;
  }
  NetbufCopy (Packet, 0, sizeof (Icmp), (UINT8 *)&Icmp);
  if (Icmp.Head.Type == ICMP_ECHO_REQUEST) {
    return Ip4IcmpReplyEcho (IpSb, Head, Packet);
  }
  return Ip4Demultiplex (IpSb, Head, Packet, NULL, 0);
}