diff options
-rw-r--r-- | drivers/infiniband/ulp/iser/iscsi_iser.c | 5 | ||||
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 5 | ||||
-rw-r--r-- | drivers/scsi/libiscsi.c | 40 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 39 | ||||
-rw-r--r-- | include/scsi/iscsi_if.h | 9 | ||||
-rw-r--r-- | include/scsi/libiscsi.h | 4 |
6 files changed, 84 insertions, 18 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 568f88bf7c91..6c8cd09c58f0 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c | |||
@@ -574,8 +574,9 @@ static struct iscsi_transport iscsi_iser_transport = { | |||
574 | ISCSI_EXP_STATSN | | 574 | ISCSI_EXP_STATSN | |
575 | ISCSI_PERSISTENT_PORT | | 575 | ISCSI_PERSISTENT_PORT | |
576 | ISCSI_PERSISTENT_ADDRESS | | 576 | ISCSI_PERSISTENT_ADDRESS | |
577 | ISCSI_TARGET_NAME | | 577 | ISCSI_TARGET_NAME | ISCSI_TPGT | |
578 | ISCSI_TPGT, | 578 | ISCSI_USERNAME | ISCSI_PASSWORD | |
579 | ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN, | ||
579 | .host_param_mask = ISCSI_HOST_HWADDRESS | | 580 | .host_param_mask = ISCSI_HOST_HWADDRESS | |
580 | ISCSI_HOST_INITIATOR_NAME, | 581 | ISCSI_HOST_INITIATOR_NAME, |
581 | .host_template = &iscsi_iser_sht, | 582 | .host_template = &iscsi_iser_sht, |
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index b2827d112cb0..1e722f5aabd4 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -2186,8 +2186,9 @@ static struct iscsi_transport iscsi_tcp_transport = { | |||
2186 | ISCSI_EXP_STATSN | | 2186 | ISCSI_EXP_STATSN | |
2187 | ISCSI_PERSISTENT_PORT | | 2187 | ISCSI_PERSISTENT_PORT | |
2188 | ISCSI_PERSISTENT_ADDRESS | | 2188 | ISCSI_PERSISTENT_ADDRESS | |
2189 | ISCSI_TARGET_NAME | | 2189 | ISCSI_TARGET_NAME | ISCSI_TPGT | |
2190 | ISCSI_TPGT, | 2190 | ISCSI_USERNAME | ISCSI_PASSWORD | |
2191 | ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN, | ||
2191 | .host_param_mask = ISCSI_HOST_HWADDRESS | | 2192 | .host_param_mask = ISCSI_HOST_HWADDRESS | |
2192 | ISCSI_HOST_INITIATOR_NAME, | 2193 | ISCSI_HOST_INITIATOR_NAME, |
2193 | .host_template = &iscsi_sht, | 2194 | .host_template = &iscsi_sht, |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 0a9c64e9ce8b..63981edf9ab9 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -1461,6 +1461,10 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session) | |||
1461 | iscsi_pool_free(&session->mgmtpool, (void**)session->mgmt_cmds); | 1461 | iscsi_pool_free(&session->mgmtpool, (void**)session->mgmt_cmds); |
1462 | iscsi_pool_free(&session->cmdpool, (void**)session->cmds); | 1462 | iscsi_pool_free(&session->cmdpool, (void**)session->cmds); |
1463 | 1463 | ||
1464 | kfree(session->password); | ||
1465 | kfree(session->password_in); | ||
1466 | kfree(session->username); | ||
1467 | kfree(session->username_in); | ||
1464 | kfree(session->targetname); | 1468 | kfree(session->targetname); |
1465 | kfree(session->hwaddress); | 1469 | kfree(session->hwaddress); |
1466 | kfree(session->initiatorname); | 1470 | kfree(session->initiatorname); |
@@ -1869,6 +1873,30 @@ int iscsi_set_param(struct iscsi_cls_conn *cls_conn, | |||
1869 | case ISCSI_PARAM_EXP_STATSN: | 1873 | case ISCSI_PARAM_EXP_STATSN: |
1870 | sscanf(buf, "%u", &conn->exp_statsn); | 1874 | sscanf(buf, "%u", &conn->exp_statsn); |
1871 | break; | 1875 | break; |
1876 | case ISCSI_PARAM_USERNAME: | ||
1877 | kfree(session->username); | ||
1878 | session->username = kstrdup(buf, GFP_KERNEL); | ||
1879 | if (!session->username) | ||
1880 | return -ENOMEM; | ||
1881 | break; | ||
1882 | case ISCSI_PARAM_USERNAME_IN: | ||
1883 | kfree(session->username_in); | ||
1884 | session->username_in = kstrdup(buf, GFP_KERNEL); | ||
1885 | if (!session->username_in) | ||
1886 | return -ENOMEM; | ||
1887 | break; | ||
1888 | case ISCSI_PARAM_PASSWORD: | ||
1889 | kfree(session->password); | ||
1890 | session->password = kstrdup(buf, GFP_KERNEL); | ||
1891 | if (!session->password) | ||
1892 | return -ENOMEM; | ||
1893 | break; | ||
1894 | case ISCSI_PARAM_PASSWORD_IN: | ||
1895 | kfree(session->password_in); | ||
1896 | session->password_in = kstrdup(buf, GFP_KERNEL); | ||
1897 | if (!session->password_in) | ||
1898 | return -ENOMEM; | ||
1899 | break; | ||
1872 | case ISCSI_PARAM_TARGET_NAME: | 1900 | case ISCSI_PARAM_TARGET_NAME: |
1873 | /* this should not change between logins */ | 1901 | /* this should not change between logins */ |
1874 | if (session->targetname) | 1902 | if (session->targetname) |
@@ -1942,6 +1970,18 @@ int iscsi_session_get_param(struct iscsi_cls_session *cls_session, | |||
1942 | case ISCSI_PARAM_TPGT: | 1970 | case ISCSI_PARAM_TPGT: |
1943 | len = sprintf(buf, "%d\n", session->tpgt); | 1971 | len = sprintf(buf, "%d\n", session->tpgt); |
1944 | break; | 1972 | break; |
1973 | case ISCSI_PARAM_USERNAME: | ||
1974 | len = sprintf(buf, "%s\n", session->username); | ||
1975 | break; | ||
1976 | case ISCSI_PARAM_USERNAME_IN: | ||
1977 | len = sprintf(buf, "%s\n", session->username_in); | ||
1978 | break; | ||
1979 | case ISCSI_PARAM_PASSWORD: | ||
1980 | len = sprintf(buf, "%s\n", session->password); | ||
1981 | break; | ||
1982 | case ISCSI_PARAM_PASSWORD_IN: | ||
1983 | len = sprintf(buf, "%s\n", session->password_in); | ||
1984 | break; | ||
1945 | default: | 1985 | default: |
1946 | return -ENOSYS; | 1986 | return -ENOSYS; |
1947 | } | 1987 | } |
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 5ec2fbea8937..341d4fb5c6f8 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <scsi/scsi_transport_iscsi.h> | 30 | #include <scsi/scsi_transport_iscsi.h> |
31 | #include <scsi/iscsi_if.h> | 31 | #include <scsi/iscsi_if.h> |
32 | 32 | ||
33 | #define ISCSI_SESSION_ATTRS 11 | 33 | #define ISCSI_SESSION_ATTRS 15 |
34 | #define ISCSI_CONN_ATTRS 11 | 34 | #define ISCSI_CONN_ATTRS 11 |
35 | #define ISCSI_HOST_ATTRS 2 | 35 | #define ISCSI_HOST_ATTRS 2 |
36 | #define ISCSI_TRANSPORT_VERSION "2.0-724" | 36 | #define ISCSI_TRANSPORT_VERSION "2.0-724" |
@@ -1196,30 +1196,37 @@ iscsi_conn_attr(address, ISCSI_PARAM_CONN_ADDRESS); | |||
1196 | /* | 1196 | /* |
1197 | * iSCSI session attrs | 1197 | * iSCSI session attrs |
1198 | */ | 1198 | */ |
1199 | #define iscsi_session_attr_show(param) \ | 1199 | #define iscsi_session_attr_show(param, perm) \ |
1200 | static ssize_t \ | 1200 | static ssize_t \ |
1201 | show_session_param_##param(struct class_device *cdev, char *buf) \ | 1201 | show_session_param_##param(struct class_device *cdev, char *buf) \ |
1202 | { \ | 1202 | { \ |
1203 | struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev); \ | 1203 | struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev); \ |
1204 | struct iscsi_transport *t = session->transport; \ | 1204 | struct iscsi_transport *t = session->transport; \ |
1205 | \ | ||
1206 | if (perm && !capable(CAP_SYS_ADMIN)) \ | ||
1207 | return -EACCES; \ | ||
1205 | return t->get_session_param(session, param, buf); \ | 1208 | return t->get_session_param(session, param, buf); \ |
1206 | } | 1209 | } |
1207 | 1210 | ||
1208 | #define iscsi_session_attr(field, param) \ | 1211 | #define iscsi_session_attr(field, param, perm) \ |
1209 | iscsi_session_attr_show(param) \ | 1212 | iscsi_session_attr_show(param, perm) \ |
1210 | static ISCSI_CLASS_ATTR(sess, field, S_IRUGO, show_session_param_##param, \ | 1213 | static ISCSI_CLASS_ATTR(sess, field, S_IRUGO, show_session_param_##param, \ |
1211 | NULL); | 1214 | NULL); |
1212 | 1215 | ||
1213 | iscsi_session_attr(targetname, ISCSI_PARAM_TARGET_NAME); | 1216 | iscsi_session_attr(targetname, ISCSI_PARAM_TARGET_NAME, 0); |
1214 | iscsi_session_attr(initial_r2t, ISCSI_PARAM_INITIAL_R2T_EN); | 1217 | iscsi_session_attr(initial_r2t, ISCSI_PARAM_INITIAL_R2T_EN, 0); |
1215 | iscsi_session_attr(max_outstanding_r2t, ISCSI_PARAM_MAX_R2T); | 1218 | iscsi_session_attr(max_outstanding_r2t, ISCSI_PARAM_MAX_R2T, 0); |
1216 | iscsi_session_attr(immediate_data, ISCSI_PARAM_IMM_DATA_EN); | 1219 | iscsi_session_attr(immediate_data, ISCSI_PARAM_IMM_DATA_EN, 0); |
1217 | iscsi_session_attr(first_burst_len, ISCSI_PARAM_FIRST_BURST); | 1220 | iscsi_session_attr(first_burst_len, ISCSI_PARAM_FIRST_BURST, 0); |
1218 | iscsi_session_attr(max_burst_len, ISCSI_PARAM_MAX_BURST); | 1221 | iscsi_session_attr(max_burst_len, ISCSI_PARAM_MAX_BURST, 0); |
1219 | iscsi_session_attr(data_pdu_in_order, ISCSI_PARAM_PDU_INORDER_EN); | 1222 | iscsi_session_attr(data_pdu_in_order, ISCSI_PARAM_PDU_INORDER_EN, 0); |
1220 | iscsi_session_attr(data_seq_in_order, ISCSI_PARAM_DATASEQ_INORDER_EN); | 1223 | iscsi_session_attr(data_seq_in_order, ISCSI_PARAM_DATASEQ_INORDER_EN, 0); |
1221 | iscsi_session_attr(erl, ISCSI_PARAM_ERL); | 1224 | iscsi_session_attr(erl, ISCSI_PARAM_ERL, 0); |
1222 | iscsi_session_attr(tpgt, ISCSI_PARAM_TPGT); | 1225 | iscsi_session_attr(tpgt, ISCSI_PARAM_TPGT, 0); |
1226 | iscsi_session_attr(username, ISCSI_PARAM_USERNAME, 1); | ||
1227 | iscsi_session_attr(username_in, ISCSI_PARAM_USERNAME_IN, 1); | ||
1228 | iscsi_session_attr(password, ISCSI_PARAM_PASSWORD, 1); | ||
1229 | iscsi_session_attr(password_in, ISCSI_PARAM_PASSWORD_IN, 1); | ||
1223 | 1230 | ||
1224 | #define iscsi_priv_session_attr_show(field, format) \ | 1231 | #define iscsi_priv_session_attr_show(field, format) \ |
1225 | static ssize_t \ | 1232 | static ssize_t \ |
@@ -1433,6 +1440,10 @@ iscsi_register_transport(struct iscsi_transport *tt) | |||
1433 | SETUP_SESSION_RD_ATTR(erl, ISCSI_ERL); | 1440 | SETUP_SESSION_RD_ATTR(erl, ISCSI_ERL); |
1434 | SETUP_SESSION_RD_ATTR(targetname, ISCSI_TARGET_NAME); | 1441 | SETUP_SESSION_RD_ATTR(targetname, ISCSI_TARGET_NAME); |
1435 | SETUP_SESSION_RD_ATTR(tpgt, ISCSI_TPGT); | 1442 | SETUP_SESSION_RD_ATTR(tpgt, ISCSI_TPGT); |
1443 | SETUP_SESSION_RD_ATTR(password, ISCSI_USERNAME); | ||
1444 | SETUP_SESSION_RD_ATTR(password_in, ISCSI_USERNAME_IN); | ||
1445 | SETUP_SESSION_RD_ATTR(username, ISCSI_PASSWORD); | ||
1446 | SETUP_SESSION_RD_ATTR(username_in, ISCSI_PASSWORD_IN); | ||
1436 | SETUP_PRIV_SESSION_RD_ATTR(recovery_tmo); | 1447 | SETUP_PRIV_SESSION_RD_ATTR(recovery_tmo); |
1437 | 1448 | ||
1438 | BUG_ON(count > ISCSI_SESSION_ATTRS); | 1449 | BUG_ON(count > ISCSI_SESSION_ATTRS); |
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h index e057c5d3703d..1a18196d77f6 100644 --- a/include/scsi/iscsi_if.h +++ b/include/scsi/iscsi_if.h | |||
@@ -229,6 +229,11 @@ enum iscsi_param { | |||
229 | ISCSI_PARAM_CONN_PORT, | 229 | ISCSI_PARAM_CONN_PORT, |
230 | ISCSI_PARAM_CONN_ADDRESS, | 230 | ISCSI_PARAM_CONN_ADDRESS, |
231 | 231 | ||
232 | ISCSI_PARAM_USERNAME, | ||
233 | ISCSI_PARAM_USERNAME_IN, | ||
234 | ISCSI_PARAM_PASSWORD, | ||
235 | ISCSI_PARAM_PASSWORD_IN, | ||
236 | |||
232 | /* must always be last */ | 237 | /* must always be last */ |
233 | ISCSI_PARAM_MAX, | 238 | ISCSI_PARAM_MAX, |
234 | }; | 239 | }; |
@@ -255,6 +260,10 @@ enum iscsi_param { | |||
255 | #define ISCSI_SESS_RECOVERY_TMO (1 << ISCSI_PARAM_SESS_RECOVERY_TMO) | 260 | #define ISCSI_SESS_RECOVERY_TMO (1 << ISCSI_PARAM_SESS_RECOVERY_TMO) |
256 | #define ISCSI_CONN_PORT (1 << ISCSI_PARAM_CONN_PORT) | 261 | #define ISCSI_CONN_PORT (1 << ISCSI_PARAM_CONN_PORT) |
257 | #define ISCSI_CONN_ADDRESS (1 << ISCSI_PARAM_CONN_ADDRESS) | 262 | #define ISCSI_CONN_ADDRESS (1 << ISCSI_PARAM_CONN_ADDRESS) |
263 | #define ISCSI_USERNAME (1 << ISCSI_PARAM_USERNAME) | ||
264 | #define ISCSI_USERNAME_IN (1 << ISCSI_PARAM_USERNAME_IN) | ||
265 | #define ISCSI_PASSWORD (1 << ISCSI_PARAM_PASSWORD) | ||
266 | #define ISCSI_PASSWORD_IN (1 << ISCSI_PARAM_PASSWORD_IN) | ||
258 | 267 | ||
259 | /* iSCSI HBA params */ | 268 | /* iSCSI HBA params */ |
260 | enum iscsi_host_param { | 269 | enum iscsi_host_param { |
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 348265d4a27e..61bc8f75b267 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
@@ -221,6 +221,10 @@ struct iscsi_session { | |||
221 | int dataseq_inorder_en; | 221 | int dataseq_inorder_en; |
222 | int erl; | 222 | int erl; |
223 | int tpgt; | 223 | int tpgt; |
224 | char *username; | ||
225 | char *username_in; | ||
226 | char *password; | ||
227 | char *password_in; | ||
224 | char *targetname; | 228 | char *targetname; |
225 | char *initiatorname; | 229 | char *initiatorname; |
226 | /* hw address being used for iscsi connection */ | 230 | /* hw address being used for iscsi connection */ |