diff options
author | Eric Dumazet <edumazet@google.com> | 2015-03-12 19:44:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-12 22:58:13 -0400 |
commit | d4f06873b636519cedbe8d2eeae77c713c6a121c (patch) | |
tree | 7025fa2ff2b8cf9e701de46ce7c71a1553f1a19a /net | |
parent | 41b822c59e21414d829bcfd00df0c8f7f13b1b95 (diff) |
inet: get_openreq4() & get_openreq6() do not need listener
ireq->ir_num contains local port, use it.
Also, get_openreq4() dumping listen_sk->refcnt makes litle sense.
inet_diag_fill_req() can also use ireq->ir_num
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/inet_diag.c | 3 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 8 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 4 |
3 files changed, 7 insertions, 8 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 29317ff4a007..c55a6fa3162d 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -718,7 +718,6 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk, | |||
718 | const struct nlmsghdr *unlh) | 718 | const struct nlmsghdr *unlh) |
719 | { | 719 | { |
720 | const struct inet_request_sock *ireq = inet_rsk(req); | 720 | const struct inet_request_sock *ireq = inet_rsk(req); |
721 | struct inet_sock *inet = inet_sk(sk); | ||
722 | struct inet_diag_msg *r; | 721 | struct inet_diag_msg *r; |
723 | struct nlmsghdr *nlh; | 722 | struct nlmsghdr *nlh; |
724 | long tmo; | 723 | long tmo; |
@@ -744,7 +743,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk, | |||
744 | if (tmo < 0) | 743 | if (tmo < 0) |
745 | tmo = 0; | 744 | tmo = 0; |
746 | 745 | ||
747 | r->id.idiag_sport = inet->inet_sport; | 746 | r->id.idiag_sport = htons(ireq->ir_num); |
748 | r->id.idiag_dport = ireq->ir_rmt_port; | 747 | r->id.idiag_dport = ireq->ir_rmt_port; |
749 | 748 | ||
750 | memset(&r->id.idiag_src, 0, sizeof(r->id.idiag_src)); | 749 | memset(&r->id.idiag_src, 0, sizeof(r->id.idiag_src)); |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index f0c6fc32bfa8..70b0f701bbdb 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -2204,7 +2204,7 @@ void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo) | |||
2204 | } | 2204 | } |
2205 | EXPORT_SYMBOL(tcp_proc_unregister); | 2205 | EXPORT_SYMBOL(tcp_proc_unregister); |
2206 | 2206 | ||
2207 | static void get_openreq4(const struct sock *sk, const struct request_sock *req, | 2207 | static void get_openreq4(const struct request_sock *req, |
2208 | struct seq_file *f, int i, kuid_t uid) | 2208 | struct seq_file *f, int i, kuid_t uid) |
2209 | { | 2209 | { |
2210 | const struct inet_request_sock *ireq = inet_rsk(req); | 2210 | const struct inet_request_sock *ireq = inet_rsk(req); |
@@ -2214,7 +2214,7 @@ static void get_openreq4(const struct sock *sk, const struct request_sock *req, | |||
2214 | " %02X %08X:%08X %02X:%08lX %08X %5u %8d %u %d %pK", | 2214 | " %02X %08X:%08X %02X:%08lX %08X %5u %8d %u %d %pK", |
2215 | i, | 2215 | i, |
2216 | ireq->ir_loc_addr, | 2216 | ireq->ir_loc_addr, |
2217 | ntohs(inet_sk(sk)->inet_sport), | 2217 | ireq->ir_num, |
2218 | ireq->ir_rmt_addr, | 2218 | ireq->ir_rmt_addr, |
2219 | ntohs(ireq->ir_rmt_port), | 2219 | ntohs(ireq->ir_rmt_port), |
2220 | TCP_SYN_RECV, | 2220 | TCP_SYN_RECV, |
@@ -2225,7 +2225,7 @@ static void get_openreq4(const struct sock *sk, const struct request_sock *req, | |||
2225 | from_kuid_munged(seq_user_ns(f), uid), | 2225 | from_kuid_munged(seq_user_ns(f), uid), |
2226 | 0, /* non standard timer */ | 2226 | 0, /* non standard timer */ |
2227 | 0, /* open_requests have no inode */ | 2227 | 0, /* open_requests have no inode */ |
2228 | atomic_read(&sk->sk_refcnt), | 2228 | 0, |
2229 | req); | 2229 | req); |
2230 | } | 2230 | } |
2231 | 2231 | ||
@@ -2332,7 +2332,7 @@ static int tcp4_seq_show(struct seq_file *seq, void *v) | |||
2332 | get_tcp4_sock(v, seq, st->num); | 2332 | get_tcp4_sock(v, seq, st->num); |
2333 | break; | 2333 | break; |
2334 | case TCP_SEQ_STATE_OPENREQ: | 2334 | case TCP_SEQ_STATE_OPENREQ: |
2335 | get_openreq4(st->syn_wait_sk, v, seq, st->num, st->uid); | 2335 | get_openreq4(v, seq, st->num, st->uid); |
2336 | break; | 2336 | break; |
2337 | } | 2337 | } |
2338 | out: | 2338 | out: |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 5d46832c6f72..1ccfede7d55f 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1689,7 +1689,7 @@ static void tcp_v6_destroy_sock(struct sock *sk) | |||
1689 | #ifdef CONFIG_PROC_FS | 1689 | #ifdef CONFIG_PROC_FS |
1690 | /* Proc filesystem TCPv6 sock list dumping. */ | 1690 | /* Proc filesystem TCPv6 sock list dumping. */ |
1691 | static void get_openreq6(struct seq_file *seq, | 1691 | static void get_openreq6(struct seq_file *seq, |
1692 | const struct sock *sk, struct request_sock *req, int i, kuid_t uid) | 1692 | struct request_sock *req, int i, kuid_t uid) |
1693 | { | 1693 | { |
1694 | int ttd = req->expires - jiffies; | 1694 | int ttd = req->expires - jiffies; |
1695 | const struct in6_addr *src = &inet_rsk(req)->ir_v6_loc_addr; | 1695 | const struct in6_addr *src = &inet_rsk(req)->ir_v6_loc_addr; |
@@ -1827,7 +1827,7 @@ static int tcp6_seq_show(struct seq_file *seq, void *v) | |||
1827 | get_tcp6_sock(seq, v, st->num); | 1827 | get_tcp6_sock(seq, v, st->num); |
1828 | break; | 1828 | break; |
1829 | case TCP_SEQ_STATE_OPENREQ: | 1829 | case TCP_SEQ_STATE_OPENREQ: |
1830 | get_openreq6(seq, st->syn_wait_sk, v, st->num, st->uid); | 1830 | get_openreq6(seq, v, st->num, st->uid); |
1831 | break; | 1831 | break; |
1832 | } | 1832 | } |
1833 | out: | 1833 | out: |