Skip to contentSkip to conversation

net: export TCP send buffer size via netlink

PATCH Superseded Amerigo Wang 3 participants 4 messages Feb 1, 2010

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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.

Cc David Miller <[email protected]>

---

include/linux/tcp.h +1 -0
index 7fee8a4..46768de 100644
@@ -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
index b0a26bb..b3d6a62 100644
@@ -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;
#1 lore raw
Quoted 15 lines · Amerigo Wang

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.

Cc David Miller <[email protected]>

---

include/linux/tcp.h +0 -0
index 7fee8a4..46768de 100644

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.

author
#2 lore raw
Quoted 21 lines · Eric Dumazet
Quoted 20 lines · Amerigo Wang

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.

Cc David Miller <[email protected]>

---

include/linux/tcp.h +1 -0
index 7fee8a4..46768de 100644
@@ -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_info like 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!

maintainer
#3 lore raw
In reply to Amerigo Wang

From: 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_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.

Cc David Miller <[email protected]>

You can't change the layout of struct tcp_info, it's hard coded into applications.