[TCP]: Format addresses appropriately in debug messages.
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Mon, 14 Apr 2008 11:09:36 +0000 (04:09 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 Apr 2008 11:09:36 +0000 (04:09 -0700)
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_input.c
net/ipv4/tcp_timer.c

index 3c6c7d7a7b0abbeaed332d6c7b4aea15d1302ffb..1bdb1bd22134ae0f20ce09f297791d4468b1da80 100644 (file)
@@ -2309,12 +2309,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)
index e588d6dc2a8175480a53a8c186aef62f02ed87d8..4de68cf5f2aad61322bbb58dc6d6dfb328055acf 100644 (file)
@@ -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) {
                        LIMIT_NETDEBUG(KERN_DEBUG "TCP: Treason uncloaked! Peer " NIPQUAD_FMT ":%u/%u shrinks window %u:%u. Repaired.\n",
                               NIPQUAD(inet->daddr), ntohs(inet->dport),
                               inet->num, tp->snd_una, tp->snd_nxt);
                }
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+               else if (sk->sk_family == AF_INET6) {
+                       struct ipv6_pinfo *np = inet6_sk(sk);
+                       LIMIT_NETDEBUG(KERN_DEBUG "TCP: Treason uncloaked! Peer " NIP6_FMT ":%u/%u shrinks window %u:%u. Repaired.\n",
+                              NIP6(np->daddr), ntohs(inet->dport),
+                              inet->num, tp->snd_una, tp->snd_nxt);
+               }
+#endif
 #endif
                if (tcp_time_stamp - tp->rcv_tstamp > TCP_RTO_MAX) {
                        tcp_write_err(sk);