diff options
author | Sowmini Varadhan <sowmini.varadhan@oracle.com> | 2016-11-04 13:04:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-09 12:47:49 -0500 |
commit | 1ac507d4ffbff578c388e85f9637dca19ff07b95 (patch) | |
tree | 6eb6081d9893891caf8dd5928a8418368be2c982 /net/rds/tcp.c | |
parent | f5f99309fa7481f59a500f0d08f3379cd6424c1f (diff) |
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: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds/tcp.c')
-rw-r--r-- | net/rds/tcp.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/net/rds/tcp.c b/net/rds/tcp.c index fcddacc92e01..3296a6ac583a 100644 --- a/net/rds/tcp.c +++ b/net/rds/tcp.c | |||
@@ -220,7 +220,7 @@ void rds_tcp_set_callbacks(struct socket *sock, struct rds_conn_path *cp) | |||
220 | write_unlock_bh(&sock->sk->sk_callback_lock); | 220 | write_unlock_bh(&sock->sk->sk_callback_lock); |
221 | } | 221 | } |
222 | 222 | ||
223 | static void rds_tcp_tc_info(struct socket *sock, unsigned int len, | 223 | static void rds_tcp_tc_info(struct socket *rds_sock, unsigned int len, |
224 | struct rds_info_iterator *iter, | 224 | struct rds_info_iterator *iter, |
225 | struct rds_info_lengths *lens) | 225 | struct rds_info_lengths *lens) |
226 | { | 226 | { |
@@ -229,6 +229,7 @@ static void rds_tcp_tc_info(struct socket *sock, unsigned int len, | |||
229 | unsigned long flags; | 229 | unsigned long flags; |
230 | struct sockaddr_in sin; | 230 | struct sockaddr_in sin; |
231 | int sinlen; | 231 | int sinlen; |
232 | struct socket *sock; | ||
232 | 233 | ||
233 | spin_lock_irqsave(&rds_tcp_tc_list_lock, flags); | 234 | spin_lock_irqsave(&rds_tcp_tc_list_lock, flags); |
234 | 235 | ||
@@ -237,12 +238,17 @@ static void rds_tcp_tc_info(struct socket *sock, unsigned int len, | |||
237 | 238 | ||
238 | list_for_each_entry(tc, &rds_tcp_tc_list, t_list_item) { | 239 | list_for_each_entry(tc, &rds_tcp_tc_list, t_list_item) { |
239 | 240 | ||
240 | sock->ops->getname(sock, (struct sockaddr *)&sin, &sinlen, 0); | 241 | sock = tc->t_sock; |
241 | tsinfo.local_addr = sin.sin_addr.s_addr; | 242 | if (sock) { |
242 | tsinfo.local_port = sin.sin_port; | 243 | sock->ops->getname(sock, (struct sockaddr *)&sin, |
243 | sock->ops->getname(sock, (struct sockaddr *)&sin, &sinlen, 1); | 244 | &sinlen, 0); |
244 | tsinfo.peer_addr = sin.sin_addr.s_addr; | 245 | tsinfo.local_addr = sin.sin_addr.s_addr; |
245 | tsinfo.peer_port = sin.sin_port; | 246 | tsinfo.local_port = sin.sin_port; |
247 | sock->ops->getname(sock, (struct sockaddr *)&sin, | ||
248 | &sinlen, 1); | ||
249 | tsinfo.peer_addr = sin.sin_addr.s_addr; | ||
250 | tsinfo.peer_port = sin.sin_port; | ||
251 | } | ||
246 | 252 | ||
247 | tsinfo.hdr_rem = tc->t_tinc_hdr_rem; | 253 | tsinfo.hdr_rem = tc->t_tinc_hdr_rem; |
248 | tsinfo.data_rem = tc->t_tinc_data_rem; | 254 | tsinfo.data_rem = tc->t_tinc_data_rem; |