diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
index 03297aa26c..1eaed05264 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
@@ -1,7 +1,7 @@
/** @file
IP4 input process.
-Copyright (c) 2005 - 2009, Intel Corporation.
+Copyright (c) 2005 - 2010, Intel Corporation.
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -881,11 +881,11 @@ Ip4InstanceFrameAcceptable (
//
// Use protocol from the IP header embedded in the ICMP error
// message to filter, instead of ICMP itself. ICMP handle will
- // can Ip4Demultiplex to deliver ICMP errors.
+ // call Ip4Demultiplex to deliver ICMP errors.
//
Proto = Head->Protocol;
- if (Proto == EFI_IP_PROTO_ICMP) {
+ if ((Proto == EFI_IP_PROTO_ICMP) && (!Config->AcceptAnyProtocol) && (Proto != Config->DefaultProtocol)) {
NetbufCopy (Packet, 0, sizeof (Icmp.Head), (UINT8 *) &Icmp.Head);
if (mIcmpClass[Icmp.Head.Type].IcmpClass == ICMP_ERROR_MESSAGE) {