瀏覽代碼

[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 13 年之前
父節點
當前提交
ef87c4ad08
共有 1 個文件被更改,包括 9 次插入24 次删除
  1. 9
    24
      src/net/tcp/iscsi.c

+ 9
- 24
src/net/tcp/iscsi.c 查看文件

@@ -99,6 +99,10 @@ FEATURE ( FEATURE_PROTOCOL, "iSCSI", DHCP_EB_FEATURE_ISCSI, 1 );
99 99
 	__einfo_error ( EINFO_ENOTSUP_TARGET_STATUS )
100 100
 #define EINFO_ENOTSUP_TARGET_STATUS \
101 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 106
 #define EPERM_INITIATOR_AUTHENTICATION \
103 107
 	__einfo_error ( EINFO_EPERM_INITIATOR_AUTHENTICATION )
104 108
 #define EINFO_EPERM_INITIATOR_AUTHENTICATION \
@@ -123,10 +127,6 @@ FEATURE ( FEATURE_PROTOCOL, "iSCSI", DHCP_EB_FEATURE_ISCSI, 1 );
123 127
 	__einfo_error ( EINFO_EPROTO_INVALID_CHAP_RESPONSE )
124 128
 #define EINFO_EPROTO_INVALID_CHAP_RESPONSE \
125 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 131
 /** iSCSI initiator name (explicitly specified) */
132 132
 static char *iscsi_explicit_initiator_iqn;
@@ -609,29 +609,14 @@ static int iscsi_rx_nop_in ( struct iscsi_session *iscsi,
609 609
 
610 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 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 618
 		       "%08x\n", iscsi, ntohl ( nop_in->ttt ) );
634
-		return -EPROTO_INVALID_NOP_IN;
619
+		return -ENOTSUP_NOP_IN;
635 620
 	}
636 621
 
637 622
 	return 0;

Loading…
取消
儲存