From owner-freebsd-net@FreeBSD.ORG Wed Jul 23 03:38:06 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 34CF9571 for ; Wed, 23 Jul 2014 03:38:06 +0000 (UTC) Received: from mail-pd0-x22f.google.com (mail-pd0-x22f.google.com [IPv6:2607:f8b0:400e:c02::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0934127D9 for ; Wed, 23 Jul 2014 03:38:06 +0000 (UTC) Received: by mail-pd0-f175.google.com with SMTP id r10so775400pdi.6 for ; Tue, 22 Jul 2014 20:38:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:message-id:subject:mime-version:content-type; bh=mVKYS5RCQvlCvo+x+6cBTcho/o4bcjjHLS2XNUyzU8M=; b=VSjOl4fpBNHgXv3PMaU6GWOSAvJq6GsgzhwKcoeE7Gzkl9e3GCTiuQfrycprnlavd8 QYh44FkGwwIMJvH94Zd8myJWvjt4DbsNuznwMHJFWaIXkCO4QBlsEB2thIbe3a/Z54yV 1jMz0tRJhfSPdJontfkB3GO2pFKRfZ3xchsNy7nOCswML/jgDLBpyTXoDUu+zEWTuOjt f2ySwBHXS80ESRWCqgywppHlyAeS7oeJLsn+F6ZPBYuSUpdimqg3XbUKDLRqgnHyEScA XWb8DpAEK6QbTPkkM4bSmt5WvxBsEh/hMLrbL6oSem721PaP7hsmDxEcG04CFcXNAa6m VV8g== X-Received: by 10.66.250.161 with SMTP id zd1mr38374681pac.61.1406086685559; Tue, 22 Jul 2014 20:38:05 -0700 (PDT) Received: from [192.168.10.153] (114-34-221-39.HINET-IP.hinet.net. [114.34.221.39]) by mx.google.com with ESMTPSA id by7sm3676454pab.35.2014.07.22.20.38.04 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 22 Jul 2014 20:38:04 -0700 (PDT) Date: Wed, 23 Jul 2014 11:38:01 +0800 From: Chen Wen To: freebsd-net@freebsd.org Message-ID: Subject: usr.sbin/ctld/login.c do not reply TargetPortalGroupTag in Login response X-Mailer: sparrow 1.6.3 (build 1173) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.18 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jul 2014 03:38:06 -0000 Hi =20 I am a mac user, when I try to use xtendsan iSCSI initiator to connect na= tive iSCSI target, I found that the login response pdu do not have Target= PortalGroupTag 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=5Fnegotiate() > login=5Fnegotiate(struct connection *conn, struct pdu *request) > =7B > struct pdu *response; > struct iscsi=5Fbhs=5Flogin=5Fresponse *bhslr2; > struct keys *request=5Fkeys, *response=5Fkeys; > int i; > bool skipped=5Fsecurity; char *portal=5Fgroup=5Ftag; int rv; > =20 > if (request =3D=3D NULL) =7B > log=5Fdebugx(=22beginning parameter negotiation; =22 > =22waiting for Login PDU=22); > request =3D login=5Freceive(conn, false); > skipped=5Fsecurity =3D false; > =7D else > skipped=5Fsecurity =3D true; > =20 > request=5Fkeys =3D keys=5Fnew(); > keys=5Fload(request=5Fkeys, request); > =20 > response =3D login=5Fnew=5Fresponse(request); > bhslr2 =3D (struct iscsi=5Fbhs=5Flogin=5Fresponse *)response->p= du=5Fbhs; > bhslr2->bhslr=5Fflags =7C=3D BHSLR=5F=46LAGS=5FTRANSIT; > bhslr2->bhslr=5Ftsih =3D htons(0xbadd); > login=5Fset=5Fcsg(response, BHSLR=5FSTAGE=5FOPERATIONAL=5FNEGOT= IATION); > login=5Fset=5Fnsg(response, BHSLR=5FSTAGE=5F=46ULL=5F=46EATURE=5F= PHASE); > response=5Fkeys =3D keys=5Fnew(); if (conn->conn=5Fsession=5Ftype =3D=3D CONN=5FSESSION=5FTYPE=5FNO= RMAL) =7B if (conn->conn=5Ftarget->t=5Falias =21=3D NULL) keys=5Fadd(response=5Fkeys, =22TargetAlias=22, conn->conn=5Ftarget->t=5Fa= lias); rv =3D asprintf(&portal=5Fgroup=5Ftag, =22%d=22, conn->conn=5Fportal->p=5Fportal=5Fgroup->pg=5Ftag); if (rv <=3D 0) log=5Ferr(1, =22asprintf=22); keys=5Fadd(response=5Fkeys, =22TargetPortalGroupTag=22, portal=5Fgroup=5Ftag); free(portal=5Fgroup=5Ftag); =7D =20 > for (i =3D 0; i < KEYS=5FMAX; i++) =7B > if (request=5Fkeys->keys=5Fnames=5Bi=5D =3D=3D NULL) > break; > =20 > login=5Fnegotiate=5Fkey(request, request=5Fkeys->keys=5F= names=5Bi=5D, > request=5Fkeys->keys=5Fvalues=5Bi=5D, skipped=5Fsec= urity, > response=5Fkeys); > =7D I don=E2=80=99t read whole iSCSI R=46C, is this right to add missing Targ= etPortalGroupTag=3F Maybe you have better solution to fix this, please help me and thanks. -- =20 Chen Wen Sent with Sparrow (http://www.sparrowmailapp.com/=3Fsig)