Bug 22138

Summary: tcpdump not handling -v option correctly
Product: Base System Reporter: Matthew Cerha <mcerha>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.1-STABLE   
Hardware: Any   
OS: Any   

Description Matthew Cerha 2000-10-20 05:50:01 UTC
It appears that tcpdump does not properly interpret the -v (verbose) option
for TCP packet decodes. There appears to be a flaw in the flow control. 

In src/contrib/tcpdump/print-tcp.c:

497         if (!qflag && vflag && length > 0
498          && (sport == TELNET_PORT || dport == TELNET_PORT))
499                 telnet_print(bp, length);
500         else if (sport == BGP_PORT || dport == BGP_PORT)
501                 bgp_print(bp, length);
502         else if (sport == NETBIOS_SSN_PORT || dport == NETBIOS_SSN_PORT)    503                 nbt_tcp_print(bp, length);
504         return;

The first section doesn't make sense. The sport and dport clauses should be
grouped together and not with the flag clause.

PS Jerry found this bug. I'm just trying to report it :)

Fix: 

Apply the diff to src/contrib/tcpdump/print-tcp.c.

497,498c497,498
A
< 	if (!qflag && vflag && length > 0) {
< 	 if (sport == TELNET_PORT || dport == TELNET_PORT)
---
> 	if (!qflag && vflag && length > 0
> 	 && (sport == TELNET_PORT || dport == TELNET_PORT))
504d503
< 	}
How-To-Repeat: 
Just run tcpdump -v.
Comment 1 Joseph Koshy freebsd_committer freebsd_triage 2001-08-09 08:20:07 UTC
State Changed
From-To: open->closed

Fixed by the import of tcpdump v3.6.2 code (rev 1.1.1.5 in -current, 
and merged to stable on 2001/07/26).