Browse Source

[pxe] Reopen network device if NBP exits

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>
tags/v1.20.1
Michael Brown 12 years ago
parent
commit
88016deccf
1 changed files with 7 additions and 0 deletions
  1. 7
    0
      src/arch/i386/image/pxe_image.c

+ 7
- 0
src/arch/i386/image/pxe_image.c View File

@@ -65,6 +65,7 @@ static int pxe_exec ( struct image *image ) {
65 65
 		       image );
66 66
 		return -ENODEV;
67 67
 	}
68
+	netdev_get ( netdev );
68 69
 
69 70
 	/* Activate PXE */
70 71
 	pxe_activate ( netdev );
@@ -81,6 +82,12 @@ static int pxe_exec ( struct image *image ) {
81 82
 	/* Deactivate PXE */
82 83
 	pxe_deactivate();
83 84
 
85
+	/* Try to reopen network device.  Ignore errors, since the NBP
86
+	 * may have called PXENV_STOP_UNDI.
87
+	 */
88
+	netdev_open ( netdev );
89
+	netdev_put ( netdev );
90
+
84 91
 	return rc;
85 92
 }
86 93
 

Loading…
Cancel
Save