|
@@ -729,8 +729,8 @@ int iscsi_post_login_handler(
|
|
|
}
|
|
|
|
|
|
pr_debug("iSCSI Login successful on CID: %hu from %s to"
|
|
|
- " %s:%hu,%hu\n", conn->cid, conn->login_ip,
|
|
|
- conn->local_ip, conn->local_port, tpg->tpgt);
|
|
|
+ " %pISpc,%hu\n", conn->cid, conn->login_ip,
|
|
|
+ &conn->local_sockaddr, tpg->tpgt);
|
|
|
|
|
|
list_add_tail(&conn->conn_list, &sess->sess_conn_list);
|
|
|
atomic_inc(&sess->nconn);
|
|
@@ -774,8 +774,8 @@ int iscsi_post_login_handler(
|
|
|
pr_debug("Moving to TARG_SESS_STATE_LOGGED_IN.\n");
|
|
|
sess->session_state = TARG_SESS_STATE_LOGGED_IN;
|
|
|
|
|
|
- pr_debug("iSCSI Login successful on CID: %hu from %s to %s:%hu,%hu\n",
|
|
|
- conn->cid, conn->login_ip, conn->local_ip, conn->local_port,
|
|
|
+ pr_debug("iSCSI Login successful on CID: %hu from %s to %pISpc,%hu\n",
|
|
|
+ conn->cid, conn->login_ip, &conn->local_sockaddr,
|
|
|
tpg->tpgt);
|
|
|
|
|
|
spin_lock_bh(&sess->conn_lock);
|
|
@@ -823,8 +823,8 @@ static void iscsi_handle_login_thread_timeout(unsigned long data)
|
|
|
struct iscsi_np *np = (struct iscsi_np *) data;
|
|
|
|
|
|
spin_lock_bh(&np->np_thread_lock);
|
|
|
- pr_err("iSCSI Login timeout on Network Portal %pISc:%hu\n",
|
|
|
- &np->np_sockaddr, np->np_port);
|
|
|
+ pr_err("iSCSI Login timeout on Network Portal %pISpc\n",
|
|
|
+ &np->np_sockaddr);
|
|
|
|
|
|
if (np->np_login_timer_flags & ISCSI_TF_STOP) {
|
|
|
spin_unlock_bh(&np->np_thread_lock);
|
|
@@ -1027,13 +1027,15 @@ int iscsit_accept_np(struct iscsi_np *np, struct iscsi_conn *conn)
|
|
|
rc = conn->sock->ops->getname(conn->sock,
|
|
|
(struct sockaddr *)&sock_in6, &err, 0);
|
|
|
if (!rc) {
|
|
|
- if (!ipv6_addr_v4mapped(&sock_in6.sin6_addr))
|
|
|
- snprintf(conn->local_ip, sizeof(conn->local_ip), "[%pI6c]",
|
|
|
- &sock_in6.sin6_addr.in6_u);
|
|
|
- else
|
|
|
- snprintf(conn->local_ip, sizeof(conn->local_ip), "%pI4",
|
|
|
- &sock_in6.sin6_addr.s6_addr32[3]);
|
|
|
- conn->local_port = ntohs(sock_in6.sin6_port);
|
|
|
+ if (!ipv6_addr_v4mapped(&sock_in6.sin6_addr)) {
|
|
|
+ memcpy(&conn->local_sockaddr, &sock_in6, sizeof(sock_in6));
|
|
|
+ } else {
|
|
|
+ /* Pretend to be an ipv4 socket */
|
|
|
+ sock_in.sin_family = AF_INET;
|
|
|
+ sock_in.sin_port = sock_in6.sin6_port;
|
|
|
+ memcpy(&sock_in.sin_addr, &sock_in6.sin6_addr.s6_addr32[3], 4);
|
|
|
+ memcpy(&conn->local_sockaddr, &sock_in, sizeof(sock_in));
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
memset(&sock_in, 0, sizeof(struct sockaddr_in));
|
|
@@ -1048,11 +1050,8 @@ int iscsit_accept_np(struct iscsi_np *np, struct iscsi_conn *conn)
|
|
|
|
|
|
rc = conn->sock->ops->getname(conn->sock,
|
|
|
(struct sockaddr *)&sock_in, &err, 0);
|
|
|
- if (!rc) {
|
|
|
- sprintf(conn->local_ip, "%pI4",
|
|
|
- &sock_in.sin_addr.s_addr);
|
|
|
- conn->local_port = ntohs(sock_in.sin_port);
|
|
|
- }
|
|
|
+ if (!rc)
|
|
|
+ memcpy(&conn->local_sockaddr, &sock_in, sizeof(sock_in));
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
@@ -1302,8 +1301,8 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
|
|
|
spin_lock_bh(&np->np_thread_lock);
|
|
|
if (np->np_thread_state != ISCSI_NP_THREAD_ACTIVE) {
|
|
|
spin_unlock_bh(&np->np_thread_lock);
|
|
|
- pr_err("iSCSI Network Portal on %pISc:%hu currently not"
|
|
|
- " active.\n", &np->np_sockaddr, np->np_port);
|
|
|
+ pr_err("iSCSI Network Portal on %pISpc currently not"
|
|
|
+ " active.\n", &np->np_sockaddr);
|
|
|
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
|
|
|
ISCSI_LOGIN_STATUS_SVC_UNAVAILABLE);
|
|
|
goto new_sess_out;
|
|
@@ -1313,8 +1312,8 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
|
|
|
conn->network_transport = np->np_network_transport;
|
|
|
|
|
|
pr_debug("Received iSCSI login request from %s on %s Network"
|
|
|
- " Portal %s:%hu\n", conn->login_ip, np->np_transport->name,
|
|
|
- conn->local_ip, conn->local_port);
|
|
|
+ " Portal %pISpc\n", conn->login_ip, np->np_transport->name,
|
|
|
+ &conn->local_sockaddr);
|
|
|
|
|
|
pr_debug("Moving to TARG_CONN_STATE_IN_LOGIN.\n");
|
|
|
conn->conn_state = TARG_CONN_STATE_IN_LOGIN;
|