Re: [edk2] [Patch] MdeModulePkg: Fix IPv4 stack potential disappeared issue

2016-07-06 Thread Fu, Siyuan
Reviewed-by: Fu Siyuan <siyuan...@intel.com>


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Jiaxin Wu
> Sent: Thursday, June 30, 2016 3:59 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com>; Fu,
> Siyuan <siyuan...@intel.com>
> Subject: [edk2] [Patch] MdeModulePkg: Fix IPv4 stack potential disappeared
> issue
> 
> IP4_CONFIG2_INSTANCE->DataItem is used to save the configuration
> data to NV variable. When the policy is changed from static to
> DHCP, DnsServers info will be cleaned from DataItem first
> (See Ip4Config2SetPolicy), it's correct because DnsServers info
> should not be saved to NV variable.
> But if there is any DnsServers info received from DHCP message, it
> will be reset to DataItem again (See Ip4Config2SetDnsServerWorker),
> which may cause the NV variable contain the DnsServers info while
> the policy is DHCP (See Ip4Config2WriteConfigData).
> Then, while the platform is reset, the issue happened. Because
> Ip4Config2DataTypeDnsServer is set under DHCP policy, which is not
> allowed by UEFI Spec and error returned.
> 
> This patch is used to resolve this potential issue.
> 
> Cc: Ye Ting <ting...@intel.com>
> Cc: Fu Siyuan <siyuan...@intel.com>
> Cc: Zhang Lubo <lubo.zh...@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>
> ---
>  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 12
> +++-
>  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h |  1 +
>  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c  |  4 
>  3 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> index 028c61d..f91a935 100644
> --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> @@ -1058,11 +1058,10 @@ Ip4Config2GetIfInfo (
>IN IP4_CONFIG2_INSTANCE *Instance,
>IN OUT UINTN*DataSize,
>IN VOID *Data  OPTIONAL
>)
>  {
> -
>IP4_SERVICE*IpSb;
>UINTN  Length;
>IP4_CONFIG2_DATA_ITEM  *Item;
>EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo;
>IP4_ADDR   Address;
> @@ -1177,10 +1176,11 @@ Ip4Config2SetPolicy (
>  FreePool (DataItem->Data.Ptr);
>}
>DataItem->Data.Ptr = NULL;
>DataItem->DataSize = 0;
>DataItem->Status   = EFI_NOT_FOUND;
> +  SET_DATA_ATTRIB (DataItem->Attribute, DATA_ATTRIB_VOLATILE);
>NetMapIterate (>EventMap, Ip4Config2SignalEvent, NULL);
>  } else {
>//
>// The policy is changed from dhcp to static. Stop the DHCPv4 process
>// and destroy the DHCPv4 child.
> @@ -1457,14 +1457,24 @@ Ip4Config2SetDnsServer (
>IN IP4_CONFIG2_INSTANCE *Instance,
>IN UINTNDataSize,
>IN VOID *Data
>)
>  {
> +  IP4_CONFIG2_DATA_ITEM *Item;
> +
> +  Item = NULL;
> +
>if (Instance->Policy != Ip4Config2PolicyStatic) {
>  return EFI_WRITE_PROTECTED;
>}
> 
> +  Item = >DataItem[Ip4Config2DataTypeDnsServer];
> +
> +  if (DATA_ATTRIB_SET (Item->Attribute, DATA_ATTRIB_VOLATILE)) {
> +REMOVE_DATA_ATTRIB (Item->Attribute, DATA_ATTRIB_VOLATILE);
> +  }
> +
>return Ip4Config2SetDnsServerWorker (Instance, DataSize, Data);
>  }
> 
>  /**
>Generate the operational state of the interface this IP4 config2 instance
> manages
> diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h
> b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h
> index b2665bd..b6da11f 100644
> --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h
> +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h
> @@ -25,10 +25,11 @@
>  #define DATA_ATTRIB_SIZE_FIXED  0x1
>  #define DATA_ATTRIB_VOLATILE0x2
> 
>  #define DATA_ATTRIB_SET(Attrib, Bits)   (BOOLEAN)((Attrib) & (Bits))
>  #define SET_DATA_ATTRIB(Attrib, Bits)   ((Attrib) |= (Bits))
> +#define REMOVE_DATA_ATTRIB(Attrib, Bits)((Attrib) &= (~Bits))
> 
>  typedef struct _IP4_CONFIG2_INSTANCE IP4_CONFIG2_INSTANCE;
> 
>  #define IP4_CONFIG2_INSTANCE_FROM_PROTOCOL(Proto) \
>CR ((Proto), \
> diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
> b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
> index fcd3ccb..20bc21f 100644
> --- a/MdeModulePkg/Un

Re: [edk2] [Patch] MdeModulePkg: Fix IPv4 stack potential disappeared issue

2016-07-06 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com>


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiaxin Wu
Sent: Thursday, June 30, 2016 3:59 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com>; Fu, 
Siyuan <siyuan...@intel.com>
Subject: [edk2] [Patch] MdeModulePkg: Fix IPv4 stack potential disappeared issue

IP4_CONFIG2_INSTANCE->DataItem is used to save the configuration data to NV 
variable. When the policy is changed from static to DHCP, DnsServers info will 
be cleaned from DataItem first (See Ip4Config2SetPolicy), it's correct because 
DnsServers info should not be saved to NV variable.
But if there is any DnsServers info received from DHCP message, it will be 
reset to DataItem again (See Ip4Config2SetDnsServerWorker), which may cause the 
NV variable contain the DnsServers info while the policy is DHCP (See 
Ip4Config2WriteConfigData).
Then, while the platform is reset, the issue happened. Because 
Ip4Config2DataTypeDnsServer is set under DHCP policy, which is not allowed by 
UEFI Spec and error returned.

This patch is used to resolve this potential issue.

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Zhang Lubo <lubo.zh...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>
---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 12 +++-  
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h |  1 +
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c  |  4 
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
index 028c61d..f91a935 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
@@ -1058,11 +1058,10 @@ Ip4Config2GetIfInfo (
   IN IP4_CONFIG2_INSTANCE *Instance,
   IN OUT UINTN*DataSize,
   IN VOID *Data  OPTIONAL
   )
 {
-
   IP4_SERVICE*IpSb;
   UINTN  Length;
   IP4_CONFIG2_DATA_ITEM  *Item;
   EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo;
   IP4_ADDR   Address;
@@ -1177,10 +1176,11 @@ Ip4Config2SetPolicy (
 FreePool (DataItem->Data.Ptr);
   }
   DataItem->Data.Ptr = NULL;
   DataItem->DataSize = 0;
   DataItem->Status   = EFI_NOT_FOUND;
+  SET_DATA_ATTRIB (DataItem->Attribute, DATA_ATTRIB_VOLATILE);
   NetMapIterate (>EventMap, Ip4Config2SignalEvent, NULL);
 } else {
   //
   // The policy is changed from dhcp to static. Stop the DHCPv4 process
   // and destroy the DHCPv4 child.
@@ -1457,14 +1457,24 @@ Ip4Config2SetDnsServer (
   IN IP4_CONFIG2_INSTANCE *Instance,
   IN UINTNDataSize,
   IN VOID *Data
   )
 {
+  IP4_CONFIG2_DATA_ITEM *Item;
+
+  Item = NULL;
+
   if (Instance->Policy != Ip4Config2PolicyStatic) {
 return EFI_WRITE_PROTECTED;
   }
 
+  Item = >DataItem[Ip4Config2DataTypeDnsServer];
+
+  if (DATA_ATTRIB_SET (Item->Attribute, DATA_ATTRIB_VOLATILE)) {
+REMOVE_DATA_ATTRIB (Item->Attribute, DATA_ATTRIB_VOLATILE);  }
+
   return Ip4Config2SetDnsServerWorker (Instance, DataSize, Data);  }
 
 /**
   Generate the operational state of the interface this IP4 config2 instance 
manages diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h
index b2665bd..b6da11f 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h
@@ -25,10 +25,11 @@
 #define DATA_ATTRIB_SIZE_FIXED  0x1
 #define DATA_ATTRIB_VOLATILE0x2
 
 #define DATA_ATTRIB_SET(Attrib, Bits)   (BOOLEAN)((Attrib) & (Bits))
 #define SET_DATA_ATTRIB(Attrib, Bits)   ((Attrib) |= (Bits))
+#define REMOVE_DATA_ATTRIB(Attrib, Bits)((Attrib) &= (~Bits))
 
 typedef struct _IP4_CONFIG2_INSTANCE IP4_CONFIG2_INSTANCE;
 
 #define IP4_CONFIG2_INSTANCE_FROM_PROTOCOL(Proto) \
   CR ((Proto), \
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
index fcd3ccb..20bc21f 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
@@ -596,10 +596,14 @@ Ip4DriverBindingStart (
   DataItem->Data.Ptr
   );
   if (EFI_ERROR(Status)) {
 goto UNINSTALL_PROTOCOL;
   }
+  
+  if (Index == Ip4Config2DataTypePolicy && (*(DataItem->Data.Policy) == 
Ip4Config2PolicyDhcp)) {
+break;
+  }
 }
   }
  
   //
   // Ready to go: start the receiving and timer.
--
1.9.5.msysgit.1

_

Re: [edk2] [Patch] MdeModulePkg: Fix IPv4 stack potential disappeared issue

2016-07-05 Thread Zhang, Lubo
The patch is good to me, already tested.
Reviewed-by: Zhang Lubo <lubo.zh...@intel.com>

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiaxin Wu
Sent: Thursday, June 30, 2016 3:59 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com>; Fu, 
Siyuan <siyuan...@intel.com>
Subject: [edk2] [Patch] MdeModulePkg: Fix IPv4 stack potential disappeared issue

IP4_CONFIG2_INSTANCE->DataItem is used to save the configuration data to NV 
variable. When the policy is changed from static to DHCP, DnsServers info will 
be cleaned from DataItem first (See Ip4Config2SetPolicy), it's correct because 
DnsServers info should not be saved to NV variable.
But if there is any DnsServers info received from DHCP message, it will be 
reset to DataItem again (See Ip4Config2SetDnsServerWorker), which may cause the 
NV variable contain the DnsServers info while the policy is DHCP (See 
Ip4Config2WriteConfigData).
Then, while the platform is reset, the issue happened. Because 
Ip4Config2DataTypeDnsServer is set under DHCP policy, which is not allowed by 
UEFI Spec and error returned.

This patch is used to resolve this potential issue.

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Zhang Lubo <lubo.zh...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>
---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 12 +++-  
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h |  1 +
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c  |  4 
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
index 028c61d..f91a935 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
@@ -1058,11 +1058,10 @@ Ip4Config2GetIfInfo (
   IN IP4_CONFIG2_INSTANCE *Instance,
   IN OUT UINTN*DataSize,
   IN VOID *Data  OPTIONAL
   )
 {
-
   IP4_SERVICE*IpSb;
   UINTN  Length;
   IP4_CONFIG2_DATA_ITEM  *Item;
   EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo;
   IP4_ADDR   Address;
@@ -1177,10 +1176,11 @@ Ip4Config2SetPolicy (
 FreePool (DataItem->Data.Ptr);
   }
   DataItem->Data.Ptr = NULL;
   DataItem->DataSize = 0;
   DataItem->Status   = EFI_NOT_FOUND;
+  SET_DATA_ATTRIB (DataItem->Attribute, DATA_ATTRIB_VOLATILE);
   NetMapIterate (>EventMap, Ip4Config2SignalEvent, NULL);
 } else {
   //
   // The policy is changed from dhcp to static. Stop the DHCPv4 process
   // and destroy the DHCPv4 child.
@@ -1457,14 +1457,24 @@ Ip4Config2SetDnsServer (
   IN IP4_CONFIG2_INSTANCE *Instance,
   IN UINTNDataSize,
   IN VOID *Data
   )
 {
+  IP4_CONFIG2_DATA_ITEM *Item;
+
+  Item = NULL;
+
   if (Instance->Policy != Ip4Config2PolicyStatic) {
 return EFI_WRITE_PROTECTED;
   }
 
+  Item = >DataItem[Ip4Config2DataTypeDnsServer];
+
+  if (DATA_ATTRIB_SET (Item->Attribute, DATA_ATTRIB_VOLATILE)) {
+REMOVE_DATA_ATTRIB (Item->Attribute, DATA_ATTRIB_VOLATILE);  }
+
   return Ip4Config2SetDnsServerWorker (Instance, DataSize, Data);  }
 
 /**
   Generate the operational state of the interface this IP4 config2 instance 
manages diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h
index b2665bd..b6da11f 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h
@@ -25,10 +25,11 @@
 #define DATA_ATTRIB_SIZE_FIXED  0x1
 #define DATA_ATTRIB_VOLATILE0x2
 
 #define DATA_ATTRIB_SET(Attrib, Bits)   (BOOLEAN)((Attrib) & (Bits))
 #define SET_DATA_ATTRIB(Attrib, Bits)   ((Attrib) |= (Bits))
+#define REMOVE_DATA_ATTRIB(Attrib, Bits)((Attrib) &= (~Bits))
 
 typedef struct _IP4_CONFIG2_INSTANCE IP4_CONFIG2_INSTANCE;
 
 #define IP4_CONFIG2_INSTANCE_FROM_PROTOCOL(Proto) \
   CR ((Proto), \
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
index fcd3ccb..20bc21f 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
@@ -596,10 +596,14 @@ Ip4DriverBindingStart (
   DataItem->Data.Ptr
   );
   if (EFI_ERROR(Status)) {
 goto UNINSTALL_PROTOCOL;
   }
+  
+  if (Index == Ip4Config2DataTypePolicy && (*(DataItem->Data.Policy) == 
Ip4Config2PolicyDhcp)) {
+break;
+  }
 }
   }
  
   //
   // Ready to go: start the receiving and timer.

[edk2] [Patch] MdeModulePkg: Fix IPv4 stack potential disappeared issue

2016-06-30 Thread Jiaxin Wu
IP4_CONFIG2_INSTANCE->DataItem is used to save the configuration
data to NV variable. When the policy is changed from static to
DHCP, DnsServers info will be cleaned from DataItem first
(See Ip4Config2SetPolicy), it's correct because DnsServers info
should not be saved to NV variable.
But if there is any DnsServers info received from DHCP message, it
will be reset to DataItem again (See Ip4Config2SetDnsServerWorker),
which may cause the NV variable contain the DnsServers info while
the policy is DHCP (See Ip4Config2WriteConfigData).
Then, while the platform is reset, the issue happened. Because
Ip4Config2DataTypeDnsServer is set under DHCP policy, which is not
allowed by UEFI Spec and error returned.

This patch is used to resolve this potential issue.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Zhang Lubo 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu 
---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 12 +++-
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h |  1 +
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c  |  4 
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
index 028c61d..f91a935 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
@@ -1058,11 +1058,10 @@ Ip4Config2GetIfInfo (
   IN IP4_CONFIG2_INSTANCE *Instance,
   IN OUT UINTN*DataSize,
   IN VOID *Data  OPTIONAL
   )
 {
-
   IP4_SERVICE*IpSb;
   UINTN  Length;
   IP4_CONFIG2_DATA_ITEM  *Item;
   EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo;
   IP4_ADDR   Address;
@@ -1177,10 +1176,11 @@ Ip4Config2SetPolicy (
 FreePool (DataItem->Data.Ptr);
   }
   DataItem->Data.Ptr = NULL;
   DataItem->DataSize = 0;
   DataItem->Status   = EFI_NOT_FOUND;
+  SET_DATA_ATTRIB (DataItem->Attribute, DATA_ATTRIB_VOLATILE);
   NetMapIterate (>EventMap, Ip4Config2SignalEvent, NULL);
 } else {
   //
   // The policy is changed from dhcp to static. Stop the DHCPv4 process
   // and destroy the DHCPv4 child.
@@ -1457,14 +1457,24 @@ Ip4Config2SetDnsServer (
   IN IP4_CONFIG2_INSTANCE *Instance,
   IN UINTNDataSize,
   IN VOID *Data
   )
 {
+  IP4_CONFIG2_DATA_ITEM *Item;
+
+  Item = NULL;
+
   if (Instance->Policy != Ip4Config2PolicyStatic) {
 return EFI_WRITE_PROTECTED;
   }
 
+  Item = >DataItem[Ip4Config2DataTypeDnsServer];
+
+  if (DATA_ATTRIB_SET (Item->Attribute, DATA_ATTRIB_VOLATILE)) {
+REMOVE_DATA_ATTRIB (Item->Attribute, DATA_ATTRIB_VOLATILE);
+  }
+
   return Ip4Config2SetDnsServerWorker (Instance, DataSize, Data);
 }
 
 /**
   Generate the operational state of the interface this IP4 config2 instance 
manages
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h
index b2665bd..b6da11f 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h
@@ -25,10 +25,11 @@
 #define DATA_ATTRIB_SIZE_FIXED  0x1
 #define DATA_ATTRIB_VOLATILE0x2
 
 #define DATA_ATTRIB_SET(Attrib, Bits)   (BOOLEAN)((Attrib) & (Bits))
 #define SET_DATA_ATTRIB(Attrib, Bits)   ((Attrib) |= (Bits))
+#define REMOVE_DATA_ATTRIB(Attrib, Bits)((Attrib) &= (~Bits))
 
 typedef struct _IP4_CONFIG2_INSTANCE IP4_CONFIG2_INSTANCE;
 
 #define IP4_CONFIG2_INSTANCE_FROM_PROTOCOL(Proto) \
   CR ((Proto), \
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
index fcd3ccb..20bc21f 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
@@ -596,10 +596,14 @@ Ip4DriverBindingStart (
   DataItem->Data.Ptr
   );
   if (EFI_ERROR(Status)) {
 goto UNINSTALL_PROTOCOL;
   }
+  
+  if (Index == Ip4Config2DataTypePolicy && (*(DataItem->Data.Policy) == 
Ip4Config2PolicyDhcp)) {
+break;
+  } 
 }
   }
  
   //
   // Ready to go: start the receiving and timer.
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel