#!/bin/tcsh
#
#	ini-manage-slp
#
#	vi: set autoindent tabstop=4 shiftwidth=4 :
#
#	bring up a new session on the initiator using SLP
#
./iscsi_manage init restore host=0
#
#	use SLP to find out the target's name, ip address and port number
source findsrvs
if ( $status != 0 ) exit $status

./iscsi_manage init set TargetName=$tn
./iscsi_manage init set InitiatorName=iqn.1999-11.edu.unh.iol.iscsi.draft20-initiator host=0
./iscsi_manage init set InitiatorAlias=UNH-Draft20-Initiator host=0
#
# force initiator to offer security stage, even if it has no keys to send
#./iscsi_manage init force s host=0
#
# to turn on CHAP Authentication -- also need to define names and secrets (next)
#./iscsi_manage init set AuthMethod=CHAP,None host=0
#
# for the UNH reference target CHAP Authentication
#./iscsi_manage init force b t cl=256 lx="wild_cat_and_dog" ln=UNH-reference-Target px="UNH cowhampshire" pn=anonymous-user-of-UNH-reference-Target host=0
#
# for the UNH TARGET target.t script CHAP Authentication in both directions
#./iscsi_manage init force b t cl=256 lx="When will it begin?" ln=UNH-TESTOR-Target px="This should work now!" pn=anonymous-user-of-UNH-TESTOR-Target host=0
#
# for the UNH TARGET target.t script CHAP Authentication initiator only
#./iscsi_manage init force b cl=256 px="This should work now!" pn=anonymous-user-of-UNH-TESTOR-Target host=0
#
# to turn on SRP Authentication -- also need to define names and secrets (next)
#./iscsi_manage init set AuthMethod=SRP,None host=0
#
#./iscsi_manage init force b t host=0
#./iscsi_manage init force sx="old_man_of_the_mountain" host=0
#./iscsi_manage init force sn=UNH-IOL-user-name host=0
#
# uncomment only 1 of the following 5 lines to configure the SRP group
# larger groups take correspondingly longer to compute
#./iscsi_manage init force sg=SRP-768 host=0
#./iscsi_manage init force sg=SRP-1024 host=0
#./iscsi_manage init force sg=SRP-1280 host=0
#./iscsi_manage init force sg=SRP-1536 host=0
#./iscsi_manage init force sg=SRP-2048 host=0
#
#./iscsi_manage init set HeaderDigest=CRC32C,None host=0
#./iscsi_manage init set DataDigest=CRC32C,None host=0
#
#./iscsi_manage init set MaxConnections=2 host=0
#./iscsi_manage init set MaxOutstandingR2T=2 host=0
#
#### performance usually better the larger these numbers are
#./iscsi_manage init set MaxRecvDataSegmentLength=12288 host=0
#./iscsi_manage init set FirstBurstLength=16384 host=0
#./iscsi_manage init set MaxBurstLength=32768 host=0
#./iscsi_manage init set MaxRecvDataSegmentLength=16773120 host=0
#./iscsi_manage init set MaxBurstLength=16773120 host=0
#./iscsi_manage init set FirstBurstLength=16773120 host=0
#
#### performance usually better when all write data goes immediate/unsolicited
#### (which is the combination InitialR2T=No and ImmediateData=Yes)
#./iscsi_manage init set InitialR2T=No host=0
#./iscsi_manage init set ImmediateData=No host=0
#
#### performance usually better when everything goes in order
#./iscsi_manage init set DataPDUInOrder=No host=0
#./iscsi_manage init set DataSequenceInOrder=No host=0
#
#./iscsi_manage init set OFMarker=No host=0
#./iscsi_manage init set IFMarker=No host=0
#./iscsi_manage init set IFMarkInt=4096~32768 host=0
#./iscsi_manage init set OFMarkInt=4096~4096 host=0
#./iscsi_manage init set DefaultTime2Wait=10 host=0
#./iscsi_manage init set DefaultTime2Retain=6 host=0
#
#./iscsi_manage init set ErrorRecoveryLevel=1 host=0
#
#	set the command retransmit interval to 4 seconds
#	(when ErrorRecoverLevel is greater than 0)
./iscsi_manage init force p=4 host=0
#
#	uncomment the following to enable initiator to send SNACKs to target
#	(when ErrorRecoverLevel is greater than 0)
./iscsi_manage init snack d=y host=0
./iscsi_manage init snack s=y host=0
#
#	uncomment the following to get a discovery session
#./iscsi_manage init set SessionType=Discovery host=0
#./iscsi_manage init setp SendTargets=All host=0
#
#	uncomment the following to try an X-extension key
#./iscsi_manage init set X-edu.unh.iol-extension-key-1=hello_over_there host=0
#
#	force round-robin scheduling if there are multiple connections
./iscsi_manage init force sch=1 host=0
#
#	force nop pings to be sent to target every 20 seconds
#./iscsi_manage init force n=20 host=0
#
./iscsi_config up ip=$ip port=$port host=0 lun=0
