[Bug 193021] New: usr.sbin/ctld/login.c do not reply TargetPortalGroupTag in Login response

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Aug 26 16:47:01 UTC 2014


            Bug ID: 193021
           Summary: usr.sbin/ctld/login.c do not reply
                    TargetPortalGroupTag in Login response
           Product: Base System
           Version: 10.0-RELEASE
          Hardware: amd64
                OS: Any
            Status: Needs Triage
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: pokkys at gmail.com


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)
                            "TargetAlias", conn->conn_target->t_alias);
                rv = asprintf(&portal_group_tag, "%d",
                if (rv <= 0)
                        log_err(1, "asprintf");
                    "TargetPortalGroupTag", portal_group_tag);
    for (i = 0; i < KEYS_MAX; i++) {
                if (request_keys->keys_names[i] == NULL)

                login_negotiate_key(request, request_keys->keys_names[i],
                    request_keys->keys_values[i], skipped_security,

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

You are receiving this mail because:
You are the assignee for the bug.

More information about the freebsd-bugs mailing list