aboutsummaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2012-07-12 16:04:41 +0100
committerMichael Brown <mcb30@ipxe.org>2012-07-12 16:06:05 +0100
commit88016deccf05e4370c1362fbc13405a2123a89a1 (patch)
treebff99ef72764f47cda43bf0521e00ad2a8efdee9 /src/arch
parentc5c257788f36d178176eb59b0d4c5fdd88080c19 (diff)
downloadipxe-88016deccf05e4370c1362fbc13405a2123a89a1.zip
ipxe-88016deccf05e4370c1362fbc13405a2123a89a1.tar.gz
ipxe-88016deccf05e4370c1362fbc13405a2123a89a1.tar.bz2
[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>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/i386/image/pxe_image.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/arch/i386/image/pxe_image.c b/src/arch/i386/image/pxe_image.c
index e037c79..722f6bb 100644
--- a/src/arch/i386/image/pxe_image.c
+++ b/src/arch/i386/image/pxe_image.c
@@ -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;
}