Commit 1ac507d4 authored by Sowmini Varadhan's avatar Sowmini Varadhan Committed by David S. Miller

RDS: TCP: report addr/port info based on TCP socket in rds-info

The socket argument passed to rds_tcp_tc_info() is a PF_RDS socket,
so it is incorrect to report the address port info based on
rds_getname() as part of TCP state report.

Invoke inet_getname() for the t_sock associated with the
rds_tcp_connection instead.
Signed-off-by: default avatarSowmini Varadhan <sowmini.varadhan@oracle.com>
Acked-by: default avatarSantosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f5f99309
...@@ -220,7 +220,7 @@ void rds_tcp_set_callbacks(struct socket *sock, struct rds_conn_path *cp) ...@@ -220,7 +220,7 @@ void rds_tcp_set_callbacks(struct socket *sock, struct rds_conn_path *cp)
write_unlock_bh(&sock->sk->sk_callback_lock); write_unlock_bh(&sock->sk->sk_callback_lock);
} }
static void rds_tcp_tc_info(struct socket *sock, unsigned int len, static void rds_tcp_tc_info(struct socket *rds_sock, unsigned int len,
struct rds_info_iterator *iter, struct rds_info_iterator *iter,
struct rds_info_lengths *lens) struct rds_info_lengths *lens)
{ {
...@@ -229,6 +229,7 @@ static void rds_tcp_tc_info(struct socket *sock, unsigned int len, ...@@ -229,6 +229,7 @@ static void rds_tcp_tc_info(struct socket *sock, unsigned int len,
unsigned long flags; unsigned long flags;
struct sockaddr_in sin; struct sockaddr_in sin;
int sinlen; int sinlen;
struct socket *sock;
spin_lock_irqsave(&rds_tcp_tc_list_lock, flags); spin_lock_irqsave(&rds_tcp_tc_list_lock, flags);
...@@ -237,12 +238,17 @@ static void rds_tcp_tc_info(struct socket *sock, unsigned int len, ...@@ -237,12 +238,17 @@ static void rds_tcp_tc_info(struct socket *sock, unsigned int len,
list_for_each_entry(tc, &rds_tcp_tc_list, t_list_item) { list_for_each_entry(tc, &rds_tcp_tc_list, t_list_item) {
sock->ops->getname(sock, (struct sockaddr *)&sin, &sinlen, 0); sock = tc->t_sock;
tsinfo.local_addr = sin.sin_addr.s_addr; if (sock) {
tsinfo.local_port = sin.sin_port; sock->ops->getname(sock, (struct sockaddr *)&sin,
sock->ops->getname(sock, (struct sockaddr *)&sin, &sinlen, 1); &sinlen, 0);
tsinfo.peer_addr = sin.sin_addr.s_addr; tsinfo.local_addr = sin.sin_addr.s_addr;
tsinfo.peer_port = sin.sin_port; tsinfo.local_port = sin.sin_port;
sock->ops->getname(sock, (struct sockaddr *)&sin,
&sinlen, 1);
tsinfo.peer_addr = sin.sin_addr.s_addr;
tsinfo.peer_port = sin.sin_port;
}
tsinfo.hdr_rem = tc->t_tinc_hdr_rem; tsinfo.hdr_rem = tc->t_tinc_hdr_rem;
tsinfo.data_rem = tc->t_tinc_data_rem; tsinfo.data_rem = tc->t_tinc_data_rem;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment