|
Packit |
eace71 |
/*
|
|
Packit |
eace71 |
* Copyright (C) 2017-2018 Red Hat, Inc.
|
|
Packit |
eace71 |
*
|
|
Packit |
eace71 |
* This program is free software: you can redistribute it and/or modify
|
|
Packit |
eace71 |
* it under the terms of the GNU General Public License as published by
|
|
Packit |
eace71 |
* the Free Software Foundation, either version 3 of the License, or
|
|
Packit |
eace71 |
* (at your option) any later version.
|
|
Packit |
eace71 |
*
|
|
Packit |
eace71 |
* This program is distributed in the hope that it will be useful,
|
|
Packit |
eace71 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
eace71 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
eace71 |
* GNU General Public License for more details.
|
|
Packit |
eace71 |
*
|
|
Packit |
eace71 |
* You should have received a copy of the GNU General Public License
|
|
Packit |
eace71 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
eace71 |
*
|
|
Packit |
eace71 |
* Author: Gris Ge <fge@redhat.com>
|
|
Packit |
eace71 |
*/
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
#include <string.h>
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
#include "libopeniscsiusr/libopeniscsiusr.h"
|
|
Packit |
eace71 |
#include "default.h"
|
|
Packit |
eace71 |
#include "iface.h"
|
|
Packit |
eace71 |
#include "node.h"
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
#define CONFIG_DIGEST_NEVER 0
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
static void default_session_op_cfg(struct iscsi_session_op_cfg *op_cfg)
|
|
Packit |
eace71 |
{
|
|
Packit |
eace71 |
op_cfg->InitialR2T = 0;
|
|
Packit |
eace71 |
op_cfg->ImmediateData = 1;
|
|
Packit |
eace71 |
op_cfg->FirstBurstLength = DEF_INI_FIRST_BURST_LEN;
|
|
Packit |
eace71 |
op_cfg->MaxBurstLength = DEF_INI_MAX_BURST_LEN;
|
|
Packit |
eace71 |
op_cfg->DefaultTime2Wait = ISCSI_DEF_TIME2WAIT;
|
|
Packit |
eace71 |
op_cfg->DefaultTime2Retain = 0;
|
|
Packit |
eace71 |
op_cfg->MaxConnections = 1;
|
|
Packit |
eace71 |
op_cfg->MaxOutstandingR2T = 1;
|
|
Packit |
eace71 |
op_cfg->ERL = 0;
|
|
Packit |
eace71 |
op_cfg->FastAbort = 1;
|
|
Packit |
eace71 |
}
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
static void default_conn_op_cfg(struct iscsi_conn_op_cfg *op_cfg)
|
|
Packit |
eace71 |
{
|
|
Packit |
eace71 |
op_cfg->MaxXmitDataSegmentLength = 0;
|
|
Packit |
eace71 |
op_cfg->MaxRecvDataSegmentLength = DEF_INI_MAX_RECV_SEG_LEN;
|
|
Packit |
eace71 |
op_cfg->HeaderDigest = DIGEST_NEVER;
|
|
Packit |
eace71 |
op_cfg->DataDigest = DIGEST_NEVER;
|
|
Packit |
eace71 |
op_cfg->IFMarker = 0;
|
|
Packit |
eace71 |
op_cfg->OFMarker = 0;
|
|
Packit |
eace71 |
}
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
/*
|
|
Packit |
eace71 |
* default is to use tcp through whatever the network layer
|
|
Packit |
eace71 |
* selects for us with the /etc/iscsi/initiatorname.iscsi iname.
|
|
Packit |
eace71 |
*/
|
|
Packit |
eace71 |
static void default_iface(struct iscsi_iface *iface)
|
|
Packit |
eace71 |
{
|
|
Packit |
eace71 |
snprintf(iface->transport_name,
|
|
Packit |
eace71 |
sizeof(iface->transport_name)/sizeof(char),
|
|
Packit |
eace71 |
DEFAULT_TRANSPORT);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
if (!strlen(iface->name))
|
|
Packit |
eace71 |
snprintf(iface->name, sizeof(iface->name)/sizeof(char),
|
|
Packit |
eace71 |
DEFAULT_IFACENAME);
|
|
Packit |
eace71 |
}
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
void _default_node(struct iscsi_node *node)
|
|
Packit |
eace71 |
{
|
|
Packit |
eace71 |
node->tpgt = PORTAL_GROUP_TAG_UNKNOWN;
|
|
Packit |
eace71 |
node->disc_type = DISCOVERY_TYPE_STATIC;
|
|
Packit |
eace71 |
node->leading_login = 0;
|
|
Packit |
eace71 |
node->session.cmds_max = CMDS_MAX;
|
|
Packit |
eace71 |
node->session.xmit_thread_priority = XMIT_THREAD_PRIORITY;
|
|
Packit |
eace71 |
node->session.initial_cmdsn = 0;
|
|
Packit |
eace71 |
node->session.queue_depth = QUEUE_DEPTH;
|
|
Packit |
eace71 |
node->session.nr_sessions = 1;
|
|
Packit |
eace71 |
node->session.initial_login_retry_max = DEF_INITIAL_LOGIN_RETRIES_MAX;
|
|
Packit |
eace71 |
node->session.reopen_max = DEF_SESSION_REOPEN_MAX;
|
|
Packit |
eace71 |
node->session.auth.authmethod = 0;
|
|
Packit |
fddd15 |
/* TYPE_INT_LIST fields should be initialized to ~0 to indicate unset values */
|
|
Packit |
fddd15 |
memset(node->session.auth.chap_algs, ~0, sizeof(node->session.auth.chap_algs));
|
|
Packit |
fddd15 |
node->session.auth.chap_algs[0] = ISCSI_AUTH_CHAP_ALG_MD5;
|
|
Packit |
eace71 |
node->session.auth.password_length = 0;
|
|
Packit |
eace71 |
node->session.auth.password_in_length = 0;
|
|
Packit |
eace71 |
node->session.err_tmo.abort_timeout = DEF_ABORT_TIMEO;
|
|
Packit |
eace71 |
node->session.err_tmo.lu_reset_timeout = DEF_LU_RESET_TIMEO;
|
|
Packit |
eace71 |
node->session.err_tmo.tgt_reset_timeout = DEF_TGT_RESET_TIMEO;
|
|
Packit |
eace71 |
node->session.err_tmo.host_reset_timeout = DEF_HOST_RESET_TIMEO;
|
|
Packit |
eace71 |
node->session.tmo.replacement_timeout = DEF_REPLACEMENT_TIMEO;
|
|
Packit |
eace71 |
node->session.se = NULL;
|
|
Packit |
eace71 |
node->session.sid = 0;
|
|
Packit |
eace71 |
node->session.multiple = 0;
|
|
Packit |
eace71 |
node->session.scan = DEF_INITIAL_SCAN;
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
default_session_op_cfg(&node->session.op_cfg);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
node->conn.startup = ISCSI_STARTUP_MANUAL;
|
|
Packit |
eace71 |
node->conn.port = ISCSI_DEFAULT_PORT;
|
|
Packit |
eace71 |
node->conn.tcp.window_size = TCP_WINDOW_SIZE;
|
|
Packit |
eace71 |
node->conn.tcp.type_of_service = 0;
|
|
Packit |
eace71 |
node->conn.tmo.login_timeout= DEF_LOGIN_TIMEO;
|
|
Packit |
eace71 |
node->conn.tmo.logout_timeout= DEF_LOGOUT_TIMEO;
|
|
Packit |
eace71 |
node->conn.tmo.auth_timeout = 45;
|
|
Packit |
eace71 |
node->conn.tmo.noop_out_interval = DEF_NOOP_OUT_INTERVAL;
|
|
Packit |
eace71 |
node->conn.tmo.noop_out_timeout = DEF_NOOP_OUT_TIMEO;
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
default_conn_op_cfg(&node->conn.op_cfg);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
default_iface(&node->iface);
|
|
Packit |
eace71 |
}
|