};\r
\r
ICMP_ERROR_INFO mIcmpErrMap[10] = {\r
- { EFI_NETWORK_UNREACHABLE, FALSE, TRUE }, // ICMP_ERR_UNREACH_NET\r
- { EFI_HOST_UNREACHABLE, FALSE, TRUE }, // ICMP_ERR_UNREACH_HOST\r
- { EFI_PROTOCOL_UNREACHABLE, TRUE, TRUE }, // ICMP_ERR_UNREACH_PROTOCOL\r
- { EFI_PORT_UNREACHABLE, TRUE, TRUE }, // ICMP_ERR_UNREACH_PORT\r
- { EFI_ICMP_ERROR, TRUE, TRUE }, // ICMP_ERR_MSGSIZE\r
- { EFI_ICMP_ERROR, FALSE, TRUE }, // ICMP_ERR_UNREACH_SRCFAIL\r
- { EFI_HOST_UNREACHABLE, FALSE, TRUE }, // ICMP_ERR_TIMXCEED_INTRANS\r
- { EFI_HOST_UNREACHABLE, FALSE, TRUE }, // ICMP_ERR_TIMEXCEED_REASS\r
- { EFI_ICMP_ERROR, FALSE, FALSE }, // ICMP_ERR_QUENCH\r
- { EFI_ICMP_ERROR, FALSE, TRUE } // ICMP_ERR_PARAMPROB\r
+ {FALSE, TRUE }, // ICMP_ERR_UNREACH_NET\r
+ {FALSE, TRUE }, // ICMP_ERR_UNREACH_HOST\r
+ {TRUE, TRUE }, // ICMP_ERR_UNREACH_PROTOCOL\r
+ {TRUE, TRUE }, // ICMP_ERR_UNREACH_PORT\r
+ {TRUE, TRUE }, // ICMP_ERR_MSGSIZE\r
+ {FALSE, TRUE }, // ICMP_ERR_UNREACH_SRCFAIL\r
+ {FALSE, TRUE }, // ICMP_ERR_TIMXCEED_INTRANS\r
+ {FALSE, TRUE }, // ICMP_ERR_TIMEXCEED_REASS\r
+ {FALSE, FALSE}, // ICMP_ERR_QUENCH\r
+ {FALSE, TRUE } // ICMP_ERR_PARAMPROB\r
};\r
\r
ICMP_ERROR_INFO mIcmp6ErrMap[10] = {\r
- { EFI_NETWORK_UNREACHABLE, FALSE, TRUE }, // ICMP6_ERR_UNREACH_NET\r
- { EFI_HOST_UNREACHABLE, FALSE, TRUE }, // ICMP6_ERR_UNREACH_HOST\r
- { EFI_PROTOCOL_UNREACHABLE, TRUE, TRUE }, // ICMP6_ERR_UNREACH_PROTOCOL\r
- { EFI_PORT_UNREACHABLE, TRUE, TRUE }, // ICMP6_ERR_UNREACH_PORT \r
- { EFI_ICMP_ERROR, TRUE, TRUE }, // ICMP6_ERR_PACKAGE_TOOBIG\r
- { EFI_HOST_UNREACHABLE, FALSE, TRUE }, // ICMP6_ERR_TIMXCEED_HOPLIMIT\r
- { EFI_HOST_UNREACHABLE, FALSE, TRUE }, // ICMP_ERR_TIMEXCEED_REASS\r
- { EFI_ICMP_ERROR, FALSE, TRUE }, // ICMP_ERR_PARAMPROB_HEADER \r
- { EFI_ICMP_ERROR, FALSE, TRUE }, // ICMP_ERR_PARAMPROB_NEXHEADER\r
- { EFI_ICMP_ERROR, FALSE, TRUE } // ICMP_ERR_PARAMPROB_IPV6OPTION\r
+ {FALSE, TRUE}, // ICMP6_ERR_UNREACH_NET\r
+ {FALSE, TRUE}, // ICMP6_ERR_UNREACH_HOST\r
+ {TRUE, TRUE}, // ICMP6_ERR_UNREACH_PROTOCOL\r
+ {TRUE, TRUE}, // ICMP6_ERR_UNREACH_PORT \r
+ {TRUE, TRUE}, // ICMP6_ERR_PACKAGE_TOOBIG\r
+ {FALSE, TRUE}, // ICMP6_ERR_TIMXCEED_HOPLIMIT\r
+ {FALSE, TRUE}, // ICMP6_ERR_TIMXCEED_REASS\r
+ {FALSE, TRUE}, // ICMP6_ERR_PARAMPROB_HEADER \r
+ {FALSE, TRUE}, // ICMP6_ERR_PARAMPROB_NEXHEADER\r
+ {FALSE, TRUE} // ICMP6_ERR_PARAMPROB_IPV6OPTION\r
};\r
\r
\r
IN EFI_HANDLE ControllerHandle,\r
IN EFI_HANDLE ImageHandle,\r
IN EFI_HANDLE *ChildHandle,\r
- IN IP_VERSION IpVersion, \r
+ IN UINT8 IpVersion,\r
OUT VOID **Interface\r
)\r
{\r
IN EFI_HANDLE ControllerHandle,\r
IN EFI_HANDLE ImageHandle,\r
IN EFI_HANDLE ChildHandle,\r
- IN IP_VERSION IpVersion\r
+ IN UINT8 IpVersion\r
)\r
{\r
EFI_STATUS Status;\r
{\r
IP4_ICMP_ERROR_HEAD *IcmpHdr;\r
EFI_IP4_HEADER *IpHdr;\r
- ICMP_ERROR IcmpErr;\r
+ UINT8 IcmpErr;\r
UINT8 *PayLoadHdr;\r
UINT8 Type;\r
UINT8 Code;\r
case ICMP_CODE_UNREACH_PROTOCOL:\r
case ICMP_CODE_UNREACH_PORT:\r
case ICMP_CODE_UNREACH_SRCFAIL:\r
- IcmpErr = (ICMP_ERROR) (ICMP_ERR_UNREACH_NET + Code);\r
+ IcmpErr = (UINT8) (ICMP_ERR_UNREACH_NET + Code);\r
\r
break;\r
\r
return EFI_ABORTED;\r
}\r
\r
- IcmpErr = (ICMP_ERROR) (Code + ICMP_ERR_TIMXCEED_INTRANS);\r
+ IcmpErr = (UINT8) (Code + ICMP_ERR_TIMXCEED_INTRANS);\r
\r
break;\r
\r
{\r
IP6_ICMP_ERROR_HEAD *IcmpHdr;\r
EFI_IP6_HEADER *IpHdr;\r
- ICMP6_ERROR IcmpErr;\r
+ UINT8 IcmpErr;\r
UINT8 *PayLoadHdr;\r
UINT8 Type;\r
UINT8 Code;\r
return EFI_ABORTED;\r
}\r
\r
- IcmpErr = (ICMP6_ERROR) (ICMP6_ERR_TIMXCEED_HOPLIMIT + Code);\r
+ IcmpErr = (UINT8) (ICMP6_ERR_TIMXCEED_HOPLIMIT + Code);\r
\r
break;\r
\r
return EFI_ABORTED;\r
}\r
\r
- IcmpErr = (ICMP6_ERROR) (ICMP6_ERR_PARAMPROB_HEADER + Code);\r
+ IcmpErr = (UINT8) (ICMP6_ERR_PARAMPROB_HEADER + Code);\r
\r
break;\r
\r
\r
NetbufTrim (Pkt, TrimBytes, TRUE);\r
\r
- IpIo->PktRcvdNotify (EFI_ICMP_ERROR, (ICMP_ERROR) IcmpErr, Session, Pkt, IpIo->RcvdContext);\r
+ IpIo->PktRcvdNotify (EFI_ICMP_ERROR, IcmpErr, Session, Pkt, IpIo->RcvdContext);\r
\r
return EFI_SUCCESS;\r
}\r
\r
if (IpIo->IpVersion == IP_VERSION_4) {\r
if ((EFI_IP4 (RxData->Ip4RxData.Header->SourceAddress) != 0) &&\r
- !Ip4IsUnicast (EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) RxData)->Header->SourceAddress), 0)) {\r
+ !NetIp4IsUnicast (EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) RxData)->Header->SourceAddress), 0)) {\r
//\r
// The source address is not zero and it's not a unicast IP address, discard it.\r
//\r
Session.IpVersion = IP_VERSION_4;\r
} else {\r
\r
- if (!Ip6IsValidUnicast(&RxData->Ip6RxData.Header->SourceAddress)) {\r
+ if (!NetIp6IsValidUnicast(&RxData->Ip6RxData.Header->SourceAddress)) {\r
goto CleanUp;\r
}\r
\r
\r
if (EFI_SUCCESS == Status) {\r
\r
- IpIo->PktRcvdNotify (EFI_SUCCESS, (ICMP_ERROR) 0, &Session, Pkt, IpIo->RcvdContext);\r
+ IpIo->PktRcvdNotify (EFI_SUCCESS, 0, &Session, Pkt, IpIo->RcvdContext);\r
} else {\r
//\r
// Status is EFI_ICMP_ERROR\r
IpIoCreate (\r
IN EFI_HANDLE Image,\r
IN EFI_HANDLE Controller,\r
- IN IP_VERSION IpVersion \r
+ IN UINT8 IpVersion\r
)\r
{\r
EFI_STATUS Status;\r
{\r
EFI_STATUS Status;\r
VOID *Ip;\r
- IP_VERSION IpVersion;\r
+ UINT8 IpVersion;\r
\r
if (IpIo->IsConfigured) {\r
return EFI_ACCESS_DENIED;\r
EFI_STATUS Status;\r
VOID *Ip;\r
IP_IO_IP_INFO *IpInfo;\r
- IP_VERSION IpVersion;\r
+ UINT8 IpVersion;\r
\r
if (!IpIo->IsConfigured) {\r
return EFI_SUCCESS;\r
{\r
EFI_STATUS Status;\r
VOID *Ip;\r
- IP_VERSION IpVersion;\r
+ UINT8 IpVersion;\r
EFI_IP4_MODE_DATA Ip4ModeData;\r
EFI_IP6_MODE_DATA Ip6ModeData;\r
\r
)\r
{\r
\r
- IP_VERSION IpVersion;\r
+ UINT8 IpVersion;\r
\r
ASSERT (IpInfo->RefCnt > 0);\r
\r
EFIAPI\r
IpIoFindSender (\r
IN OUT IP_IO **IpIo,\r
- IN IP_VERSION IpVersion,\r
+ IN UINT8 IpVersion,\r
IN EFI_IP_ADDRESS *Src\r
)\r
{\r
EFI_STATUS\r
EFIAPI\r
IpIoGetIcmpErrStatus (\r
- IN ICMP_ERROR IcmpError,\r
- IN IP_VERSION IpVersion,\r
+ IN UINT8 IcmpError,\r
+ IN UINT8 IpVersion,\r
OUT BOOLEAN *IsHard OPTIONAL,\r
OUT BOOLEAN *Notify OPTIONAL\r
)\r
{\r
- if (IpVersion == IP_VERSION_4 ){\r
- ASSERT ((IcmpError >= ICMP_ERR_UNREACH_NET) && (IcmpError <= ICMP_ERR_PARAMPROB));\r
+ if (IpVersion == IP_VERSION_4 ) {\r
+ ASSERT (IcmpError <= ICMP_ERR_PARAMPROB);\r
\r
- if (IsHard != NULL) {\r
- *IsHard = mIcmpErrMap[IcmpError].IsHard;\r
- }\r
+ if (IsHard != NULL) {\r
+ *IsHard = mIcmpErrMap[IcmpError].IsHard;\r
+ }\r
\r
- if (Notify != NULL) {\r
- *Notify = mIcmpErrMap[IcmpError].Notify;\r
- }\r
+ if (Notify != NULL) {\r
+ *Notify = mIcmpErrMap[IcmpError].Notify;\r
+ }\r
+\r
+ switch (IcmpError) {\r
+ case ICMP_ERR_UNREACH_NET:\r
+ return EFI_NETWORK_UNREACHABLE;\r
+\r
+ case ICMP_ERR_TIMXCEED_INTRANS:\r
+ case ICMP_ERR_TIMXCEED_REASS:\r
+ case ICMP_ERR_UNREACH_HOST:\r
+ return EFI_HOST_UNREACHABLE;\r
+\r
+ case ICMP_ERR_UNREACH_PROTOCOL:\r
+ return EFI_PROTOCOL_UNREACHABLE;\r
+\r
+ case ICMP_ERR_UNREACH_PORT:\r
+ return EFI_PORT_UNREACHABLE;\r
+\r
+ case ICMP_ERR_MSGSIZE:\r
+ case ICMP_ERR_UNREACH_SRCFAIL:\r
+ case ICMP_ERR_QUENCH:\r
+ case ICMP_ERR_PARAMPROB:\r
+ return EFI_ICMP_ERROR;\r
+\r
+ default:\r
+ ASSERT (FALSE);\r
+ return EFI_UNSUPPORTED;\r
+ }\r
\r
- return mIcmpErrMap[IcmpError].Error;\r
} else if (IpVersion == IP_VERSION_6) {\r
\r
- ASSERT ((IcmpError >= ICMP6_ERR_UNREACH_NET) && (IcmpError <= ICMP6_ERR_PARAMPROB_IPV6OPTION));\r
+ ASSERT (IcmpError <= ICMP6_ERR_PARAMPROB_IPV6OPTION);\r
\r
if (IsHard != NULL) {\r
*IsHard = mIcmp6ErrMap[IcmpError].IsHard;\r
if (Notify != NULL) {\r
*Notify = mIcmp6ErrMap[IcmpError].Notify;\r
}\r
- return mIcmp6ErrMap[IcmpError].Error;\r
+\r
+ switch (IcmpError) {\r
+ case ICMP6_ERR_UNREACH_NET:\r
+ return EFI_NETWORK_UNREACHABLE;\r
+\r
+ case ICMP6_ERR_UNREACH_HOST:\r
+ case ICMP6_ERR_TIMXCEED_HOPLIMIT:\r
+ case ICMP6_ERR_TIMXCEED_REASS: \r
+ return EFI_HOST_UNREACHABLE;\r
+\r
+ case ICMP6_ERR_UNREACH_PROTOCOL:\r
+ return EFI_PROTOCOL_UNREACHABLE;\r
+ \r
+ case ICMP6_ERR_UNREACH_PORT:\r
+ return EFI_PORT_UNREACHABLE;\r
+\r
+ case ICMP6_ERR_PACKAGE_TOOBIG:\r
+ case ICMP6_ERR_PARAMPROB_HEADER:\r
+ case ICMP6_ERR_PARAMPROB_NEXHEADER:\r
+ case ICMP6_ERR_PARAMPROB_IPV6OPTION:\r
+ return EFI_ICMP_ERROR;\r
+\r
+ default:\r
+ ASSERT (FALSE);\r
+ return EFI_UNSUPPORTED;\r
+ }\r
\r
} else {\r
//\r