diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c index b3a877c9ef..18be21846d 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c @@ -297,6 +297,7 @@ Ip4CreateService ( // IpSb->MaxPacketSize -= NET_VLAN_TAG_LEN; } + IpSb->OldMaxPacketSize = IpSb->MaxPacketSize; IpSb->MacString = NULL; *Service = IpSb; diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c index d888e18e4c..75333b82ef 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c @@ -510,20 +510,11 @@ Ip4IpSecProcessPacket ( if (mIpSec == NULL) { gBS->LocateProtocol (&gEfiIpSecProtocolGuid, NULL, (VOID **) &mIpSec); - if (mIpSec != NULL) { - // - // Save the original MTU - // - IpSb->OldMaxPacketSize = IpSb->MaxPacketSize; + if (mIpSec == NULL) { + goto ON_EXIT; } } - // - // Check whether the IPsec protocol is available. - // - if (mIpSec == NULL) { - goto ON_EXIT; - } // // Check whether the IPsec enable variable is set. //