diff options
| author | 2011-01-04 13:19:55 +0000 | |
|---|---|---|
| committer | 2011-01-04 13:19:55 +0000 | |
| commit | 17fa859490afe4953ffdddc2c7a0803bc266ab0b (patch) | |
| tree | 31c7000f199d03086a068189c04d41a9599e3b2b /usr.sbin/iscsid/task.c | |
| parent | Cleanup tasks with a NULL callback after queuing the PDU to be sent out. (diff) | |
| download | wireguard-openbsd-17fa859490afe4953ffdddc2c7a0803bc266ab0b.tar.xz wireguard-openbsd-17fa859490afe4953ffdddc2c7a0803bc266ab0b.zip | |
Implememnt NOP-IN -> NOP-OUT handling. If the NOP-In was issued by the
target (itt = 0xffffffff) send back an immediate NOP-Out reusing the
NOP-In PDU. This makes my iscsi target happy.
Also plug a mem leak on error path which was found by Igor Zinovik.
Diffstat (limited to 'usr.sbin/iscsid/task.c')
| -rw-r--r-- | usr.sbin/iscsid/task.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/iscsid/task.c b/usr.sbin/iscsid/task.c index 87926931c98..6150625fa74 100644 --- a/usr.sbin/iscsid/task.c +++ b/usr.sbin/iscsid/task.c @@ -1,4 +1,4 @@ -/* $OpenBSD: task.c,v 1.4 2011/01/04 09:53:17 claudio Exp $ */ +/* $OpenBSD: task.c,v 1.5 2011/01/04 13:19:55 claudio Exp $ */ /* * Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org> @@ -93,6 +93,14 @@ task_pdu_cb(struct connection *c, struct pdu *p) ipdu = pdu_getbuf(p, NULL, PDU_HEADER); switch (ISCSI_PDU_OPCODE(ipdu->opcode)) { case ISCSI_OP_T_NOP: + itt = ntohl(ipdu->itt); + if (itt == 0xffffffff) { + /* target issued a ping, must answer back immediately */ + c->expstatsn = ntohl(ipdu->cmdsn) + 1; + initiator_nop_in_imm(c, p); + break; + } + /* FALLTHROUGH */ case ISCSI_OP_LOGIN_RESPONSE: case ISCSI_OP_TEXT_RESPONSE: case ISCSI_OP_LOGOUT_RESPONSE: |
