]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg: Remove redundant check in PXE driver.
authorFu Siyuan <siyuan.fu@intel.com>
Thu, 21 Dec 2017 07:31:22 +0000 (15:31 +0800)
committerFu Siyuan <siyuan.fu@intel.com>
Fri, 22 Dec 2017 07:34:19 +0000 (15:34 +0800)
The IP protocol has been configured to only receive ICMP packet in PXE driver.
So this patch removes the unnecessary check for NextHeader field and replace it
with ASSERT.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c

index dfc79a067b9b9572cff4c7f981b617de2e48a992..720287583e5ff12ba8e065fbf005f8ef8cf9b436 100644 (file)
@@ -279,14 +279,11 @@ PxeBcIcmpErrorDpcHandle (
     gBS->SignalEvent (RxData->RecycleSignal);\r
     goto ON_EXIT;\r
   }\r
-\r
-  if (RxData->Header->Protocol != EFI_IP_PROTO_ICMP) {\r
-    //\r
-    // The protocol value in the header of the receveid packet should be EFI_IP_PROTO_ICMP.\r
-    //\r
-    gBS->SignalEvent (RxData->RecycleSignal);\r
-    goto ON_EXIT;\r
-  }\r
+  \r
+  //\r
+  // The protocol has been configured to only receive ICMP packet.\r
+  //\r
+  ASSERT (RxData->Header->Protocol == EFI_IP_PROTO_ICMP);\r
 \r
   Type = *((UINT8 *) RxData->FragmentTable[0].FragmentBuffer);\r
 \r
@@ -416,13 +413,10 @@ PxeBcIcmp6ErrorDpcHandle (
     goto ON_EXIT;\r
   }\r
 \r
-  if (RxData->Header->NextHeader != IP6_ICMP) {\r
-    //\r
-    // The nextheader in the header of the receveid packet should be IP6_ICMP.\r
-    //\r
-    gBS->SignalEvent (RxData->RecycleSignal);\r
-    goto ON_EXIT;\r
-  }\r
+  //\r
+  // The protocol has been configured to only receive ICMP packet.\r
+  //\r
+  ASSERT (RxData->Header->NextHeader == IP6_ICMP);\r
 \r
   Type = *((UINT8 *) RxData->FragmentTable[0].FragmentBuffer);\r
 \r