Browse Source

[iscsi] Clarify support for NOP-In

After a more accurate reading of RFC 3720, it becomes clear how NOPs
are supposed to work.  The current implementation (which just ignores
NOP-Ins) is sufficient to cope with NOP-Ins sent to update CmdSN, but
will need to be extended before it can cope with NOP-Ins sent as iSCSI
keepalives.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
ef87c4ad08
1 changed files with 9 additions and 24 deletions
  1. 9
    24
      src/net/tcp/iscsi.c

+ 9
- 24
src/net/tcp/iscsi.c View File

99
 	__einfo_error ( EINFO_ENOTSUP_TARGET_STATUS )
99
 	__einfo_error ( EINFO_ENOTSUP_TARGET_STATUS )
100
 #define EINFO_ENOTSUP_TARGET_STATUS \
100
 #define EINFO_ENOTSUP_TARGET_STATUS \
101
 	__einfo_uniqify ( EINFO_ENOTSUP, 0x04, "Unsupported target status" )
101
 	__einfo_uniqify ( EINFO_ENOTSUP, 0x04, "Unsupported target status" )
102
+#define ENOTSUP_NOP_IN \
103
+	__einfo_error ( EINFO_ENOTSUP_NOP_IN )
104
+#define EINFO_ENOTSUP_NOP_IN \
105
+	__einfo_uniqify ( EINFO_ENOTSUP, 0x05, "Unsupported NOP-In received" )
102
 #define EPERM_INITIATOR_AUTHENTICATION \
106
 #define EPERM_INITIATOR_AUTHENTICATION \
103
 	__einfo_error ( EINFO_EPERM_INITIATOR_AUTHENTICATION )
107
 	__einfo_error ( EINFO_EPERM_INITIATOR_AUTHENTICATION )
104
 #define EINFO_EPERM_INITIATOR_AUTHENTICATION \
108
 #define EINFO_EPERM_INITIATOR_AUTHENTICATION \
123
 	__einfo_error ( EINFO_EPROTO_INVALID_CHAP_RESPONSE )
127
 	__einfo_error ( EINFO_EPROTO_INVALID_CHAP_RESPONSE )
124
 #define EINFO_EPROTO_INVALID_CHAP_RESPONSE \
128
 #define EINFO_EPROTO_INVALID_CHAP_RESPONSE \
125
 	__einfo_uniqify ( EINFO_EPROTO, 0x04, "Invalid CHAP response" )
129
 	__einfo_uniqify ( EINFO_EPROTO, 0x04, "Invalid CHAP response" )
126
-#define EPROTO_INVALID_NOP_IN \
127
-	__einfo_error ( EINFO_EPROTO_INVALID_NOP_IN )
128
-#define EINFO_EPROTO_INVALID_NOP_IN \
129
-	__einfo_uniqify ( EINFO_EPROTO, 0x05, "Invalid NOP-In received" )
130
 
130
 
131
 /** iSCSI initiator name (explicitly specified) */
131
 /** iSCSI initiator name (explicitly specified) */
132
 static char *iscsi_explicit_initiator_iqn;
132
 static char *iscsi_explicit_initiator_iqn;
609
 
609
 
610
 	DBGC2 ( iscsi, "iSCSI %p received NOP-In\n", iscsi );
610
 	DBGC2 ( iscsi, "iSCSI %p received NOP-In\n", iscsi );
611
 
611
 
612
-	/* RFC 3720 section 10.19 states that "when a target sends a
613
-	 * NOP-In that is not a response to a Nop-Out received from
614
-	 * the initiator, the Initiator Task Tag MUST be set to
615
-	 * 0xffffffff", and section 10.18 states that "upon receipt of
616
-	 * a NOP-In with the Target Transfer Tag set to a valid value
617
-	 * (not the reserved 0xffffffff), the initiator MUST respond
618
-	 * with a NOP-Out".  Since we never send unsolicited NOP-Outs,
619
-	 * my reading of this is that we can handle all permitted
620
-	 * NOP-Ins (which must have TTT set to 0xffffffff) by simply
621
-	 * ignoring them.
622
-	 *
623
-	 * There is some ambiguity in the RFC, since there are other
624
-	 * places that suggest that a target is supposed to be able to
625
-	 * send an unsolicited NOP-In and expect a NOP-Out response.
626
-	 * We catch any apparent attempts to use this immediately, so
627
-	 * that the relevant error gets reported to the iPXE user,
628
-	 * rather than just having the target drop the connection when
629
-	 * it times out waiting for the NOP-Out response.
612
+	/* We don't currently have the ability to respond to NOP-Ins
613
+	 * sent as ping requests, but we can happily accept NOP-Ins
614
+	 * sent merely to update CmdSN.
630
 	 */
615
 	 */
631
 	if ( nop_in->ttt != htonl ( ISCSI_TAG_RESERVED ) ) {
616
 	if ( nop_in->ttt != htonl ( ISCSI_TAG_RESERVED ) ) {
632
-		DBGC ( iscsi, "iSCSI %p received invalid NOP-In with TTT "
617
+		DBGC ( iscsi, "iSCSI %p received unsupported NOP-In with TTT "
633
 		       "%08x\n", iscsi, ntohl ( nop_in->ttt ) );
618
 		       "%08x\n", iscsi, ntohl ( nop_in->ttt ) );
634
-		return -EPROTO_INVALID_NOP_IN;
619
+		return -ENOTSUP_NOP_IN;
635
 	}
620
 	}
636
 
621
 
637
 	return 0;
622
 	return 0;

Loading…
Cancel
Save