usr.sbin/ctld/login.c do not reply TargetPortalGroupTag in Login response
Chen Wen
pokkys at gmail.com
Wed Jul 23 03:43:07 UTC 2014
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;
>
> if (request == NULL) {
> log_debugx("beginning parameter negotiation; "
> "waiting for Login PDU");
> request = login_receive(conn, false);
> skipped_security = false;
> } else
> skipped_security = true;
>
> request_keys = keys_new();
> keys_load(request_keys, request);
>
> response = login_new_response(request);
> bhslr2 = (struct iscsi_bhs_login_response *)response->pdu_bhs;
> bhslr2->bhslr_flags |= BHSLR_FLAGS_TRANSIT;
> bhslr2->bhslr_tsih = htons(0xbadd);
> login_set_csg(response, BHSLR_STAGE_OPERATIONAL_NEGOTIATION);
> login_set_nsg(response, BHSLR_STAGE_FULL_FEATURE_PHASE);
> response_keys = keys_new();
if (conn->conn_session_type == CONN_SESSION_TYPE_NORMAL) {
if (conn->conn_target->t_alias != NULL)
keys_add(response_keys,
"TargetAlias", conn->conn_target->t_alias);
rv = asprintf(&portal_group_tag, "%d",
conn->conn_portal->p_portal_group->pg_tag);
if (rv <= 0)
log_err(1, "asprintf");
keys_add(response_keys,
"TargetPortalGroupTag", portal_group_tag);
free(portal_group_tag);
}
> for (i = 0; i < KEYS_MAX; i++) {
> if (request_keys->keys_names[i] == NULL)
> break;
>
> login_negotiate_key(request, request_keys->keys_names[i],
> request_keys->keys_values[i], skipped_security,
> response_keys);
> }
I don’t read whole iSCSI RFC, is this right to add missing TargetPortalGroupTag?
Maybe you have better solution to fix this, please help me and thanks.
More information about the freebsd-scsi
mailing list