Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Jul 2014 11:43:02 +0800
From:      Chen Wen <pokkys@gmail.com>
To:        freebsd-scsi@freebsd.org
Subject:   usr.sbin/ctld/login.c do not reply TargetPortalGroupTag in Login response
Message-ID:  <1C0DBE89-1D7B-458C-AB91-F17D0DD9C717@gmail.com>

next in thread | raw e-mail | index | archive | help
Hi

I am a mac user, when I try to use xtendsan iSCSI initiator to connect =
native iSCSI target, I found that the login response pdu do not have =
TargetPortalGroupTag key-pair.

xtendsan told me TargetPortalGroupTag is missing and disconnected.

I try to do a workaround to it and it works.

Add some codes in usr.sbin/ctld/login.c:login_negotiate()

> login_negotiate(struct connection *conn, struct pdu *request)
> {
>         struct pdu *response;
>         struct iscsi_bhs_login_response *bhslr2;
>         struct keys *request_keys, *response_keys;
>         int i;
>         bool skipped_security;
        char *portal_group_tag;
        int rv;
>=20
>         if (request =3D=3D NULL) {
>                 log_debugx("beginning parameter negotiation; "
>                     "waiting for Login PDU");
>                 request =3D login_receive(conn, false);
>                 skipped_security =3D false;
>         } else
>                 skipped_security =3D true;
>=20
>         request_keys =3D keys_new();
>         keys_load(request_keys, request);
>=20
>         response =3D login_new_response(request);
>         bhslr2 =3D (struct iscsi_bhs_login_response =
*)response->pdu_bhs;
>         bhslr2->bhslr_flags |=3D BHSLR_FLAGS_TRANSIT;
>         bhslr2->bhslr_tsih =3D htons(0xbadd);
>         login_set_csg(response, BHSLR_STAGE_OPERATIONAL_NEGOTIATION);
>         login_set_nsg(response, BHSLR_STAGE_FULL_FEATURE_PHASE);
>         response_keys =3D keys_new();
        if (conn->conn_session_type =3D=3D CONN_SESSION_TYPE_NORMAL) {
                if (conn->conn_target->t_alias !=3D NULL)
                        keys_add(response_keys,
                            "TargetAlias", conn->conn_target->t_alias);
                rv =3D asprintf(&portal_group_tag, "%d",
                    conn->conn_portal->p_portal_group->pg_tag);
                if (rv <=3D 0)
                        log_err(1, "asprintf");
                keys_add(response_keys,
                    "TargetPortalGroupTag", portal_group_tag);
                free(portal_group_tag);
        }  =20
>     for (i =3D 0; i < KEYS_MAX; i++) {
>                 if (request_keys->keys_names[i] =3D=3D NULL)
>                         break;
>=20
>                 login_negotiate_key(request, =
request_keys->keys_names[i],
>                     request_keys->keys_values[i], skipped_security,
>                     response_keys);
>         }


I don=92t read whole iSCSI RFC, is this right to add missing =
TargetPortalGroupTag?
Maybe you have better solution to fix this, please help me and thanks.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1C0DBE89-1D7B-458C-AB91-F17D0DD9C717>