sahlberg / libiscsi

iscsi client library and utilities
Other
192 stars 164 forks source link

CHAP_A tests does not seem to work as expected #405

Open martinhoyer opened 1 year ago

martinhoyer commented 1 year ago

While investigating a test failure of iSCSI.iSCSICHAP.Invalid test, we noticed that the test is sending CHAP_A=5 instead of CHAP_A=56 or null using tcpdump.

https://github.com/sahlberg/libiscsi/blob/03e9ddc0a61fa64d84cb4faa4c06b42f694e2301/test-tool/test_iscsi_chap.c#L93 In chap_mod_strip_replace_queue, this part is the culprit:

    ret = test_iscsi_strip_tag(iscsi, pdu, "CHAP_A=");
    if (ret == -ENOENT) {
        logging(LOG_VERBOSE, "ignoring login PDU without CHAP_A");
        goto out;
    }

as the strip_tag returns -ENOENT and the replace_queue function goes directly to return orig_queue_pdu(iscsi, pdu);, which leads to above-mentioned sending of CHAP_A=5, which results in test wrongly assuming iSCSI login should fail.