From: Michael Brown Date: Thu, 12 Jul 2012 15:04:41 +0000 (+0100) Subject: [pxe] Reopen network device if NBP exits X-Git-Tag: v1.20.1~1711 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88016deccf05e4370c1362fbc13405a2123a89a1;p=thirdparty%2Fipxe.git [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 --- diff --git a/src/arch/i386/image/pxe_image.c b/src/arch/i386/image/pxe_image.c index e037c7936..722f6bbce 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; }