]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[iscsi] Treat redirection failures as fatal
authorMichael Brown <mcb30@ipxe.org>
Mon, 4 Jul 2016 15:14:22 +0000 (16:14 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 4 Jul 2016 15:20:07 +0000 (16:20 +0100)
Debugged-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/net/tcp/iscsi.c

index 019a4c14e034abcd3a67376577bba6371c937a43..ec004e4badadaad99d88ae09faa153c29079d150 100644 (file)
@@ -1710,6 +1710,7 @@ static int iscsi_vredirect ( struct iscsi_session *iscsi, int type,
                             va_list args ) {
        va_list tmp;
        struct sockaddr *peer;
+       int rc;
 
        /* Intercept redirects to a LOCATION_SOCKET and record the IP
         * address for the iBFT.  This is a bit of a hack, but avoids
@@ -1725,7 +1726,15 @@ static int iscsi_vredirect ( struct iscsi_session *iscsi, int type,
                va_end ( tmp );
        }
 
-       return xfer_vreopen ( &iscsi->socket, type, args );
+       /* Redirect to new location */
+       if ( ( rc = xfer_vreopen ( &iscsi->socket, type, args ) ) != 0 )
+               goto err;
+
+       return 0;
+
+ err:
+       iscsi_close ( iscsi, rc );
+       return rc;
 }
 
 /** iSCSI socket interface operations */