NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-)
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.
Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
index dfc79a067b..720287583e 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
@@ -279,14 +279,11 @@ PxeBcIcmpErrorDpcHandle (
gBS->SignalEvent (RxData->RecycleSignal);
goto ON_EXIT;
}
-
- if (RxData->Header->Protocol != EFI_IP_PROTO_ICMP) {
- //
- // The protocol value in the header of the receveid packet should be EFI_IP_PROTO_ICMP.
- //
- gBS->SignalEvent (RxData->RecycleSignal);
- goto ON_EXIT;
- }
+
+ //
+ // The protocol has been configured to only receive ICMP packet.
+ //
+ ASSERT (RxData->Header->Protocol == EFI_IP_PROTO_ICMP);
Type = *((UINT8 *) RxData->FragmentTable[0].FragmentBuffer);
@@ -416,13 +413,10 @@ PxeBcIcmp6ErrorDpcHandle (
goto ON_EXIT;
}
- if (RxData->Header->NextHeader != IP6_ICMP) {
- //
- // The nextheader in the header of the receveid packet should be IP6_ICMP.
- //
- gBS->SignalEvent (RxData->RecycleSignal);
- goto ON_EXIT;
- }
+ //
+ // The protocol has been configured to only receive ICMP packet.
+ //
+ ASSERT (RxData->Header->NextHeader == IP6_ICMP);
Type = *((UINT8 *) RxData->FragmentTable[0].FragmentBuffer);
--
2.13.0.windows.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Fu,
> Siyuan
> Sent: Thursday, December 21, 2017 3:46 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting.ye@intel.com>; Wang, Fan <fan.wang@intel.com>; Wu,
> Jiaxin <jiaxin.wu@intel.com>
> Subject: [edk2] [Patch] NetworkPkg: Remove redundant check in PXE driver.
>
> 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.
>
> Cc: Ye Ting <ting.ye@intel.com>
> Cc: Wu Jiaxin <jiaxin.wu@intel.com>
> Cc: Wang Fan <fan.wang@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
> ---
> NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 24 +++++++++---------------
> 1 file changed, 9 insertions(+), 15 deletions(-)
>
> diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
> b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
> index dfc79a067b..720287583e 100644
> --- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
> +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
> @@ -279,14 +279,11 @@ PxeBcIcmpErrorDpcHandle (
> gBS->SignalEvent (RxData->RecycleSignal);
> goto ON_EXIT;
> }
> -
> - if (RxData->Header->Protocol != EFI_IP_PROTO_ICMP) {
> - //
> - // The protocol value in the header of the receveid packet should be
> EFI_IP_PROTO_ICMP.
> - //
> - gBS->SignalEvent (RxData->RecycleSignal);
> - goto ON_EXIT;
> - }
> +
> + //
> + // The protocol has been configured to only receive ICMP packet.
> + //
> + ASSERT (RxData->Header->Protocol == EFI_IP_PROTO_ICMP);
>
> Type = *((UINT8 *) RxData->FragmentTable[0].FragmentBuffer);
>
> @@ -416,13 +413,10 @@ PxeBcIcmp6ErrorDpcHandle (
> goto ON_EXIT;
> }
>
> - if (RxData->Header->NextHeader != IP6_ICMP) {
> - //
> - // The nextheader in the header of the receveid packet should be
> IP6_ICMP.
> - //
> - gBS->SignalEvent (RxData->RecycleSignal);
> - goto ON_EXIT;
> - }
> + //
> + // The protocol has been configured to only receive ICMP packet.
> + //
> + ASSERT (RxData->Header->NextHeader == IP6_ICMP);
>
> Type = *((UINT8 *) RxData->FragmentTable[0].FragmentBuffer);
>
> --
> 2.13.0.windows.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2025 Red Hat, Inc.