diff options
author | fenner <fenner> | 1999-11-22 04:27:10 +0000 |
---|---|---|
committer | fenner <fenner> | 1999-11-22 04:27:10 +0000 |
commit | f0d4fb1e2fa6cc9e81e9c65a1a433951e54bb8ed (patch) | |
tree | 8e5b32dbc42ade6f95ca841ddf5be12f310ed8fa /print-tcp.c | |
parent | a2392b0db27bde1c138248468eac013f03271219 (diff) | |
download | tcpdump-f0d4fb1e2fa6cc9e81e9c65a1a433951e54bb8ed.tar.gz |
- Print the IP source and destination if the TCP header is truncated before
the ports.
- Print the TCP port information if the TCP header is truncated after the
ports.
- Print the sequence number if -vv even if you wouldn't normally.
Diffstat (limited to 'print-tcp.c')
-rw-r--r-- | print-tcp.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/print-tcp.c b/print-tcp.c index 987f7ad6..895be3bf 100644 --- a/print-tcp.c +++ b/print-tcp.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.60 1999-11-21 15:57:51 assar Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.61 1999-11-22 04:27:10 fenner Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -135,18 +135,15 @@ tcp_print(register const u_char *bp, register u_int length, ip6 = NULL; #endif /*INET6*/ ch = '\0'; - TCHECK(*tp); - if (length < sizeof(*tp)) { - (void)printf("truncated-tcp %d", length); + if (!TTEST(tp->th_dport)) { + (void)printf("%s > %s: [|tcp]", + ipaddr_string(&ip->ip_src), + ipaddr_string(&ip->ip_dst)); return; } sport = ntohs(tp->th_sport); dport = ntohs(tp->th_dport); - seq = ntohl(tp->th_seq); - ack = ntohl(tp->th_ack); - win = ntohs(tp->th_win); - urp = ntohs(tp->th_urp); #ifdef INET6 if (ip6) { @@ -175,6 +172,13 @@ tcp_print(register const u_char *bp, register u_int length, } } + TCHECK(*tp); + + seq = ntohl(tp->th_seq); + ack = ntohl(tp->th_ack); + win = ntohs(tp->th_win); + urp = ntohs(tp->th_urp); + if (qflag) { (void)printf("tcp %d", length - tp->th_off * 4); return; @@ -311,7 +315,7 @@ tcp_print(register const u_char *bp, register u_int length, return; } length -= hlen; - if (length > 0 || flags & (TH_SYN | TH_FIN | TH_RST)) + if (vflag > 1 || length > 0 || flags & (TH_SYN | TH_FIN | TH_RST)) (void)printf(" %u:%u(%d)", seq, seq + length, length); if (flags & TH_ACK) (void)printf(" ack %u", ack); |