aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_diag.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@ghostprotocols.net>2005-08-09 23:10:42 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-08-29 18:43:19 -0400
commit463c84b97f24010a67cd871746d6a7e4c925a5f9 (patch)
tree48df67ede4ebb5d12b3c0ae55d72531574bd51a6 /net/ipv4/tcp_diag.c
parent87d11ceb9deb7a3f13fdee6e89d9bb6be7d27a71 (diff)
[NET]: Introduce inet_connection_sock
This creates struct inet_connection_sock, moving members out of struct tcp_sock that are shareable with other INET connection oriented protocols, such as DCCP, that in my private tree already uses most of these members. The functions that operate on these members were renamed, using a inet_csk_ prefix while not being moved yet to a new file, so as to ease the review of these changes. Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_diag.c')
-rw-r--r--net/ipv4/tcp_diag.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
index 60c6a797cc50..5f4c74f45e82 100644
--- a/net/ipv4/tcp_diag.c
+++ b/net/ipv4/tcp_diag.c
@@ -48,8 +48,9 @@ static struct sock *tcpnl;
48static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk, 48static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
49 int ext, u32 pid, u32 seq, u16 nlmsg_flags) 49 int ext, u32 pid, u32 seq, u16 nlmsg_flags)
50{ 50{
51 struct inet_sock *inet = inet_sk(sk); 51 const struct inet_sock *inet = inet_sk(sk);
52 struct tcp_sock *tp = tcp_sk(sk); 52 struct tcp_sock *tp = tcp_sk(sk);
53 const struct inet_connection_sock *icsk = inet_csk(sk);
53 struct tcpdiagmsg *r; 54 struct tcpdiagmsg *r;
54 struct nlmsghdr *nlh; 55 struct nlmsghdr *nlh;
55 struct tcp_info *info = NULL; 56 struct tcp_info *info = NULL;
@@ -129,14 +130,14 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
129 130
130#define EXPIRES_IN_MS(tmo) ((tmo-jiffies)*1000+HZ-1)/HZ 131#define EXPIRES_IN_MS(tmo) ((tmo-jiffies)*1000+HZ-1)/HZ
131 132
132 if (tp->pending == TCP_TIME_RETRANS) { 133 if (icsk->icsk_pending == ICSK_TIME_RETRANS) {
133 r->tcpdiag_timer = 1; 134 r->tcpdiag_timer = 1;
134 r->tcpdiag_retrans = tp->retransmits; 135 r->tcpdiag_retrans = icsk->icsk_retransmits;
135 r->tcpdiag_expires = EXPIRES_IN_MS(tp->timeout); 136 r->tcpdiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout);
136 } else if (tp->pending == TCP_TIME_PROBE0) { 137 } else if (icsk->icsk_pending == ICSK_TIME_PROBE0) {
137 r->tcpdiag_timer = 4; 138 r->tcpdiag_timer = 4;
138 r->tcpdiag_retrans = tp->probes_out; 139 r->tcpdiag_retrans = tp->probes_out;
139 r->tcpdiag_expires = EXPIRES_IN_MS(tp->timeout); 140 r->tcpdiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout);
140 } else if (timer_pending(&sk->sk_timer)) { 141 } else if (timer_pending(&sk->sk_timer)) {
141 r->tcpdiag_timer = 2; 142 r->tcpdiag_timer = 2;
142 r->tcpdiag_retrans = tp->probes_out; 143 r->tcpdiag_retrans = tp->probes_out;
@@ -497,7 +498,7 @@ static int tcpdiag_dump_reqs(struct sk_buff *skb, struct sock *sk,
497{ 498{
498 struct tcpdiag_entry entry; 499 struct tcpdiag_entry entry;
499 struct tcpdiagreq *r = NLMSG_DATA(cb->nlh); 500 struct tcpdiagreq *r = NLMSG_DATA(cb->nlh);
500 struct tcp_sock *tp = tcp_sk(sk); 501 struct inet_connection_sock *icsk = inet_csk(sk);
501 struct listen_sock *lopt; 502 struct listen_sock *lopt;
502 struct rtattr *bc = NULL; 503 struct rtattr *bc = NULL;
503 struct inet_sock *inet = inet_sk(sk); 504 struct inet_sock *inet = inet_sk(sk);
@@ -513,9 +514,9 @@ static int tcpdiag_dump_reqs(struct sk_buff *skb, struct sock *sk,
513 514
514 entry.family = sk->sk_family; 515 entry.family = sk->sk_family;
515 516
516 read_lock_bh(&tp->accept_queue.syn_wait_lock); 517 read_lock_bh(&icsk->icsk_accept_queue.syn_wait_lock);
517 518
518 lopt = tp->accept_queue.listen_opt; 519 lopt = icsk->icsk_accept_queue.listen_opt;
519 if (!lopt || !lopt->qlen) 520 if (!lopt || !lopt->qlen)
520 goto out; 521 goto out;
521 522
@@ -572,7 +573,7 @@ static int tcpdiag_dump_reqs(struct sk_buff *skb, struct sock *sk,
572 } 573 }
573 574
574out: 575out:
575 read_unlock_bh(&tp->accept_queue.syn_wait_lock); 576 read_unlock_bh(&icsk->icsk_accept_queue.syn_wait_lock);
576 577
577 return err; 578 return err;
578} 579}