\r
@param[in, out] IpIo The pointer to the IP_IO instance that needs to stop.\r
\r
- @retval EFI_SUCCESS The IP_IO instance stopped successfully.\r
- @retval Others Anrror condition occurred.\r
+ @retval EFI_SUCCESS The IP_IO instance stopped successfully.\r
+ @retval EFI_INVALID_PARAMETER Invalid input parameter.\r
+ @retval Others Anrror condition occurred.\r
\r
**/\r
EFI_STATUS\r
@param[in] OpenData The configuration data and callbacks for\r
the IP_IO instance.\r
\r
- @retval EFI_SUCCESS The IP_IO instance opened with OpenData\r
- successfully.\r
- @retval EFI_ACCESS_DENIED The IP_IO instance is configured; avoid \r
- reopening it.\r
- @retval EFI_UNSUPPORTED IPv4 RawData mode is no supported.\r
- @retval Others An error condition occurred.\r
+ @retval EFI_SUCCESS The IP_IO instance opened with OpenData\r
+ successfully.\r
+ @retval EFI_ACCESS_DENIED The IP_IO instance is configured, avoid to \r
+ reopen it.\r
+ @retval EFI_UNSUPPORTED IPv4 RawData mode is no supported.\r
+ @retval EFI_INVALID_PARAMETER Invalid input parameter.\r
+ @retval Others Error condition occurred.\r
\r
**/\r
EFI_STATUS\r
@param[in] Src The local IP address.\r
\r
@return The pointer to the IP protocol can be used for sending purpose and its local\r
- address is the same with Src.\r
+ address is the same with Src. NULL if failed.\r
\r
**/\r
IP_IO_IP_INFO *\r
UINT8 Type;\r
UINT8 Code;\r
UINT32 TrimBytes;\r
-\r
+ \r
+ ASSERT (IpIo != NULL);\r
+ ASSERT (Pkt != NULL);\r
+ ASSERT (Session != NULL);\r
ASSERT (IpIo->IpVersion == IP_VERSION_4);\r
-\r
- IcmpHdr = NET_PROTO_HDR (Pkt, IP4_ICMP_ERROR_HEAD);\r
- IpHdr = (EFI_IP4_HEADER *) (&IcmpHdr->IpHead);\r
-\r
+ \r
//\r
// Check the ICMP packet length.\r
//\r
+ if (Pkt->TotalSize < sizeof (IP4_ICMP_ERROR_HEAD)) {\r
+ return EFI_ABORTED;\r
+ }\r
+ \r
+ IcmpHdr = NET_PROTO_HDR (Pkt, IP4_ICMP_ERROR_HEAD);\r
+ IpHdr = (EFI_IP4_HEADER *) (&IcmpHdr->IpHead);\r
+\r
if (Pkt->TotalSize < ICMP_ERRLEN (IpHdr)) {\r
\r
return EFI_ABORTED;\r
UINT32 TrimBytes;\r
BOOLEAN Flag;\r
\r
+ ASSERT (IpIo != NULL);\r
+ ASSERT (Pkt != NULL);\r
+ ASSERT (Session != NULL);\r
ASSERT (IpIo->IpVersion == IP_VERSION_6);\r
\r
//\r
}\r
\r
if (IpIo->IpVersion == IP_VERSION_4) {\r
+ ASSERT (RxData->Ip4RxData.Header != NULL);\r
if (IP4_IS_LOCAL_BROADCAST (EFI_IP4 (RxData->Ip4RxData.Header->SourceAddress))) {\r
//\r
// The source address is a broadcast address, discard it.\r
goto CleanUp;\r
}\r
\r
+ //\r
+ // The fragment should always be valid for non-zero length packet.\r
+ //\r
+ ASSERT (RxData->Ip4RxData.FragmentCount != 0);\r
+\r
//\r
// Create a netbuffer representing IPv4 packet\r
//\r
Session.IpHdrLen = RxData->Ip4RxData.HeaderLength;\r
Session.IpVersion = IP_VERSION_4;\r
} else {\r
-\r
+ ASSERT (RxData->Ip6RxData.Header != NULL);\r
if (!NetIp6IsValidUnicast(&RxData->Ip6RxData.Header->SourceAddress)) {\r
goto CleanUp;\r
}\r
goto CleanUp;\r
}\r
\r
+ //\r
+ // The fragment should always be valid for non-zero length packet.\r
+ //\r
+ ASSERT (RxData->Ip6RxData.FragmentCount != 0);\r
+ \r
//\r
// Create a netbuffer representing IPv6 packet\r
//\r
@param[in] OpenData The configuration data and callbacks for\r
the IP_IO instance.\r
\r
- @retval EFI_SUCCESS The IP_IO instance opened with OpenData\r
- successfully.\r
- @retval EFI_ACCESS_DENIED The IP_IO instance is configured, avoid to \r
- reopen it.\r
- @retval EFI_UNSUPPORTED IPv4 RawData mode is no supported.\r
- @retval Others Error condition occurred.\r
+ @retval EFI_SUCCESS The IP_IO instance opened with OpenData\r
+ successfully.\r
+ @retval EFI_ACCESS_DENIED The IP_IO instance is configured, avoid to \r
+ reopen it.\r
+ @retval EFI_UNSUPPORTED IPv4 RawData mode is no supported.\r
+ @retval EFI_INVALID_PARAMETER Invalid input parameter.\r
+ @retval Others Error condition occurred.\r
\r
**/\r
EFI_STATUS\r
EFI_STATUS Status;\r
UINT8 IpVersion;\r
\r
+ if (IpIo == NULL || OpenData == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
if (IpIo->IsConfigured) {\r
return EFI_ACCESS_DENIED;\r
}\r
\r
@param[in, out] IpIo Pointer to the IP_IO instance that needs to stop.\r
\r
- @retval EFI_SUCCESS The IP_IO instance stopped successfully.\r
- @retval Others Error condition occurred.\r
+ @retval EFI_SUCCESS The IP_IO instance stopped successfully.\r
+ @retval EFI_INVALID_PARAMETER Invalid input parameter.\r
+ @retval Others Error condition occurred.\r
\r
**/\r
EFI_STATUS\r
IP_IO_IP_INFO *IpInfo;\r
UINT8 IpVersion;\r
\r
+ if (IpIo == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
if (!IpIo->IsConfigured) {\r
return EFI_SUCCESS;\r
}\r
{\r
\r
UINT8 IpVersion;\r
+ \r
+ if (IpIo == NULL || IpInfo == NULL) {\r
+ return;\r
+ }\r
\r
ASSERT (IpInfo->RefCnt > 0);\r
\r
@param[in] Src The local IP address.\r
\r
@return Pointer to the IP protocol can be used for sending purpose and its local\r
- address is the same with Src.\r
+ address is the same with Src. NULL if failed.\r
\r
**/\r
IP_IO_IP_INFO *\r
LIST_ENTRY *IpInfoEntry;\r
IP_IO_IP_INFO *IpInfo;\r
\r
- ASSERT ((IpVersion == IP_VERSION_4) || (IpVersion == IP_VERSION_6)); \r
+ if (IpIo == NULL || Src == NULL) {\r
+ return NULL;\r
+ }\r
+\r
+ if ((IpVersion != IP_VERSION_4) && (IpVersion != IP_VERSION_6)) {\r
+ return NULL;\r
+ }\r
\r
NET_LIST_FOR_EACH (IpIoEntry, &mActiveIpIoList) {\r
IpIoPtr = NET_LIST_USER_STRUCT (IpIoEntry, IP_IO, Entry);\r