1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
|
/*
* iSCSI Configuration
*
* Copyright (C) 2002 Cisco Systems, Inc.
* maintained by linux-iscsi-devel@lists.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* See the file COPYING included with this distribution for more details.
*/
#ifndef CONFIG_H
#define CONFIG_H
#include <netdb.h>
#include <net/if.h>
#include "types.h"
#include "auth.h" /* for the username and password sizes */
#include "list.h"
#include "iscsi_proto.h"
#include "iscsi_net_util.h"
/* ISIDs now have a typed naming authority in them. We use an OUI */
#define DRIVER_ISID_0 0x00
#define DRIVER_ISID_1 0x02
#define DRIVER_ISID_2 0x3D
/* number of possible connections per session */
#define ISCSI_CONN_MAX 1
/* max len of interface */
#define ISCSI_MAX_IFACE_LEN 65
/* the following structures store the options set in the config file.
* a structure is defined for each logically-related group of options.
* if you are adding a new option, first check if it should belong
* to one of the existing groups. If it does, add it. If not, define
* a new structure.
*/
/* all authentication-related options should be added to this structure.
* this structure is per-session, and can be configured
* by TargetName but not Subnet.
*/
struct iscsi_auth_config {
unsigned int authmethod;
char username[AUTH_STR_MAX_LEN];
unsigned char password[AUTH_STR_MAX_LEN];
unsigned int password_length;
char username_in[AUTH_STR_MAX_LEN];
unsigned char password_in[AUTH_STR_MAX_LEN];
unsigned int password_in_length;
unsigned int chap_algs[AUTH_CHAP_ALG_MAX_COUNT];
};
/* all per-connection timeouts go in this structure.
* this structure is per-portal, and can be configured
* both by TargetName and Subnet.
*/
struct iscsi_connection_timeout_config {
int login_timeout;
int logout_timeout;
int auth_timeout;
int active_timeout;
int noop_out_interval;
int noop_out_timeout;
};
/* all per-session timeouts go in this structure.
* this structure is per-session, and can be configured
* by TargetName but not by Subnet.
*/
struct iscsi_session_timeout_config {
int replacement_timeout;
};
/* all error handling timeouts go in this structure.
* this structure is per-portal, and can be configured
* both by TargetName and Subnet.
*/
struct iscsi_error_timeout_config {
int abort_timeout;
int host_reset_timeout;
int lu_reset_timeout;
int tgt_reset_timeout;
};
/* all TCP options go in this structure.
* this structure is per-portal, and can be configured
* both by TargetName and Subnet.
*/
struct iscsi_tcp_config {
int window_size;
int type_of_service; /* try to set IP TOS bits */
};
struct iscsi_conn_operational_config {
int MaxRecvDataSegmentLength;
int MaxXmitDataSegmentLength;
int HeaderDigest;
int DataDigest;
int IFMarker;
int OFMarker;
};
/* all iSCSI operational params go in this structure.
* this structure is per-portal, and can be configured
* both by TargetName and Subnet.
*/
struct iscsi_session_operational_config {
int DataPDUInOrder;
int DataSequenceInOrder;
int protocol;
int InitialR2T;
int ImmediateData;
int FirstBurstLength;
int MaxBurstLength;
int DefaultTime2Wait;
int DefaultTime2Retain;
int MaxConnections;
int MaxOutstandingR2T;
int ERL;
int FastAbort;
};
#define CONFIG_DIGEST_NEVER 0
#define CONFIG_DIGEST_ALWAYS 1
#define CONFIG_DIGEST_PREFER_ON 2
#define CONFIG_DIGEST_PREFER_OFF 3
struct iscsi_sendtargets_config {
int reopen_max;
int use_discoveryd;
int discoveryd_poll_inval;
struct iscsi_auth_config auth;
struct iscsi_connection_timeout_config conn_timeo;
struct iscsi_conn_operational_config conn_conf;
struct iscsi_session_operational_config session_conf;
};
struct iscsi_isns_config {
int use_discoveryd;
int discoveryd_poll_inval;
};
struct iscsi_slp_config {
char *scopes;
char *interfaces; /* for multicast, list of interfaces names,
* "all", or "none" */
int poll_interval;
struct iscsi_auth_config auth;
};
typedef enum iscsi_startup {
ISCSI_STARTUP_MANUAL,
ISCSI_STARTUP_AUTOMATIC,
ISCSI_STARTUP_ONBOOT,
} iscsi_startup_e;
typedef enum discovery_type {
DISCOVERY_TYPE_SENDTARGETS,
DISCOVERY_TYPE_ISNS,
DISCOVERY_TYPE_OFFLOAD_SENDTARGETS,
DISCOVERY_TYPE_SLP,
DISCOVERY_TYPE_STATIC,
DISCOVERY_TYPE_FW,
} discovery_type_e;
typedef struct conn_rec {
iscsi_startup_e startup;
char address[NI_MAXHOST];
int port;
struct iscsi_tcp_config tcp;
struct iscsi_connection_timeout_config timeo;
struct iscsi_conn_operational_config iscsi;
} conn_rec_t;
typedef struct session_rec {
int initial_cmdsn;
int reopen_max;
int xmit_thread_priority;
int cmds_max;
int queue_depth;
int initial_login_retry_max;
int nr_sessions;
int scan;
struct iscsi_auth_config auth;
struct iscsi_session_timeout_config timeo;
struct iscsi_error_timeout_config err_timeo;
struct iscsi_session_operational_config iscsi;
struct session_info *info;
unsigned sid;
/*
* This is a flag passed to iscsid. If set, multiple sessions are
* allowed to be initiated on this record
*/
unsigned char multiple;
char boot_root[BOOT_NAME_MAXLEN];
char boot_nic[BOOT_NAME_MAXLEN];
char boot_target[BOOT_NAME_MAXLEN];
} session_rec_t;
#define ISCSI_TRANSPORT_NAME_MAXLEN 16
#define ISCSI_MAX_STR_LEN 80
typedef struct iface_rec {
struct list_head list;
/* iscsi iface record name */
char name[ISCSI_MAX_IFACE_LEN];
uint32_t iface_num;
/* network layer iface name (eth0) */
char netdev[IFNAMSIZ];
char ipaddress[NI_MAXHOST];
char subnet_mask[NI_MAXHOST];
char gateway[NI_MAXHOST];
char bootproto[ISCSI_MAX_STR_LEN];
char ipv6_linklocal[NI_MAXHOST];
char ipv6_router[NI_MAXHOST];
char ipv6_autocfg[NI_MAXHOST];
char linklocal_autocfg[NI_MAXHOST];
char router_autocfg[NI_MAXHOST];
uint8_t prefix_len;
uint16_t vlan_id;
uint8_t vlan_priority;
char vlan_state[ISCSI_MAX_STR_LEN];
char state[ISCSI_MAX_STR_LEN]; /* 0 = disable,
* 1 = enable */
uint16_t mtu;
uint16_t port;
char delayed_ack[ISCSI_MAX_STR_LEN];
char nagle[ISCSI_MAX_STR_LEN];
char tcp_wsf_state[ISCSI_MAX_STR_LEN];
uint8_t tcp_wsf;
uint8_t tcp_timer_scale;
char tcp_timestamp[ISCSI_MAX_STR_LEN];
char dhcp_dns[ISCSI_MAX_STR_LEN];
char dhcp_slp_da[ISCSI_MAX_STR_LEN];
char tos_state[ISCSI_MAX_STR_LEN];
uint8_t tos;
char gratuitous_arp[ISCSI_MAX_STR_LEN];
char dhcp_alt_client_id_state[ISCSI_MAX_STR_LEN];
char dhcp_alt_client_id[ISCSI_MAX_STR_LEN];
char dhcp_req_vendor_id_state[ISCSI_MAX_STR_LEN];
char dhcp_vendor_id_state[ISCSI_MAX_STR_LEN];
char dhcp_vendor_id[ISCSI_MAX_STR_LEN];
char dhcp_learn_iqn[ISCSI_MAX_STR_LEN];
char fragmentation[ISCSI_MAX_STR_LEN];
char incoming_forwarding[ISCSI_MAX_STR_LEN];
uint8_t ttl;
char gratuitous_neighbor_adv[ISCSI_MAX_STR_LEN];
char redirect[ISCSI_MAX_STR_LEN];
char mld[ISCSI_MAX_STR_LEN];
uint32_t flow_label;
uint32_t traffic_class;
uint8_t hop_limit;
uint32_t nd_reachable_tmo;
uint32_t nd_rexmit_time;
uint32_t nd_stale_tmo;
uint8_t dup_addr_detect_cnt;
uint32_t router_adv_link_mtu;
uint16_t def_task_mgmt_tmo;
char header_digest[ISCSI_MAX_STR_LEN];
char data_digest[ISCSI_MAX_STR_LEN];
char immediate_data[ISCSI_MAX_STR_LEN];
char initial_r2t[ISCSI_MAX_STR_LEN];
char data_seq_inorder[ISCSI_MAX_STR_LEN];
char data_pdu_inorder[ISCSI_MAX_STR_LEN];
uint8_t erl;
uint32_t max_recv_dlength;
uint32_t first_burst_len;
uint16_t max_out_r2t;
uint32_t max_burst_len;
char chap_auth[ISCSI_MAX_STR_LEN];
char bidi_chap[ISCSI_MAX_STR_LEN];
char strict_login_comp[ISCSI_MAX_STR_LEN];
char discovery_auth[ISCSI_MAX_STR_LEN];
char discovery_logout[ISCSI_MAX_STR_LEN];
char port_state[ISCSI_MAX_STR_LEN];
char port_speed[ISCSI_MAX_STR_LEN];
/*
* TODO: we may have to make this bigger and interconnect
* specific for infiniband
*/
char hwaddress[ISCSI_HWADDRESS_BUF_SIZE];
char transport_name[ISCSI_TRANSPORT_NAME_MAXLEN];
/*
* This is only used for boot now, but the iser guys
* can use this for their virtualization idea.
*/
char alias[TARGET_NAME_MAXLEN + 1];
char iname[TARGET_NAME_MAXLEN + 1];
} iface_rec_t;
typedef struct node_rec {
struct list_head list;
char name[TARGET_NAME_MAXLEN];
int tpgt;
iscsi_startup_e startup;
int leading_login;
session_rec_t session;
conn_rec_t conn[ISCSI_CONN_MAX];
iface_rec_t iface;
discovery_type_e disc_type;
char disc_address[NI_MAXHOST];
int disc_port;
} node_rec_t;
typedef struct discovery_rec {
iscsi_startup_e startup;
discovery_type_e type;
char address[NI_MAXHOST];
int port;
int iscsid_req_tmo;
union {
struct iscsi_sendtargets_config sendtargets;
struct iscsi_slp_config slp;
struct iscsi_isns_config isns;
} u;
} discovery_rec_t;
#endif /* CONFIG_H */
|