TianoCore EDK2 master
Loading...
Searching...
No Matches
Ip4Icmp.c File Reference
#include "Ip4Impl.h"

Go to the source code of this file.

Functions

EFI_STATUS Ip4ProcessIcmpRedirect (IN IP4_SERVICE *IpSb, IN IP4_HEAD *Head, IN NET_BUF *Packet, IN IP4_ICMP_ERROR_HEAD *Icmp)
 
EFI_STATUS Ip4ProcessIcmpError (IN IP4_SERVICE *IpSb, IN IP4_HEAD *Head, IN NET_BUF *Packet)
 
EFI_STATUS Ip4IcmpReplyEcho (IN IP4_SERVICE *IpSb, IN IP4_HEAD *Head, IN NET_BUF *Packet)
 
EFI_STATUS Ip4ProcessIcmpQuery (IN IP4_SERVICE *IpSb, IN IP4_HEAD *Head, IN NET_BUF *Packet)
 
EFI_STATUS Ip4IcmpHandle (IN IP4_SERVICE *IpSb, IN IP4_HEAD *Head, IN NET_BUF *Packet)
 

Variables

IP4_ICMP_CLASS mIcmpClass []
 
EFI_IP4_ICMP_TYPE mIp4SupportedIcmp [23]
 

Detailed Description

Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Ip4Icmp.c.

Function Documentation

◆ Ip4IcmpHandle()

EFI_STATUS Ip4IcmpHandle ( IN IP4_SERVICE IpSb,
IN IP4_HEAD Head,
IN NET_BUF Packet 
)

Handle the ICMP packet. First validate the message format, then according to the message types, process it as query or error packet.

Parameters
[in]IpSbThe IP4 service that receivd the packet.
[in]HeadThe IP4 head of the ICMP query packet.
[in]PacketThe content of the ICMP query with IP4 head removed.
Return values
EFI_INVALID_PARAMETERThe packet is malformatted.
EFI_SUCCESSThe ICMP message is successfully processed.
OthersFailed to handle ICMP packet.

Definition at line 322 of file Ip4Icmp.c.

◆ Ip4IcmpReplyEcho()

EFI_STATUS Ip4IcmpReplyEcho ( IN IP4_SERVICE IpSb,
IN IP4_HEAD Head,
IN NET_BUF Packet 
)

Replay an ICMP echo request.

Parameters
[in]IpSbThe IP4 service that receivd the packet
[in]HeadThe IP4 head of the ICMP error packet
[in]PacketThe content of the ICMP error with IP4 head removed.
Return values
EFI_OUT_OF_RESOURCESFailed to allocate resource.
EFI_SUCCESSThe ICMP Echo request is successfully answered.
OthersFailed to answer the ICMP echo request.

Definition at line 204 of file Ip4Icmp.c.

◆ Ip4ProcessIcmpError()

EFI_STATUS Ip4ProcessIcmpError ( IN IP4_SERVICE IpSb,
IN IP4_HEAD Head,
IN NET_BUF Packet 
)

Process the ICMP error packet. If it is an ICMP redirect packet, update call Ip4ProcessIcmpRedirect to update the IP instance's route cache, otherwise, deliver the packet to upper layer.

Parameters
[in]IpSbThe IP4 service that received the packet.
[in]HeadThe IP4 head of the ICMP error packet
[in]PacketThe content of the ICMP error with IP4 head removed.
Return values
EFI_SUCCESSThe ICMP error is processed successfully.
EFI_INVALID_PARAMETERThe packet is invalid
OthersFailed to process the packet.

Definition at line 163 of file Ip4Icmp.c.

◆ Ip4ProcessIcmpQuery()

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.

Parameters
[in]IpSbThe IP4 service that receivd the packet
[in]HeadThe IP4 head of the ICMP query packet
[in]PacketThe content of the ICMP query with IP4 head removed.
Return values
EFI_INVALID_PARAMETERThe packet is invalid
EFI_SUCCESSThe ICMP query message is processed
OthersFailed to process ICMP query.

Definition at line 284 of file Ip4Icmp.c.

◆ Ip4ProcessIcmpRedirect()

EFI_STATUS Ip4ProcessIcmpRedirect ( IN IP4_SERVICE IpSb,
IN IP4_HEAD Head,
IN NET_BUF Packet,
IN IP4_ICMP_ERROR_HEAD Icmp 
)

Process the ICMP redirect. Find the instance then update its route cache.

All kinds of redirect is treated as host redirect as specified by RFC1122 3.3.1.2: "Since the subnet mask appropriate to the destination address is generally not known, a Network Redirect message SHOULD be treated identically to a Host Redirect message;"

Parameters
[in]IpSbThe IP4 service binding instance that received the packet.
[in]HeadThe IP head of the received ICMPpacket.
[in]PacketThe content of the ICMP redirect packet with IP head removed.
[in]IcmpThe buffer to store the ICMP error message if something is wrong.
Return values
EFI_INVALID_PARAMETERThe parameter is invalid
EFI_SUCCESSSuccessfully updated the route caches

Definition at line 88 of file Ip4Icmp.c.

Variable Documentation

◆ mIcmpClass

IP4_ICMP_CLASS mIcmpClass[]
Initial value:
= {
{ ICMP_ECHO_REPLY, ICMP_QUERY_MESSAGE },
{ 1, ICMP_INVALID_MESSAGE },
{ 2, ICMP_INVALID_MESSAGE },
{ ICMP_DEST_UNREACHABLE, ICMP_ERROR_MESSAGE },
{ ICMP_SOURCE_QUENCH, ICMP_ERROR_MESSAGE },
{ ICMP_REDIRECT, ICMP_ERROR_MESSAGE },
{ 6, ICMP_INVALID_MESSAGE },
{ 7, ICMP_INVALID_MESSAGE },
{ ICMP_ECHO_REQUEST, ICMP_QUERY_MESSAGE },
{ 9, ICMP_INVALID_MESSAGE },
{ 10, ICMP_INVALID_MESSAGE },
{ ICMP_TIME_EXCEEDED, ICMP_ERROR_MESSAGE },
{ ICMP_PARAMETER_PROBLEM, ICMP_ERROR_MESSAGE },
{ ICMP_TIMESTAMP, ICMP_QUERY_MESSAGE },
{ 14, ICMP_INVALID_MESSAGE },
{ ICMP_INFO_REQUEST, ICMP_QUERY_MESSAGE },
{ ICMP_INFO_REPLY, ICMP_QUERY_MESSAGE },
}

Definition at line 11 of file Ip4Icmp.c.

◆ mIp4SupportedIcmp

EFI_IP4_ICMP_TYPE mIp4SupportedIcmp[23]

Definition at line 32 of file Ip4Icmp.c.