net: export TCP send buffer size via netlink
Subsystems (3)
PATCH 1/1 net: export TCP send buffer size via netlink
Currently, we can only get TCP send buffer size by getsockopt (SO_SNDBUF or TCP_INFO), this is not enough for the tools like netstat or ss to read.
Show TCP send buffer size via netlink NETLINK_INET_DIAG.
---
include/linux/tcp.h +1 -0
@@ -136,6 +136,7 @@ struct tcp_info {__u32 tcpi_ato;__u32 tcpi_snd_mss;__u32 tcpi_rcv_mss; +__u32 tcpi_sndbuf;__u32 tcpi_unacked;__u32 tcpi_sacked;
net/ipv4/tcp.c +1 -0
@@ -2385,6 +2385,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) info->tcpi_retransmits = icsk->icsk_retransmits; info->tcpi_probes = icsk->icsk_probes_out; info->tcpi_backoff = icsk->icsk_backoff; + info->tcpi_sndbuf = sk->sk_sndbuf;if (tp->rx_opt.tstamp_ok) info->tcpi_options |=TCPI_OPT_TIMESTAMPS ;
Quoted 15 lines · Amerigo Wang
Currently, we can only get TCP send buffer size by getsockopt (
SO_SNDBUForTCP_INFO), this is not enough for the tools like netstat or ss to read.Show TCP send buffer size via netlink
NETLINK_INET_DIAG.Signed-off-by WANG Cong <[email protected]>Cc David Miller <[email protected]>---
include/linux/tcp.h +0
-0
include/linux/tcp.h struct tcp_info { · line 142
Quoted 7 lines
include/linux/tcp.h +1
-0@@ -136,6 +136,7 @@ struct tcp_info {__u32 tcpi_ato;__u32 tcpi_snd_mss;__u32 tcpi_rcv_mss; +__u32 tcpi_sndbuf;__u32 tcpi_unacked;__u32 tcpi_sacked;
You cannot change tcp_info like this, this structure is used by some programs, and they are going to break badly.
Quoted 21 lines · Eric Dumazet
Quoted 20 lines · Amerigo Wang
Currently, we can only get TCP send buffer size by getsockopt (
SO_SNDBUForTCP_INFO), this is not enough for the tools like netstat or ss to read.Show TCP send buffer size via netlink
NETLINK_INET_DIAG.Signed-off-by WANG Cong <[email protected]>Cc David Miller <[email protected]>---
include/linux/tcp.h +1
-0@@ -136,6 +136,7 @@ struct tcp_info {__u32 tcpi_ato;__u32 tcpi_snd_mss;__u32 tcpi_rcv_mss; +__u32 tcpi_sndbuf;
Quoted 6 lines
include/linux/tcp.h struct tcp_info { · line 142
Quoted 2 lines
include/linux/tcp.h +0
-0__u32 tcpi_unacked;__u32 tcpi_sacked;You cannot change
tcp_infolike this, this structure is used by some programs, and they are going to break badly.
Oh, right, I forgot the ABI compatibility...
I will append it to this structure.
Thanks!
David Miller
maintainerFrom: Amerigo Wang <[email protected]>
Date: Mon, 1 Feb 2010 02:59:32 -0500
Quoted 9 lines
Currently, we can only get TCP send buffer size by getsockopt (
SO_SNDBUForTCP_INFO), this is not enough for the tools like netstat or ss to read.Show TCP send buffer size via netlink
NETLINK_INET_DIAG.Signed-off-by WANG Cong <[email protected]>Cc David Miller <[email protected]>
You can't change the layout of struct tcp_info, it's hard coded into applications.