aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-09-21 00:44:09 +0000
committerGuy Harris <guy@alum.mit.edu>2000-09-21 00:44:09 +0000
commit123144094324c87bc87e05a1dcf33813e904bf38 (patch)
tree835ab2d486351e7182c28532de76b87e23a89930
parent565a28497afe8937d38cbc480c5578f69f67b2b8 (diff)
If I ever again have to compute the sequence number of the first byte
after a TCP segment, so I can see what stuff some other segment is ACKing, I'll go crazy. Add a "Next sequence number" field to the TCP dissection, giving exactly that (well, giving exactly that unless the TCP segment is in a fragmented IP datagram, but hopefully those are rare; when we support IP fragment reassembly, we can fix that). svn path=/trunk/; revision=2453
-rw-r--r--packet-tcp.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/packet-tcp.c b/packet-tcp.c
index 1cf9038a6d..5f5b691a48 100644
--- a/packet-tcp.c
+++ b/packet-tcp.c
@@ -1,7 +1,7 @@
/* packet-tcp.c
* Routines for TCP packet disassembly
*
- * $Id: packet-tcp.c,v 1.83 2000/09/14 21:58:48 gram Exp $
+ * $Id: packet-tcp.c,v 1.84 2000/09/21 00:44:09 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -67,6 +67,7 @@ static int hf_tcp_srcport = -1;
static int hf_tcp_dstport = -1;
static int hf_tcp_port = -1;
static int hf_tcp_seq = -1;
+static int hf_tcp_nxtseq = -1;
static int hf_tcp_ack = -1;
static int hf_tcp_hdr_len = -1;
static int hf_tcp_flags = -1;
@@ -415,6 +416,7 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
guint hlen;
guint optlen;
guint packet_max = pi.len;
+ guint32 nxtseq;
OLD_CHECK_DISPLAY_AS_DATA(proto_tcp, pd, offset, fd, tree);
@@ -452,6 +454,9 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
hlen = hi_nibble(th.th_off_x2) * 4; /* TCP header length, in bytes */
+ /* Compute the sequence number of next octet after this segment. */
+ nxtseq = th.th_seq + (pi.len - (offset + hlen));
+
if (check_col(fd, COL_PROTOCOL))
col_add_str(fd, COL_PROTOCOL, "TCP");
if (check_col(fd, COL_INFO)) {
@@ -483,6 +488,8 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
proto_tree_add_uint_hidden(tcp_tree, hf_tcp_port, NullTVB, offset, 2, th.th_sport);
proto_tree_add_uint_hidden(tcp_tree, hf_tcp_port, NullTVB, offset + 2, 2, th.th_dport);
proto_tree_add_uint(tcp_tree, hf_tcp_seq, NullTVB, offset + 4, 4, th.th_seq);
+ if (nxtseq != th.th_seq)
+ proto_tree_add_uint(tcp_tree, hf_tcp_nxtseq, NullTVB, offset, 0, nxtseq);
if (th.th_flags & TH_ACK)
proto_tree_add_uint(tcp_tree, hf_tcp_ack, NullTVB, offset + 8, 4, th.th_ack);
proto_tree_add_uint_format(tcp_tree, hf_tcp_hdr_len, NullTVB, offset + 12, 1, hlen,
@@ -586,6 +593,10 @@ proto_register_tcp(void)
{ "Sequence number", "tcp.seq", FT_UINT32, BASE_DEC, NULL, 0x0,
"" }},
+ { &hf_tcp_nxtseq,
+ { "Next sequence number", "tcp.nxtseq", FT_UINT32, BASE_DEC, NULL, 0x0,
+ "" }},
+
{ &hf_tcp_ack,
{ "Acknowledgement number", "tcp.ack", FT_UINT32, BASE_DEC, NULL, 0x0,
"" }},