Eugene, I want to confirm with you the steps to reproduce the issue:
1. Set policy to DHCP. 2. If DHCP process is not complete yet, then run one App to invoke the UDP4 Configure with "UseDefaultAddress = TRUE" (loop to keep calling Udp4->Configure until Ip4Mode.IsConfigured changes to TRUE) 3. Even DHCP succeed but Ip4Mode.IsConfigured flag never set to TRUE ---- failure here!!! Above steps right? Actually, you don't need to retry the UDP configuration loop according the Ip4Mode.IsConfigured flag. You are only recommended to set a timer to check the mapping status after the configuration: For example: Status = Nlc->Udp4->Configure(Nlc->Udp4, &Nlc->UdpConfig); if (EFI_ERROR (Status) && (Status != EFI_NO_MAPPING)) { return Status; } if (Status == EFI_NO_MAPPING && !UdpGetMapping (Nlc->Udp4)) { return Status; } In UdpGetMapping () function, create one timer to check Ip4Mode.IsConfigured: For example: UdpGetMapping () { IsMapDone = FALSE; gBS->CreateEvent (EVT_TIMER, TPL_CALLBACK, NULL, NULL, &TimeoutEvent); gBS->SetTimer (TimeoutEvent, TimerRelative, AnyValue); while (EFI_ERROR (gBS->CheckEvent (TimeoutEvent))) { Udp4->Poll (Udp4); Udp4->GetModeData (Udp4, &Udp4Mode, & Ip4Mode, NULL, NULL); if (Ip4Mode.IsConfigured) { IsMapDone = TRUE; break; } } return IsMapDone; } If DHCP process succeed, Ip4Mode.IsConfigured should be updated. If not, any bug may be existed. Thanks, Jiaxin -----Original Message----- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Cohen, Eugene Sent: Thursday, August 11, 2016 2:14 AM To: edk2-devel@lists.01.org; Wu, Jiaxin <jiaxin...@intel.com> Subject: [edk2] IP4 Config Troubles with DHCP We have been running into an issue when trying to configure an interface as DHCP where if the DHCP process is not yet complete (Ip4Mode.IsConfigured is FALSE) the configure process will never succeed. We have a case where we attempt to invoke the UDP4 Configure: Status = Nlc->Udp4->Configure(Nlc->Udp4, &Nlc->UdpConfig); We had a retry loop where we keep calling Udp4->Configure until we finally see Ip4Mode.IsConfigured go TRUE (similar to what you see in Mtftp4GetMapping) - this has worked for many years but recently something broke this. Now, even when DHCP succeeds the Ip4Mode.IsConfigured flag is set to FALSE. Only if we retry by destroying and re-creating new service binding children can we actually get this logic to succeed. This logic is getting ridiculously complicated so I'm thinking there has to be a better way of doing this. Do you have an example of specifically how a driver/app should handle the case where the DHCP process is not yet complete and wants to wait? Thanks, Eugene _______________________________________________ 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