|
@@ -505,6 +505,27 @@ static void iscsi_tx_login_request ( struct iscsi_session *iscsi,
|
505
|
505
|
len - iscsi->tx_offset );
|
506
|
506
|
}
|
507
|
507
|
|
|
508
|
+/**
|
|
509
|
+ * Handle iSCSI TargetAddress text value
|
|
510
|
+ *
|
|
511
|
+ * @v iscsi iSCSI session
|
|
512
|
+ * @v value TargetAddress value
|
|
513
|
+ */
|
|
514
|
+static void iscsi_handle_targetaddress_value ( struct iscsi_session *iscsi,
|
|
515
|
+ const char *value ) {
|
|
516
|
+ struct in_addr address;
|
|
517
|
+ struct sockaddr_in *sin = ( struct sockaddr_in * ) &iscsi->tcp.peer;
|
|
518
|
+
|
|
519
|
+ if ( inet_aton ( value, &address ) == 0 ) {
|
|
520
|
+ DBG ( "iSCSI %p received invalid TargetAddress \"%s\"\n",
|
|
521
|
+ iscsi, value );
|
|
522
|
+ return;
|
|
523
|
+ }
|
|
524
|
+
|
|
525
|
+ DBG ( "iSCSI %p will redirect to %s\n", iscsi, value );
|
|
526
|
+ sin->sin_addr = address;
|
|
527
|
+}
|
|
528
|
+
|
508
|
529
|
/**
|
509
|
530
|
* Handle iSCSI AuthMethod text value
|
510
|
531
|
*
|
|
@@ -629,6 +650,7 @@ struct iscsi_string_type {
|
629
|
650
|
|
630
|
651
|
/** iSCSI text strings that we want to handle */
|
631
|
652
|
struct iscsi_string_type iscsi_string_types[] = {
|
|
653
|
+ { "TargetAddress=", iscsi_handle_targetaddress_value },
|
632
|
654
|
{ "AuthMethod=", iscsi_handle_authmethod_value },
|
633
|
655
|
{ "CHAP_A=", iscsi_handle_chap_a_value },
|
634
|
656
|
{ "CHAP_I=", iscsi_handle_chap_i_value },
|
|
@@ -710,6 +732,14 @@ static void iscsi_rx_login_response ( struct iscsi_session *iscsi, void *data,
|
710
|
732
|
iscsi_handle_strings ( iscsi, iscsi->rx_buffer, iscsi->rx_len );
|
711
|
733
|
iscsi_rx_buffered_data_done ( iscsi );
|
712
|
734
|
|
|
735
|
+ /* Check for login redirection */
|
|
736
|
+ if ( response->status_class == ISCSI_STATUS_REDIRECT ) {
|
|
737
|
+ DBG ( "iSCSI %p redirecting to new server\n", iscsi );
|
|
738
|
+ iscsi_close ( iscsi, -EINPROGRESS );
|
|
739
|
+ tcp_connect ( &iscsi->tcp );
|
|
740
|
+ return;
|
|
741
|
+ }
|
|
742
|
+
|
713
|
743
|
/* Check for fatal errors */
|
714
|
744
|
if ( response->status_class != 0 ) {
|
715
|
745
|
printf ( "iSCSI login failure: class %02x detail %02x\n",
|