Update,
So if I hardcode the LUN to 1, matching my Synology target, then
two(?) targets get attached:
sd1 at scsibus2 targ 0 lun 0: <SYNOLOGY, iSCSI Storage, 4.0>
naa.600140577c3262ed829ed4f8fdb787d2
sd1: 512000MB, 512 bytes/sector, 1048576000 sectors, thin
sd2 at scsibus2 targ 0 lun 1: <SYNOLOGY, iSCSI Storage, 4.0>
naa.600140577c3262ed829ed4f8fdb787d2
sd2: 512000MB, 512 bytes/sector, 1048576000 sectors, thin
I can then access the device and everything seems fine.
Ideas on what could be happening with the initial LUN?
Thanks,
David
Index: vscsi.c
===================================================================
RCS file: /cvs/src/usr.sbin/iscsid/vscsi.c,v
retrieving revision 1.17
diff -u -p -u -p -r1.17 vscsi.c
--- vscsi.c 16 Aug 2016 18:41:57 -0000 1.17
+++ vscsi.c 19 Apr 2021 11:23:41 -0000
@@ -92,7 +92,8 @@ vscsi_dispatch(int fd, short event, void
t->tag = i2t.tag;
t->target = i2t.target;
- t->lun = i2t.lun;
+/* t->lun = i2t.lun; */
+ t->lun = 1;
if (!(p = pdu_new()))
fatal("vscsi_dispatch");
On Thu, Apr 1, 2021 at 7:45 AM David Alten <[email protected]> wrote:
>
> Second try....
>
>
> Hello,
>
> I’m having issues getting iscsid to work with my Synology NAS on
> amd64/6.9-beta.
>
> The first issue was that the NAS was returning an error code. Turns out
> it didn’t like missing the default SessionType=Normal.
>
> The second issue was that the login sequence never completed. It seems
> we keep hardcoding MaxConnections and MaxRecvDataSegmentLength in
> connection.c:conn_gen_kvp() instead of negotiating to the lowest value.
> So I just bypassed that function entirely and hardcoded all the default
> settings in initiator.c.
>
> This makes the login step complete, but then nothing else happens after
> that. I would expect a new scsi device to be attached so I could use it.
>
> I did notice that MaxConnection shows as 0, but the NAS does show the
> connection as established.
>
> b1# iscsictl show
> Initiator: ISID base 80d3cf6f qalifier 6e7d
>
> Session 'disk2':
> SessionType: normal MaxConnections: 0
> TargetName: iqn.2000-01.com.synology:Target.02
> TargetAddr: 192.168.0.4:iscsi
> InitiatorName: iqn.1995-11.org.openbsd.iscsid:b1
> InitiatorAddr: 192.168.0.9
> command successful
>
> b1$ cat /etc/iscsi.conf
>
> target disk2 {
> initiatoraddr 192.168.0.9
> targetaddr 192.168.0.4
> targetname "iqn.2000-01.com.synology:Target.02"
> }
>
> Any suggestions on where to go from here?
>
> Thanks,
>
> -David
>
> b1$ doas /usr/sbin/iscsid -dv
> startup
> session_fsm[disk2]: INIT ev start timeout 0
> sess_fsm[disk2]: INIT ev start
> new connection to 192.168.0.4:3260
> conn_fsm[disk2]: FREE ev connect
> conn_fsm[disk2]: new state XPT_WAIT
> sess_fsm[disk2]: new state FREE
> sess_fsm: done
> conn_fsm[disk2]: XPT_WAIT ev connected
> conn_fsm[disk2]: new state IN_LOGIN
> conn_parse_kvp: AuthMethod = None
> conn_parse_kvp: TargetAlias = Synology Target
> conn_parse_kvp: TargetPortalGroupTag = 1
> SET_NUM: TargetPortalGroupTag = 1
> conn_parse_kvp: HeaderDigest = None
> conn_parse_kvp: DataDigest = None
> conn_parse_kvp: MaxConnections = 1
> SET_NUM: MaxConnections = 1
> conn_parse_kvp: ImmediateData = Yes
> SET_BOOL: ImmediateData = 1
> conn_parse_kvp: MaxRecvDataSegmentLength = 262144
> SET_NUM: MaxRecvDataSegmentLength = 262144
> conn_parse_kvp: MaxBurstLength = 262144
> SET_NUM: MaxBurstLength = 262144
> conn_parse_kvp: FirstBurstLength = 65536
> SET_NUM: FirstBurstLength = 65536
> conn_parse_kvp: DefaultTime2Wait = 2
> SET_NUM: DefaultTime2Wait = 2
> conn_parse_kvp: DefaultTime2Retain = 20
> SET_NUM: DefaultTime2Retain = 20
> conn_parse_kvp: MaxOutstandingR2T = 1
> SET_NUM: MaxOutstandingR2T = 1
> conn_parse_kvp: DataPDUInOrder = Yes
> SET_BOOL: DataPDUInOrder = 1
> conn_parse_kvp: DataSequenceInOrder = Yes
> SET_BOOL: DataSequenceInOrder = 1
> conn_parse_kvp: ErrorRecoveryLevel = 0
> SET_NUM: ErrorRecoveryLevel = 0
> conn_fsm[disk2]: IN_LOGIN ev logged in
> session_fsm[disk2]: FREE ev connection logged in timeout 0
> conn_fsm[disk2]: new state LOGGED_IN
> sess_fsm[disk2]: FREE ev connection logged in
> sess_fsm[disk2]: new state LOGGED_IN
> sess_fsm: done
> Index: initiator.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/iscsid/initiator.c,v
> retrieving revision 1.15
> diff -u -p -u -p -r1.15 initiator.c
> --- initiator.c 16 Jan 2015 15:57:06 -0000 1.15
> +++ initiator.c 31 Mar 2021 03:24:44 -0000
> @@ -254,11 +254,10 @@ struct kvp *
> initiator_login_kvp(struct connection *c, u_int8_t stage)
> {
> struct kvp *kvp;
> - size_t nkvp;
>
> switch (stage) {
> case ISCSI_LOGIN_STG_SECNEG:
> - if (!(kvp = calloc(4, sizeof(*kvp))))
> + if (!(kvp = calloc(5, sizeof(*kvp))))
> return NULL;
> kvp[0].key = "AuthMethod";
> kvp[0].value = "None";
> @@ -269,20 +268,39 @@ initiator_login_kvp(struct connection *c
> kvp[2].key = "SessionType";
> kvp[2].value = "Discovery";
> } else {
> - kvp[2].key = "TargetName";
> - kvp[2].value = c->session->config.TargetName;
> + kvp[2].key = "SessionType";
> + kvp[2].value = "Normal";
> + kvp[3].key = "TargetName";
> + kvp[3].value = c->session->config.TargetName;
> }
> break;
> case ISCSI_LOGIN_STG_OPNEG:
> - if (conn_gen_kvp(c, NULL, &nkvp) == -1)
> - return NULL;
> - nkvp += 1; /* add slot for terminator */
> - if (!(kvp = calloc(nkvp, sizeof(*kvp))))
> - return NULL;
> - if (conn_gen_kvp(c, kvp, &nkvp) == -1) {
> - free(kvp);
> + if (!(kvp = calloc(13, sizeof(*kvp))))
> return NULL;
> - }
> + kvp[0].key = "HeaderDigest";
> + kvp[0].value = "None";
> + kvp[1].key = "DataDigest";
> + kvp[1].value = "None";
> + kvp[2].key = "ImmediateData";
> + kvp[2].value = "Yes";
> + kvp[3].key = "MaxBurstLength";
> + kvp[3].value = "262144";
> + kvp[4].key = "FirstBurstLength";
> + kvp[4].value = "65536";
> + kvp[5].key = "InitialR2T";
> + kvp[5].value = "Yes";
> + kvp[6].key = "MaxOutstandingR2T";
> + kvp[6].value = "1";
> + kvp[7].key = "MaxRecvDataSegmentLength";
> + kvp[7].value = "65536";
> + kvp[8].key = "DefaultTime2Wait";
> + kvp[8].value = "2";
> + kvp[9].key = "DefaultTime2Retain";
> + kvp[9].value = "20";
> + kvp[10].key = "ErrorRecoveryLevel";
> + kvp[10].value = "0";
> + kvp[11].key = "MaxConnections";
> + kvp[11].value = "1";
> break;
> default:
> log_warnx("initiator_login_kvp: exit stage left");
> Index: iscsid.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/iscsid/iscsid.c,v
> retrieving revision 1.20
> diff -u -p -u -p -r1.20 iscsid.c
> --- iscsid.c 23 Jan 2017 08:40:07 -0000 1.20
> +++ iscsid.c 31 Mar 2021 03:24:44 -0000
> @@ -38,7 +38,7 @@ void main_sig_handler(int, short, void
> __dead void usage(void);
> void shutdown_cb(int, short, void *);
>
> -struct initiator *initiator;
> +extern struct initiator *initiator;
> struct event exit_ev;
> int exit_rounds;
> #define ISCSI_EXIT_WAIT 5