[TCP]: Report congestion control algorithm in tcp_diag.
authorStephen Hemminger <shemminger@osdl.org>
Thu, 23 Jun 2005 19:21:28 +0000 (12:21 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 23 Jun 2005 19:21:28 +0000 (12:21 -0700)
Enhancement to the tcp_diag interface used by the iproute2 ss command
to report the tcp congestion control being used by a socket.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/tcp_diag.h
net/ipv4/tcp_diag.c

index ceee962e1d15a56262fe9b288cce886db6ff1dbe..7a5996743946806feecb65274be02b328508ca70 100644 (file)
@@ -99,9 +99,10 @@ enum
        TCPDIAG_MEMINFO,
        TCPDIAG_INFO,
        TCPDIAG_VEGASINFO,
+       TCPDIAG_CONG,
 };
 
-#define TCPDIAG_MAX TCPDIAG_VEGASINFO
+#define TCPDIAG_MAX TCPDIAG_CONG
 
 
 /* TCPDIAG_MEM */
@@ -123,5 +124,4 @@ struct tcpvegas_info {
        __u32   tcpv_minrtt;
 };
 
-
 #endif /* _TCP_DIAG_H_ */
index a4e512036d8833fdfa0f0b47612a4c209002577f..f66945cb158fd346c0b2f87d0dec068620b7a838 100644 (file)
@@ -65,6 +65,11 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
                if (ext & (1<<(TCPDIAG_INFO-1)))
                        info = TCPDIAG_PUT(skb, TCPDIAG_INFO, sizeof(*info));
                
+               if (ext & (1<<(TCPDIAG_CONG-1))) {
+                       size_t len = strlen(tp->ca_ops->name);
+                       strcpy(TCPDIAG_PUT(skb, TCPDIAG_CONG, len+1),
+                              tp->ca_ops->name);
+               }
        }
        r->tcpdiag_family = sk->sk_family;
        r->tcpdiag_state = sk->sk_state;