* [PATCH] TCP: Add seq and ack numbers to TCP_INFO
@ 2008-07-09 17:23 Adam Langley
2008-07-09 17:49 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Adam Langley @ 2008-07-09 17:23 UTC (permalink / raw)
To: davem; +Cc: netdev
TCP: Add seq and ack numbers to TCP_INFO
No ABI breakage: Userspace specifies the size of the structure that they're
expecting, and the new fields are at the end, so existing code should function
just fine as we'll truncate the new struct tcp_info to fit.
Signed-off-by: Adam Langley <agl@imperialviolet.org>
---
include/linux/tcp.h | 5 +++++
net/ipv4/tcp.c | 5 +++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 07e79bd..55094ea 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -157,6 +157,11 @@ struct tcp_info
__u32 tcpi_rcv_space;
__u32 tcpi_total_retrans;
+
+ __u32 tcpi_seq; /* seq number of next byte to be written to socket */
+ __u32 tcpi_ack; /* ack number of next byte to be read from socket */
+ __u32 tcpi_tseq; /* seq number of next byte to be transmitted */
+ __u32 tcpi_tack; /* ack number of next byte to be received */
};
/* for TCP_MD5SIG socket option */
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 56a133c..c56d5c3 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2255,6 +2255,11 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info)
info->tcpi_rcv_space = tp->rcvq_space.space;
info->tcpi_total_retrans = tp->total_retrans;
+
+ info->tcpi_seq = tp->write_seq;
+ info->tcpi_ack = tp->copied_seq;
+ info->tcpi_tseq = tp->pushed_seq;
+ info->tcpi_tack = tp->rcv_nxt;
}
EXPORT_SYMBOL_GPL(tcp_get_info);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] TCP: Add seq and ack numbers to TCP_INFO
2008-07-09 17:23 [PATCH] TCP: Add seq and ack numbers to TCP_INFO Adam Langley
@ 2008-07-09 17:49 ` Stephen Hemminger
2008-07-09 18:02 ` Adam Langley
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2008-07-09 17:49 UTC (permalink / raw)
To: Adam Langley; +Cc: davem, netdev
On Wed, 9 Jul 2008 10:23:43 -0700
"Adam Langley" <agl@imperialviolet.org> wrote:
> TCP: Add seq and ack numbers to TCP_INFO
>
> No ABI breakage: Userspace specifies the size of the structure that they're
> expecting, and the new fields are at the end, so existing code should function
> just fine as we'll truncate the new struct tcp_info to fit.
>
> Signed-off-by: Adam Langley <agl@imperialviolet.org>
Of what possible use is this to an application? I worry that applications would
come to expect or use certain characteristics of the network and TCP which
would be broken by later changes.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] TCP: Add seq and ack numbers to TCP_INFO
2008-07-09 17:49 ` Stephen Hemminger
@ 2008-07-09 18:02 ` Adam Langley
0 siblings, 0 replies; 3+ messages in thread
From: Adam Langley @ 2008-07-09 18:02 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: davem, netdev
On Wed, Jul 9, 2008 at 10:49 AM, Stephen Hemminger
<stephen.hemminger@vyatta.com> wrote:
> Of what possible use is this to an application? I worry that applications would
> come to expect or use certain characteristics of the network and TCP which
> would be broken by later changes.
Well, when you consider what else is in tcp_info (window scaling, SACK
info, MTU, RTT, reorder detection), the sequence numbers seem
positively pedestrian.
There are a bunch of crazy reasons why userspace might be interested
in the seq/ack numbers: handing connections between hosts, checking
the backlog, analyzing the RNG strength of remote hosts etc. All
experimental crap to be sure, but it's very handy in those
experiments. I used a very similar patch when doing some of the very
early basic on backlogs that Jerry Chu has taken up now.
And sequence numbers are pretty fundamental to TCP. Certainly much
more so than much of the other stuff that we're currently happy to
export with sufficient warnings.
AGL
--
Adam Langley agl@imperialviolet.org http://www.imperialviolet.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-07-09 18:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-09 17:23 [PATCH] TCP: Add seq and ack numbers to TCP_INFO Adam Langley
2008-07-09 17:49 ` Stephen Hemminger
2008-07-09 18:02 ` Adam Langley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).