[PATCH net-2.6.26 2/2] [TCP]: Format addresses appropriately in debug messages.

Previous thread: Re: [XFRM]: xfrm_user: fix selector family initialization by Marco Berizzi on Monday, April 14, 2008 - 3:33 am. (2 messages)

Next thread: [PATCH net-2.6.26][DCCP]: Fix comment about control sockets. by Pavel Emelyanov on Monday, April 14, 2008 - 5:36 am. (2 messages)
To: <davem@...>
Cc: <yoshfuji@...>, <netdev@...>
Date: Monday, April 14, 2008 - 5:25 am

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
net/ipv4/tcp_input.c | 25 +++++++++++++++++++------
net/ipv4/tcp_timer.c | 12 ++++++++++--
2 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index af2ec61..032ffdf 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2280,12 +2280,25 @@ static void DBGUNDO(struct sock *sk, const char *msg)
struct tcp_sock *tp = tcp_sk(sk);
struct inet_sock *inet = inet_sk(sk);

- printk(KERN_DEBUG "Undo %s " NIPQUAD_FMT "/%u c%u l%u ss%u/%u p%u\n",
- msg,
- NIPQUAD(inet->daddr), ntohs(inet->dport),
- tp->snd_cwnd, tcp_left_out(tp),
- tp->snd_ssthresh, tp->prior_ssthresh,
- tp->packets_out);
+ if (sk->sk_family == AF_INET) {
+ printk(KERN_DEBUG "Undo %s " NIPQUAD_FMT "/%u c%u l%u ss%u/%u p%u\n",
+ msg,
+ NIPQUAD(inet->daddr), ntohs(inet->dport),
+ tp->snd_cwnd, tcp_left_out(tp),
+ tp->snd_ssthresh, tp->prior_ssthresh,
+ tp->packets_out);
+ }
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+ else if (sk->sk_family == AF_INET6) {
+ struct ipv6_pinfo *np = inet6_sk(sk);
+ printk(KERN_DEBUG "Undo %s " NIP6_FMT "/%u c%u l%u ss%u/%u p%u\n",
+ msg,
+ NIP6(np->daddr), ntohs(inet->dport),
+ tp->snd_cwnd, tcp_left_out(tp),
+ tp->snd_ssthresh, tp->prior_ssthresh,
+ tp->packets_out);
+ }
+#endif
}
#else
#define DBGUNDO(x...) do { } while (0)
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index e588d6d..4de68cf 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -299,12 +299,20 @@ static void tcp_retransmit_timer(struct sock *sk)
* we cannot allow such beasts to hang infinitely.
*/
#ifdef TCP_DEBUG
- if (1) {
- struct inet_sock *inet = inet_sk(sk);
+ struct inet_sock *inet = inet_sk(sk);
+ if (sk->sk_family == AF_INET)...

Previous thread: Re: [XFRM]: xfrm_user: fix selector family initialization by Marco Berizzi on Monday, April 14, 2008 - 3:33 am. (2 messages)

Next thread: [PATCH net-2.6.26][DCCP]: Fix comment about control sockets. by Pavel Emelyanov on Monday, April 14, 2008 - 5:36 am. (2 messages)