]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[pxe] Reopen network device if NBP exits
authorMichael Brown <mcb30@ipxe.org>
Thu, 12 Jul 2012 15:04:41 +0000 (16:04 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 12 Jul 2012 15:06:05 +0000 (16:06 +0100)
Attempt to restore the network device to the state it was in prior to
calling the NBP.  This simplifies the task of taking follow-up action
in an iPXE script.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/i386/image/pxe_image.c

index e037c79361fb64f93c34701c25b44bfd84ce1142..722f6bbce2638c269ee6cf7daa2151a7821ad6cd 100644 (file)
@@ -65,6 +65,7 @@ static int pxe_exec ( struct image *image ) {
                       image );
                return -ENODEV;
        }
+       netdev_get ( netdev );
 
        /* Activate PXE */
        pxe_activate ( netdev );
@@ -81,6 +82,12 @@ static int pxe_exec ( struct image *image ) {
        /* Deactivate PXE */
        pxe_deactivate();
 
+       /* Try to reopen network device.  Ignore errors, since the NBP
+        * may have called PXENV_STOP_UNDI.
+        */
+       netdev_open ( netdev );
+       netdev_put ( netdev );
+
        return rc;
 }